[Ecls-list] "Silent" ECL

Christian Svensson info at cmd.nu
Thu Sep 11 19:44:31 UTC 2008


(Re-sending to mailing list)

Hello, thanks for your answer.

After a while I figured out how to successfully use si_safe_eval - but I
still have problems:

   - Sometimes this happens:
   The variable NO-FUNC is unbound.
   Broken at SI:TOP-LEVEL.No restarts available.
   0 is an illegal frs index.
   Which results in program freeze when I try to Ctrl+C it.
   Why this pops up I have no idea, please see attached lisp code

   - I'm unable to detect if the execution was successful, OBJNULL
   is never returned - even in the case of a very corrupted lisp file


Also, how can I preserve the functions defined in the first si_safe_eval to
the next one?
I'm guessing using the environment var to something another than Cnil, but
to what?

*test.lisp:*
(defun no-func( x y )
  (+ x y))

(defun my-test-function( x )
  (print (list (+ 1 x) (* 2 x))))

*test-bind.c:*
#include <stdio.h>
#include <stdlib.h>
#include <ecl/ecl.h>

int main( int argc, char *argv[] )
{
  const char *expr;
  const char *intr;
  cl_object result;
  cl_object file;
  cl_object bytecode;

  intr = "ECL";

  cl_boot( 1, &intr );
  si_uncatch_bad_signals();

  printf( "- Booted\n" );

  file = cl_open( 1, c_string_to_object( "\"test.lisp\"" ) );
  bytecode = cl_read( 1, file );
  cl_close( 1, file );

  result = si_safe_eval( 3, bytecode, Cnil, OBJNULL );

  if( result == OBJNULL )
  {
    fprintf( stderr, "Loading of test.lisp failed\n" );
    return 1;
  }

  if( type_of( result ) == t_symbol )
  {
    printf( "- Loading result: %s\n", cl_symbol_value( result ) );
  }

  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;
  }

  printf( "Result X: %d, Y: %d\n", ecl_to_unsigned_integer( cl_car( result )
),
            ecl_to_unsigned_integer( cl_cadr( result ) ));

  return 0;
}

Thanks in advance

On Thu, Sep 11, 2008 at 9:27 PM, Christian Svensson <blue at cmd.nu> wrote:

> (Re-sending to mailing list)
>
>
> Hello, thanks for your answer.
>
> After a while I figured out how to successfully use si_safe_eval - but I
> still have problems:
>
>    - Sometimes this happens:
>    The variable NO-FUNC is unbound.
>    Broken at SI:TOP-LEVEL.No restarts available.
>    0 is an illegal frs index.
>    Which results in program freeze when I try to Ctrl+C it.
>    Why this pops up I have no idea, please see attached lisp code
>
>    - I'm unable to detect if the execution was successful, OBJNULL
>    is never returned - even in the case of a very corrupted lisp file
>
>
> Also, how can I preserve the functions defined in the first si_safe_eval to
> the next one?
> I'm guessing using the environment var to something another than Cnil, but
> to what?
>
> *test.lisp:*
> (defun no-func( x y )
>   (+ x y))
>
> (defun my-test-function( x )
>   (print (list (+ 1 x) (* 2 x))))
>
> *test-bind.c:*
> #include <stdio.h>
> #include <stdlib.h>
> #include <ecl/ecl.h>
>
> int main( int argc, char *argv[] )
> {
>   const char *expr;
>   const char *intr;
>   cl_object result;
>   cl_object file;
>   cl_object bytecode;
>
>   intr = "ECL";
>
>   cl_boot( 1, &intr );
>   si_uncatch_bad_signals();
>
>   printf( "- Booted\n" );
>
>   file = cl_open( 1, c_string_to_object( "\"test.lisp\"" ) );
>   bytecode = cl_read( 1, file );
>   cl_close( 1, file );
>
>   result = si_safe_eval( 3, bytecode, Cnil, OBJNULL );
>
>   if( result == OBJNULL )
>   {
>     fprintf( stderr, "Loading of test.lisp failed\n" );
>     return 1;
>   }
>
>   if( type_of( result ) == t_symbol )
>   {
>     printf( "- Loading result: %s\n", cl_symbol_value( result ) );
>   }
>
>   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;
>   }
>
>   printf( "Result X: %d, Y: %d\n", ecl_to_unsigned_integer( cl_car( result
> ) ),
>             ecl_to_unsigned_integer( cl_cadr( result ) ));
>
>   return 0;
> }
>
> Thanks in advance
>
> 2008/9/11 Claus Brod <claus.brod at googlemail.com>
>
>> Some starting points:
>>
>>
>>    - http://ecls.wiki.sourceforge.net/FAQ (particularly question 2.4)
>>    -
>>    http://sourceforge.net/mailarchive/message.php?msg_id=D16F05D0CAAA234BA2B753B80DE6100D8F25D8%40DEEXC1U02.de.lucent.com
>>    - http://ecls.sourceforge.net/new-manual/
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Ecls-list mailing list
>> Ecls-list at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ecls-list
>>
>>
>
>
> --
> Christian Svensson
> Command Systems
>



-- 
Christian Svensson
Command Systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20080911/e31e3d79/attachment.html>


More information about the ecl-devel mailing list