[fetter-devel] Re: Optional lispification, macro pruning

Kenny Tilton ktilton at nyc.rr.com
Tue Sep 27 15:14:27 UTC 2005



Rayiner Hashem wrote:

>I've recently added support in CVS for making Lispification optional.
>For this feature, there is a new clause in the defbinding called
>"OPTIONS". To get straight-C names, use the following clause in your
>input file:
>
>(options :foreign-names).
>
>This will prevent Verrazano from doing any name translation.
>
>I've also modified the macro reading code to grab filename information
>from the preprocessor, and use that to add fake XML nodes to the IR.
>Since this happens before the IR pruning phase, the result is that
>macro definitions get pruned too. On my machine, this makes OpenGL
>(including gl.h and glu.h) quite a bit smaller --- about 128K versus
>300K before.
>
Works great. My ftgl-library.lisp is only 31k.

Next issue. I get these two bindings for FTGL:

 (cffi:defcfun ("_ZN6FTFont7AdvanceEPKw" FTFont-Advance) :float
  (this :pointer) (string :pointer))
 (cffi:defcfun ("_ZN6FTFont7AdvanceEPKc" FTFont-Advance-1) :float
  (this :pointer) (string :pointer))

The first corresponds to an overloaded  C++ method specialized (if you 
will) on a string of wchar_ts, the second to a string of chars. I guess 
that is the trailing w/c in the mangled name. Having done this research 
(by examining the FTGL C++ source), I guess I will go with Advance-1, 
but there seems to be a problem here. Just not sure where.

Will FTFont-advance above (the one expecting a pointer to an array of 
wchar_ts) really work for a CFFI string parameter? If not, is the first 
defcfun above a bug?

If we really do end up with two "Advance" defcfuns with the same 
signature, how will the programmer know which corresponds to the C++ 
overloaded variant they need to hit, without looking at the source? Is 
there any way vzn can mimic the C++ mangling and sneak argument type 
info into the lisp name, or even just emit a defcfun docstring (with 
suitable enhancement of CFFI:defcfun) or even just a source code comment 
or (wild dream) produce CLOS methods for an FTFont-Advance GF each 
specialized appropriately and calling the appropriate C++ mangled 
defcfun? ie, all defcfuns get mangled names and the unmangled name is 
reserved for the CLOS GF which will serve to dispatch calls to the 
appropriate mangled defcfun?


-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state I finally won out over it."
    Elwood P. Dowd, "Harvey", 1950






More information about the fetter-devel mailing list