next up previous contents
Next: Built-in atoms Up: Compilation Previous: Altering the size of

Compiler's naming convention

Lisp functions are compiled (by the compiler) into C functions. A lisp function name is an identifier in which any printable character may occur, provided that the non-alphanumerics are prefixed with the escape character, the exclamation mark `!'. This, of course is not the case in C, so while mapping the lisp names to C names a conversion has to be made. Please note that this has nothing to do with the execution of the compiled code. Surely, as it is for all built-in functions of lisp, at the lisp level a named function is recognized through its name, which is an lisp identifier, actually a lisp atom having a function pointer sitting in its value field. This function pointer is generated by the C-compilation as to be a pointer to the related function, an entry point. So, after the C-compilation no trace remains about what the C-name of the compiled function was. But sometimes it is interesting to investigate the compiler generated C-code.

The naming rules in the lisp tex2html_wrap_inline1791 C compilation of functions is as follows:

  1. If the first character is alphabetic then it is capitalized.
  2. If the first character is a digit (escaped) then it it is prefixed with an underscore `_'.
  3. Any printable but non-alphanumeric is replaced by a pair of uppercase letters by the following convention:

    tabular951

  4. If the name is flagged special, then a 1 (one) is appended at the end of the name. (This is normally used for name clashes with the C library functions, some examples are open, read, write etc.)
  5. Automatic generated naming is provided, this is explained in details below:

There is no theoretical limit to the lenght of a function name. But this might not be so for a C compiler. Therefore a global variable is established to control the maximal length of a function name, which will be converted to a C-equivalent by the above stated conventions. Longer function names then the maximal length stored in this global variable `!*maxfnamelen' will be converted to automatic generated function names. Such names are cooked up by appending an incremented integer value (for each such new function) to the end of `GenFun'. By default `!*maxfnamelen' is set to nil which means no such automatic naming shall be applied.

If desired you may set it, (to 23 in the example below), before the `compilefile' call by an evaluation like:

      (setq !*maxfnamelen 23)


next up previous contents
Next: Built-in atoms Up: Compilation Previous: Altering the size of

Gokturk UCOLUK
Fri Nov 1 21:52:13 EET 1996