[Openmcl-devel] DEFTRAP / DEFTRAP-INLINE

Brent Fulgham bfulg at pacbell.net
Wed Nov 29 07:13:52 UTC 2006


The MCL code for the Open Agent Engine (specifically the MCL- 
translation for Allegro CL forms) makes use of a form called "DEFTRAP- 
INLINE" (see the attached file for details).  I'm not sure how best  
to map this to OpenMCL's internals, or if it would be better to skip  
the whole thing and just use OpenMCL's existing FFI infrastructure.   
On the one hand it would be nice to stay as close as possible to the  
existing code; on the other, it may be more trouble than it's worth.

The basic idea is (from John Wiseman's comments in his sources):

========================================================================
Example expansion #1:

   (foreign-function glutcreatewindow ((POINTER CHAR)) INT
                     "glutCreateWindow")

   ==>


   (PROGN
     (DEFTRAP-INLINE (_GLUTCREATEWINDOW "_glutCreateWindow")
       ((ARG1 :POINTER))
       :LONG
       'NIL)
     (DEFUN GLUTCREATEWINDOW (ARG1)
       (WITH-CSTRS ((#:G2122 ARG1))
         (REQUIRE-TRAP TRAPS::_GLUTCREATEWINDOW #:G2122)))
     (EXPORT 'GLUTCREATEWINDOW))


Example expansion #2:

   (foreign-function glclearindex (FLOAT) VOID "glClearIndex")

   ==>

   (PROGN
     (DEFTRAP-INLINE (_GLCLEARINDEX "_glClearIndex")
       ((ARG1 :SINGLE-FLOAT))
       NIL
       'NIL)
     (DEFUN GLCLEARINDEX (ARG1)
       (REQUIRE-TRAP TRAPS::_GLCLEARINDEX (FLOAT ARG1 0.0S0)))
     (EXPORT 'GLCLEARINDEX))
========================================================================

Thanks,

-Brent


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcl-interface.lisp
Type: application/octet-stream
Size: 7047 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20061128/82376655/attachment.obj>
-------------- next part --------------



More information about the Openmcl-devel mailing list