[Ecls-list] Commenting: ((cl_object)(cl_symbols+%d))

Douglas R. Miles logicmoo at comcast.net
Wed Mar 1 18:30:32 UTC 2006

I had an idea that makes the emitted C easier for me to read/hack after
compiler creates it

In my local config.h I define 

#ifndef THE_SYM
#define THE_SYM(NNN,VVV) ((cl_object)(cl_symbols+VVV))
// This macro ignores the first argument

Then in many places (like src/c/all_symbols.d in the function name_mangle)

#if defined(THE_SYM)
  output = cl_format(5, Cnil,
      ((cl_object)(cl_symbols + p))->symbol.name,MAKE_FIXNUM(p));
  output = cl_format(3,Cnil,

It makes the code emitted read like:

	ECL_SET(THE_SYM("*PACKAGE*",41), cl_core.lisp_package);

But what the compiler will see is 

      ecl_set_symbol(((cl_object)(cl_symbols+41)), cl_core.lisp_package)

Maybe others would like this virtual commenting in their outputted C? 

Later on I was thinking if the symbol table interning system changes you'd
only update the macro THE_SYM(..,..)



More information about the ecl-devel mailing list