Re: Parrot as an extension language

2005-05-21 Thread Leopold Toetsch
Colin Paul Adams wrote: "Colin" == Colin Paul Adams <[EMAIL PROTECTED]> writes: "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> What's the difference WRT va_list? If the interface code Leopold> can stuff things into an array, it sould as well be able Leopold> t

Re: Parrot as an extension language

2005-05-21 Thread Colin Paul Adams
> "Colin" == Colin Paul Adams <[EMAIL PROTECTED]> writes: > "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> What's the difference WRT va_list? If the interface code Leopold> can stuff things into an array, it sould as well be able Leopold> to prepare a va_list

Re: Parrot as an extension language

2005-05-21 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> BTW (again) which interface generator for which Eiffel? Oops. I missed that last bit. All current Eiffel compilers are supported. -- Colin Adams Preston Lancashire

Re: Parrot as an extension language

2005-05-21 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> Colin Paul Adams wrote: >>> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> What's the difference WRT va_list? If the interface code Leopold> can stuff things into an array, it sould as we

Re: Parrot as an extension language

2005-05-21 Thread Leopold Toetsch
Colin Paul Adams wrote: "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> What's the difference WRT va_list? If the interface code Leopold> can stuff things into an array, it sould as well be able Leopold> to prepare a va_list. You are quite right. I'll harass the

Re: Parrot as an extension language

2005-05-21 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > 1) Someone fixes the Eiffel interface generator to understand C > variadic functions. Yep :) > 2) We provide a function and method call interface that assumes > you've already pre-filled in the registers according to parrot's > calling conventions That

Re: Parrot as an extension language

2005-05-21 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> What's the difference WRT va_list? If the interface code Leopold> can stuff things into an array, it sould as well be able Leopold> to prepare a va_list. You are quite right. I'll harass the author of the interfac

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Dan" == Dan Sugalski <[EMAIL PROTECTED]> writes: Dan> So, I see four real options: Dan> 1) Someone fixes the Eiffel interface generator to understand Dan> C variadic functions. 2) We provide a function and method Dan> call interface that assumes you've already pre-filled i

Re: Parrot as an extension language

2005-05-20 Thread C. Scott Ananian
On Fri, 20 May 2005, Dan Sugalski wrote: So, I see four real options: 1) Someone fixes the Eiffel interface generator to understand C variadic functions. 2) We provide a function and method call interface that assumes you've already pre-filled in the registers according to parrot's calling conve

Re: Parrot as an extension language

2005-05-20 Thread C. Scott Ananian
On Fri, 20 May 2005, Colin Paul Adams wrote: Leopold> interpreter, PMC *sub, const char *sig, va_list args)> And as for hand-writing interfaces, I'm not sure I know HOW to create a va_list. void *Parrot_runops_fromc_argsN(Parrot_Interp i, PMC *sub, const char *si

Re: Parrot as an extension language

2005-05-20 Thread Leopold Toetsch
Dan Sugalski wrote: There are interfaces in the extension system to get a void * and length back from a PMC when fetching string data out, but I see we don't have that for plain strings. I'll probably fix that this weekend if someone doesn't beat me to it. There was a disucssion WRT that on #par

Re: Parrot as an extension language

2005-05-20 Thread Dan Sugalski
At 4:35 PM -0400 5/20/05, C. Scott Ananian wrote: On Fri, 20 May 2005, Dan Sugalski wrote: Well, mostly. string->cstring conversion is potentially lossy, if for no other reason than embedded nulls will get in your way. I see we're not exposing anything to do that, though, which we ought to fix.

Re: Parrot as an extension language

2005-05-20 Thread C. Scott Ananian
On Fri, 20 May 2005, Dan Sugalski wrote: Well, mostly. string->cstring conversion is potentially lossy, if for no other reason than embedded nulls will get in your way. I see we're not exposing anything to do that, though, which we ought to fix. pascal-style strings (ie, char* and length) are the

Re: Parrot as an extension language

2005-05-20 Thread Dan Sugalski
At 8:10 PM +0100 5/20/05, Colin Paul Adams wrote: > "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> Colin Paul Adams <[EMAIL PROTECTED]> wrote: >> I have a problem with this - namely that the function is >> variadic, and the interface generator can't cope with thi

Re: Parrot as an extension language

2005-05-20 Thread Leopold Toetsch
Colin Paul Adams wrote: "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> interpreter, PMC *sub, const char *sig, va_list args)> Despite what I said before, this is actually worse than Parrot_call_sub. The interface generator ignores it completely, What interface generator? .

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> Colin Paul Adams <[EMAIL PROTECTED]> wrote: >> I have a problem with this - namely that the function is >> variadic, and the interface generator can't cope with this. Leopold> Have a look at src/inter_run.c e.

Re: Parrot as an extension language

