Re: Should the op 'pin' create a C-string ?

2004-11-12 Thread Bernhard Schmalhofer
Dan Sugalski wrote: The problem is that you're using the wrong signature type here. 't' is for plain c strings passed into functions for temporary usage. It is *not* for passing in of long-lived buffers. You really want the 'b' type if it's a long-lived thing. That pulls the buffer pointer out o

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Dan Sugalski
At 3:49 PM +0100 11/11/04, Leopold Toetsch wrote: Dan Sugalski <[EMAIL PROTECTED]> wrote: ... You really want the 'b' type if it's a long-lived thing. That pulls the buffer pointer out of the string structure and passes it in, so it's suitable for mutable stuff. (That's what it's there for, act

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > ... You really want the > 'b' type if it's a long-lived thing. That pulls the buffer pointer > out of the string structure and passes it in, so it's suitable for > mutable stuff. (That's what it's there for, actually) Using bufstart in string code is almo

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Dan Sugalski
At 11:15 AM +0100 11/11/04, Bernhard Schmalhofer wrote: Leopold Toetsch wrote: >>This means that the string buffer has to stay around, until the parsing is done. This is what the "t" signature char is doing anyway - Oops or better, what it should to. While it's using string_to_cstring the crea

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Leopold Toetsch
Bernhard Schmalhofer <[EMAIL PROTECTED]> wrote: > Leopold Toetsch wrote: > > > > This is what the "t" signature char is doing anyway - Oops or better, > > what it should to. While it's using string_to_cstring the created string > > isn't freed (unless the library would free it, which is unlikely).

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Bernhard Schmalhofer
Leopold Toetsch wrote: >>This means that the string buffer has to stay around, until the parsing is >>done. > > > This is what the "t" signature char is doing anyway - Oops or better, > what it should to. While it's using string_to_cstring the created string > isn't freed (unless the library woul

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Bernhard Schmalhofer
Dan Sugalski wrote: >> From strings.pod I gather that the op 'pin' is meant to >> make strings fit for passing strings to external libraries. > Sort of. The point is to make the string not move. Generally for > external libraries, but not universally. > > It shouldn't add the trailing null, because

Re: Should the op 'pin' create a C-string ?

2004-11-11 Thread Leopold Toetsch
Bernhard Schmalhofer <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to pass a string, containing YAML, from Parrot to the shared > library 'libsyck'. > void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead ); ( > v_ptip ) ^^ > SYMID syck_parse( SyckParser * );

Re: Should the op 'pin' create a C-string ?

2004-11-10 Thread Dan Sugalski
At 12:00 AM +0100 11/11/04, Bernhard Schmalhofer wrote: From strings.pod I gather that the op 'pin' is meant to make strings fit for passing strings to external libraries. For me it would be convenient, if 'pin' would put a trailing '\0' at the end of the used string buffer. Also a pinned string s

Should the op 'pin' create a C-string ?

2004-11-10 Thread Bernhard Schmalhofer
Hi, I am trying to pass a string, containing YAML, from Parrot to the shared library 'libsyck'. 'libsyck' provides two functions: void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead ); ( v_ptip ) SYMID syck_parse( SyckParser * ); ( i_p ) 'syck_

Should the op 'pin' create a C-string ?

2004-11-10 Thread Bernhard Schmalhofer
Hi, I am trying to pass a string, containing YAML, from Parrot to the shared library 'libsyck'. 'libsyck' provides two functions: void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead ); ( v_ptip ) SYMID syck_parse( SyckParser * ); ( i_p ) 'syc