[Ecls-list] Newbie get/set question

Dean O'Connor dean.oconnor at ite.com.au
Sun Nov 20 17:57:48 UTC 2005


this might help ...

Here's relevant doco page:
    http://ecls.sourceforge.net/ecldev/Integers.html#Integers

I'm not quite at the point of fully testing it, but this is what I have 
been using.

static cl_object check_value(cl_object int_obj, cl_object float_obj)
{
    assert_type_integer(int_obj);
    // did not see assert for long float ??

   int value1 = fixint(int_obj);
   double value2 = lf(float_obj);

    return Cnil;
}

Cheers
Dean.

David Creelman wrote:

>Hi Juan,
>
>Okay, cool.
>
>.. So I get back a cl_object from cl_[safe]eval. If I want to read an
>integer, do I just read big from the cl_object ?
>
>Cheers
>DC
>
>On Fri, 2005-11-18 at 11:04 +0100, Juan Jose Garcia Ripoll wrote:
>  
>
>>On Fri, 2005-11-18 at 18:57 +1100, David Creelman wrote:
>>    
>>
>>>I can run scripts/functions, but it's not clear to me how I get a
>>>variable from ECL over to C/C++. There is mention of ffi:, but I don't
>>>quite get that. Any pointers would be appreciated.
>>>      
>>>
>>You can
>>
>>1) Get the output directy from cl_eval() if there is a single lisp
>>statement.
>>
>>2) You can, in compiled files, access C variables using FFI. The value
>>of this C variable can be set to whatever your lisp code wants to
>>output. I find this, however, overkilling.
>>
>>3) You can simply define a special variable and assign it the value you
>>want. To recover this value from C there are multiple possibilities.
>>Perhaps the simplest (but not the safest one) is to use
>>
>>	c_string_to_object("thepackage::*thevariable*")
>>
>>which will read the string and evaluate the symbol *thevariable* from
>>the package "THEPACKAGE" and return the value. Formerly you might have
>>done something like
>>
>>	(in-package :thepackage)
>>
>>	(setf *thevariable* (+ 1 1))
>>
>>Have fun,
>>
>>
>>Juanjo
>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>>Register for a JBoss Training Course.  Free Certification Exam
>>for All Training Attendees Through End of 2005. For more info visit:
>>http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>>_______________________________________________
>>Ecls-list mailing list
>>Ecls-list at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/ecls-list
>>    
>>




More information about the ecl-devel mailing list