[Openmcl-devel] NSNormalWindowLevel

Gary Byers gb at clozure.com
Thu Nov 6 03:05:22 PST 2008

NSNormalWindowLevel (which looks like it'd be a variable or constant
reference) is a macro that expands into


, which in turn is a macro that expands into


The FFI translator does a pretty good job of dealing with macros that
expand into constant-valued expressions, but translating a form that
represents a (runtime) C function call into an "equivalent" lisp
[foreign-]function call is harder.  (This case -looks- doable,
but my first reaction is to think that the general case is hard; if
you could do it, you'd want to somehow arrange that

os::|kCGNormalWindowLevel| was defined as a symbol-macro that 
expended into something equivalent to

(#_CGWindowLevelForKey #$kCGNormalWindowLevelKey)

Unless/until someone does a better job than I have of figuring out
just how tractable this all is, you more or less have to do the
translation (e.g., call CGWindowLevelForKey) manually.

My best guess is that at some point in the (possibly distant) past,
NSNormalWindowLevel and friends were just "normal" constants; some
OS-level change made it necessary to determine the values at runtime
(e.g., it's possible that different OS versions or different
configurations of ... something ... could cause things like "the
normal window layer" "the frontmost window layer" to have different
values depending on that ... something).  Rather than changing 
documentation and breaking existing code by getting rid of the
"constants", someone decided that it'd be easier to turn the
constants into C preprocessor macros that expanded into function calls
to hide the fact that they aren't really constants anymore.

On Thu, 6 Nov 2008, Arthur W Cater wrote:

> Thanks again for info on getting at NSFontAttributeName.
> Similar question now about NSNormalWindowLevel and friends:
> none of #$, #&, #? succeeds  (nor with the kCG... equivalents), what must I do?
> Some help would be much appreciated.
> Arthur

More information about the Openmcl-devel mailing list