Skip to content

C-file generated by the compile-file

I am using dev-branch

(defun she (x) (list 1  2))

this generate the following c file:

/*      function definition for SHE                                   */
/*      optimize speed 3, debug 0, space 0, safety 2                  */
static cl_object L1she(cl_object v1x)
{
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 {
TTL:
  value0 = cl_list(2, ecl_make_fixnum(1), ecl_make_fixnum(2));
  return value0;
 }
}

,but when I change list to quote

(defun she (x) '(1  2))
#ifdef ECL_DYNAMIC_VV
static cl_object *VV;
#else
static cl_object VV[VM];
#endif

/*      function definition for SHE                                   */
/*      optimize speed 3, debug 0, space 0, safety 2                  */
static cl_object L1she(cl_object v1x)
{
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 {
TTL:
  value0 = VV[1];
  cl_env_copy->nvalues = 1;
  return value0;
 }
}

I have done this to get the correct recipe for extending ECL from C++ function.

cl_env_copy->nvalues = 1; should I use this or rely only on return? When I use ecl_return1(env,object), it gives the same result as return object

Questions:

1- Difference between ecl_return1(env,object) and return object?

2- what is the correct way of calling a lisp function written in c++ that returns cl_object?

3- Are these steps correct and safe:

  • check for stack overflow
  • use this ecl_return1(env,object)

4- What is the usage of cl_object env0 in the beginning of the function?

"16.1.3"
"4902b9dee0e7816fef3f113365689341b16fd783"

Thanks in advance.

Edited by CatchMeFastFat