[Ecls-list] "Silent" ECL
Christian Svensson
info at cmd.nu
Sat Sep 13 09:06:23 UTC 2008
Hello, thanks for your answer.
The problem with cl_load as I've experienced it is that it will throw me a
top-level prompt if there are any errors in the file.
I don't want that.
Is there any time plan to provide this kind of support? Or is it an "issue"
at all?
Greetings,
On Fri, Sep 12, 2008 at 9:55 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:
> On Thu, Sep 11, 2008 at 9:44 PM, Christian Svensson <info at cmd.nu> wrote:
>
>> if( type_of( result ) == t_symbol )
>> {
>> printf( "- Loading result: %s\n", cl_symbol_value( result ) );
>> }
>>
>
> Hi Christian, first of all sorry that programming embedded ECL seems so
> difficult, but believe me: it is not.
>
> The key to understand how ECL works is to grasp that it is just a C library
> providing _all_ of Common Lisp. Hence, to know how to program ECL you cannot
> avoid learning some Common Lisp, but at the same time if you know Common
> Lisp you will know how to manipulate data in C without resorting to low
> level hacks.
>
> Given this, the statements above are wrong. Most functions with prefix cl_
> are functions defined in the Common Lisp CL or COMMON-LISP package. In
> particular cl_symbol_value is the C equivalent of SYMBOL-VALUE which returns
> the value of a variable
> http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_5.htm
>
> Hence, when your program reaches this point it has read the form
> (DEFUN NO-FUNC ....)
> and it has evaluated this form which results in an output value
> NO-FUNC
> This is the same as if I type the previous statement in a Common Lisp: the
> output will be the symbol that names the function I have defined. However,
> NO-FUNC is not a variable and if you type (SYMBOL-VALUE 'NO-FUNC) in
> whatever Lisp it will complain.
>
> Unfortunately there is not yet a simple way to protect yourself from
> mistakes in the C program because there are no simple C constructs to
> capture errors. There are some macros defined in the ECL C headers but I do
> not want to recommend them because they are prone to change.
>
> BTW, this other statement is also wrong
>
> result = si_safe_eval( 3, c_string_to_object( "(my-test-function 1)" ),
> Cnil, OBJNULL );
> if( result == OBJNULL )
> {
> printf( "Calling of function failed\n" );
> return 1;
> }
>
> This is because your cl_read() statement only reads 1 form and not the 2nd
> form which contains the definition for MY-TEST-FUNCTION. You would be better
> off using cl_load().
>
> Hope this helps you get started,
>
> Juanjo
>
> --
> Instituto de Física Fundamental
> CSIC, Serrano, 113, Madrid 28040 (Spain)
> http://juanjose.garciaripoll.googlepages.com
>
--
Christian Svensson
Command Systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20080913/a9c89800/attachment.html>
More information about the ecl-devel
mailing list