[Ecls-list] Return values sometimes missing on REPL

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Thu Jun 3 14:10:32 UTC 2010


On Tue, Jun 1, 2010 at 2:23 PM, Erik Winkels <aerique at xs4all.nl> wrote:

> I'm starting a REPL by doing this in C++:
>
>    cl_object obj = ecl_read_from_cstring("si:top-level");
>    cl_funcall(1, obj);
>
> Now when calling functions that have been created with ecl_def_c_function
> I almost never get the return value back at the REPL, but they are set
> when I call the same function with setf or defparameter.  Like so:
>
>    OGRE[1]> (get-actual-height *viewport*)
>

This toplevel does not seem to be the standard toplevel, for you have a
different prompt, to begin with. Then, you are not showing the code of the
functions you define and how they return multiple values. Most likely you
are just using a "return only-value" statement and do not set the counter
for the returned values, which is needed by ECL to know the number of
returned values. If you look at toplevel.c, the compiled version of the
toplevel you will see

cl_env_copy->values[0]=si_eval_with_env(2,ecl_symbol_value(ECL_SYM("-",15)),ecl_symbol_value(VV[2]))
/*  EVAL-WITH-ENV */;

ecl_stack_frame_push_values(V1);cl_env_copy->values[0]=ecl_apply_from_stack_frame(V1,ECL_SYM("LIST",479));

this evaluates the form stored in the variable '-, saving the first value in
the multiple values register and then copying the rest of values.

It would make REPL life a little easier if all of them returned values
> at the REPL.  Any ideas?


More information. An ordinary REPL works just fine as shown in daily life.
Obviously there is some problem with either the functions you define (not
because of the way you defined them), or in the interface to those
functions.

Juanjo
-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100603/9e4efbae/attachment.html>


More information about the ecl-devel mailing list