2005-05-20 Thread Dan Sugalski
At 1:15 AM +0800 5/21/05, Autrijus Tang wrote: On Sat, May 21, 2005 at 12:53:15AM +0800, Autrijus Tang wrote: Yeah, I bumped against that too. You need to look at the "strstart" field in the ParrotString struct. In Haskell I use: peekCString =<< #{peek STRING, strstart} s5 Actually, never

Re: Parrot as an extension language

2005-05-20 Thread Autrijus Tang
On Sat, May 21, 2005 at 12:53:15AM +0800, Autrijus Tang wrote: > Yeah, I bumped against that too. You need to look at the "strstart" > field in the ParrotString struct. > > In Haskell I use: > > peekCString =<< #{peek STRING, strstart} s5 Actually, never mind; string_to_cstring is the way t

Re: Parrot as an extension language

2005-05-20 Thread Autrijus Tang
On Sat, May 21, 2005 at 12:53:15AM +0800, Autrijus Tang wrote: > On Fri, May 20, 2005 at 05:42:48PM +0100, Colin Paul Adams wrote: > > There is a function declaration > > Parrot_string_cstring > > > > in string_funcs.h, but it appears to have no definitoon anywhere, so > > that's not much use to m

Re: Parrot as an extension language

2005-05-20 Thread Autrijus Tang
On Fri, May 20, 2005 at 05:42:48PM +0100, Colin Paul Adams wrote: > The problem I'm finding with this, is getting back the returned string > characters. > I assume the void * returned is pointing to a Parrot String. > Certainly it's not a const char *. Yes. > There is a function declaration > Par

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> You may wish to use Parrot_call_sub's "SS" form, where Autrijus> you pass in a string and get back a string. Something Autrijus> like this: Autrijus> my $interp = Parrot_new(undef); Autrijus> # .

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> Colin Paul Adams <[EMAIL PROTECTED]> wrote: >> I have a problem with this - namely that the function is >> variadic, and the interface generator can't cope with this. Leopold> Have a look at src/inter_run.c e.

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> On Fri, May 20, 2005 at 10:34:39AM +0100, Colin Paul Autrijus> Adams wrote: >> I have a problem with this - namely that the function is >> variadic, and the interface generator can't cope with this. Autrij

Re: Parrot as an extension language

2005-05-20 Thread Leopold Toetsch
Colin Paul Adams <[EMAIL PROTECTED]> wrote: > I have a problem with this - namely that the function is variadic, and > the interface generator can't cope with this. Have a look at src/inter_run.c e.g. leo

Re: Parrot as an extension language

2005-05-20 Thread Autrijus Tang
On Fri, May 20, 2005 at 10:34:39AM +0100, Colin Paul Adams wrote: > I have a problem with this - namely that the function is variadic, and > the interface generator can't cope with this. Hmm, in Haskell FFI, we hard-coded two cases of invocation, treating the function as two distinct, non-variadic

Re: Parrot as an extension language

2005-05-20 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> On Tue, May 17, 2005 at 03:00:14PM +0100, Colin Paul Autrijus> Adams wrote: >> But when I look at http://www.parrotcode.org/docs/embed.html, I >> can see no way of getting information back from the script -

Re: Parrot as an extension language

2005-05-19 Thread Colin Paul Adams
> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes: Leopold> Yeah. I'm sorry to say that: you are just hitting a part Leopold> of Parrot labeled "under (re)construction" and the docs Leopold> aren't all up to date. >> So does that mean I'm limited to singlebyte string

Re: Parrot as an extension language

2005-05-19 Thread Leopold Toetsch
Colin Paul Adams wrote: Parrot_new_string and I'm passing "UTF-8" as the encoding name. I get back: Can't make 'UTF-8' charset strings ^^^ Despite what the documentation says: encoding Yeah. I'm sorry to say that: you are just hitting a part of Parrot labeled "under (re)co

Re: Parrot as an extension language

2005-05-19 Thread Colin Paul Adams
> "Colin" == Colin Paul Adams <[EMAIL PROTECTED]> writes: > "Jeff" == Jeff Horwitz <[EMAIL PROTECTED]> writes: Colin> Can't make 'UTF-8' charset strings Colin> Despite what the documentation says: Colin> encoding Colin> This specifies the encoding used to encode the cha

Re: Parrot as an extension language

2005-05-19 Thread Colin Paul Adams
> "Jeff" == Jeff Horwitz <[EMAIL PROTECTED]> writes: Jeff> all you should need to include is embed.h, extend.h and for Jeff> now, resources.h. i'm actually working on fleshing these Jeff> files out to be more consistent wrt the public API. I'm getting real close now. But I'm hav

Re: Parrot as an extension language

