chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] C_word type / Cython (warning: passing argument 2 fr


From: Felix
Subject: Re: [Chicken-users] C_word type / Cython (warning: passing argument 2 from incompatible pointer type)
Date: Mon, 14 Feb 2011 08:55:55 +0100 (CET)

From: David Dreisigmeyer <address@hidden>
Subject: Re: [Chicken-users] C_word type / Cython (warning: passing argument 2 
from incompatible pointer type)
Date: Sun, 13 Feb 2011 13:23:56 -0500

>> Maybe we need to rewind the discussion. What is it again you want
>> to do?  I missed that part.
> 
> I have a Python and a Chicken REPL embedded in a second Python REPL.
> I can call Chicken using CHICKEN_eval_string_to_string and return a
> string.  But, I'd like to have this converted to a Python type since
> I'm assigning these to the globals() so I can: 1) get autocompletion,
> 2) have something usable in Python, and 3) be able to parse this back
> into any subsequent Chicken calls.  For the latter I'd need to go the
> opposite way Python -> Scheme.  Basically, I'd prefer to use
> CHICKEN_eval_string if I could change the result into something C (and
> then Cython) could work with.
> 
> Similar conversions have been done in the pyffi egg, so I'm taking a
> look at that also.
> 
> Another option could be to test what type it is in Chicken and pass
> this out as a flag to Python which I'd use to determine the parsing.
> This would seem to be the long way around though since if I have
> something C can work with, Cython should be able to handle changing
> this into a Python variable.
> 

A C_word holds either an immediate datum (fixnum, character, the
empty list, boolean, #!eof) or a pointer to a non-immediate value,
which is a block of memory, preceded by a 1-word "header" that
determines its type.

You can find more information here:

http://wiki.call-cc.org/man/4/Data%20representation

There are numerous macros in "chicken.h" that can be used to 
differentiate among the data-types and to access their contents,
see:

http://wiki.call-cc.org/man/4/C%20interface


cheers,
felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]