On Sun, 2006-10-29 at 15:10 +1100, Jono wrote:

> yes, I did see that but the felix programme has strings, not cptr[char].
> 
> fun mvaddstr:int*int*string->int = "mvaddstr($1, $2, $3)";
> 
> What do I put at $3 to convert the felix "string" to a "char *"?

Well this is just C++ stuff:

        $3.data()

returns a char const * to the string's array: not it is const,
you're not allowed to write to it. You can also use:

module String {
 ...
  publish "Unsafe extract buffer pointer"
  fun cstr: string -> C_hack::ptr[char] = "$1.data()";


which looks like it has a buglet in it: the C++ type is
char const * but the Felix type is given as ptr[char].

Felix doesn't handle 'const' very well at the moment.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to