2005-05-19 Thread Colin Paul Adams
> "Jeff" == Jeff Horwitz <[EMAIL PROTECTED]> writes: >> What headers do I need to read for the parrot_find_global call? Jeff> Parrot_PMC is the public type, and behind the scenes it's Jeff> defined as PMC *. Jeff> all you should need to include is embed.h, extend.h and for

Re: Parrot as an extension language

2005-05-19 Thread Jeff Horwitz
On 19 May 2005, Colin Paul Adams wrote: [snip] > I'm having a problem with this. > For Parrot_find_global, I'm specifying global.h as one of the header > files which must be read to generate definitions from. > But this is failing, apparently because PMC isn't defined. > > So I tried to find wher

Re: Parrot as an extension language

2005-05-19 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> You may wish to use Parrot_call_sub's "SS" form, where Autrijus> you pass in a string and get back a string. Something Autrijus> like this: Autrijus> my $interp = Parrot_new(undef); Autrijus> # .

Re: Parrot as an extension language

2005-05-18 Thread Leopold Toetsch
Colin Paul Adams wrote: Autrijus> my $return_str = Parrot_call_sub( $interp, Autrijus> $code_pmc, const_string("SS"), Autrijus> const_string("Your_input_string_here"), ); I'm confused by this - what language is it written in? Perl? APL: Autrijus' Pseudocde Language And will: Parrot_

Re: Parrot as an extension language

2005-05-18 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> On Tue, May 17, 2005 at 03:00:14PM +0100, Colin Paul Autrijus> Adams wrote: >> But when I look at http://www.parrotcode.org/docs/embed.html, I >> can see no way of getting information back from the script -

Re: Parrot as an extension language

2005-05-17 Thread jerry gay
On 5/17/05, Autrijus Tang <[EMAIL PROTECTED]> wrote: > On Tue, May 17, 2005 at 05:31:32PM +0100, Colin Paul Adams wrote: > > I take it SS stands for String-to-String? > > Yes. "PPC" would stand for PMC -> PMC -> String, i.e. take two PMCs > and returns a String. > of course, you meant PPS here,

Re: Parrot as an extension language

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 05:31:32PM +0100, Colin Paul Adams wrote: > I take it SS stands for String-to-String? Yes. "PPC" would stand for PMC -> PMC -> String, i.e. take two PMCs and returns a String. > Which section within http://www.parrotcode.org/docs/ covers this sort > of thing? `perldoc ex

Re: Parrot as an extension language

2005-05-17 Thread Jeff Horwitz
On 17 May 2005, Colin Paul Adams wrote: > Actually, examples in any language are fine. > I'm actually writing in Eiffel, but I shall use an interface generator > to automatically build low-level bridging classes from the C header > files. > I intend to make it available as a general extension mech

Re: Parrot as an extension language

2005-05-17 Thread Colin Paul Adams
> "Jeff" == Jeff Horwitz <[EMAIL PROTECTED]> writes: >> Why's that a but? Haskell's a good language. Jeff> no argument there -- just assumed you were looking for Jeff> examples in C! :) Actually, examples in any language are fine. I'm actually writing in Eiffel, but I shall use

Re: Parrot as an extension language

2005-05-17 Thread Colin Paul Adams
> "Autrijus" == Autrijus Tang <[EMAIL PROTECTED]> writes: Autrijus> You may wish to use Parrot_call_sub's "SS" form, where Autrijus> you pass in a string and get back a string. I take it SS stands for String-to-String? Which section within http://www.parrotcode.org/docs/ covers this

Re: Parrot as an extension language

2005-05-17 Thread Jeff Horwitz
On 17 May 2005, Colin Paul Adams wrote: > Jeff> also have a look at the mod_parrot source > Jeff> (http://www.smashing.org/mod_parrot), which is one of the > Jeff> few apps embedding parrot at the moment. the other is pugs > Jeff> (http://www.pugscode.org), but it's written in has

Re: Parrot as an extension language

2005-05-17 Thread Colin Paul Adams
> "Jeff" == Jeff Horwitz <[EMAIL PROTECTED]> writes: Jeff> you'll probably want to use the Parrot_call_sub_* API to Jeff> call individual subroutines and get return values. "perldoc Jeff> extend.c" in the parrot source for more info. you might Thanks - I'll take a look at that.

Re: Parrot as an extension language

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 03:00:14PM +0100, Colin Paul Adams wrote: > But when I look at http://www.parrotcode.org/docs/embed.html, I can > see no way of getting information back from the script - not even an > exit code. Is there anyway of doing this that I have missed? You may wish to use Parrot_c

Re: Parrot as an extension language

2005-05-17 Thread Jeff Horwitz
you'll probably want to use the Parrot_call_sub_* API to call individual subroutines and get return values. "perldoc extend.c" in the parrot source for more info. you might also have a look at the mod_parrot source (http://www.smashing.org/mod_parrot), which is one of the few apps embedding parro