[gnu.emacs] Literal elisp symbols in a C function

mesard@bbn.com (Wayne Mesard) (08/21/89)

I'm hacking x11fns.c to add functions to manipulate the window geometry
from elisp.  These functions basically do some type checking and then
call their XLib equivelent.

Anyway, I have an implementation decision for XConfigureWindow.  One of
the parameters specifies how the window should be stacked on the screen
(relative to its sibling windows).  The possible values are: Above,
Below, TopIf, BottomIf and Opposite.  In C these constants are
#define'ed in a header file, and in "normal" Lisp, I'd simply make them
symbols in the keyword package.  But I'm not sure what to do in elisp.

I could:

 o Make the param an integer and handle it with a switch statment:

   	switch (XINT(stack_mode)) {
	  case 0: changes = Above; break;
	  ...

   So 0 => Above, 1 => Below, etc.  But that seems to unlisp-like
   to be believed.

 o Make the param a symbol and then check it with if-else
   statments.  But I'm concerned about the efficiency of this.  There
   seems to be no way to make create a symbol at compile time, so I
   would have to do something like this:

	if (Feq(stack_mode, Fmake_symbol(make_pure_string("Above",5))))
	  changes.stack_mode = Above;
	else if ...

 o Make the param a symbol and do something nasty like check the first
   two letters of its name (enough to discriminate the five keywords).

So basically, all three solutions are, IMHO, too ugly to code and/or too
ugly to use.  I realize that I'm giving this matter more attention than
it deserves, and I'll probably wind up using the second method above,
but if anyone has any comments WHATSOEVER about any of this --
especially if I've overlooked a way to make symbols at compile time --
I'd appreciate hearing them.

I will summarize email replies.  Thanks in advance.

-- 
void *Wayne_Mesard();         Mesard@BBN.COM         BBN, Cambridge, MA