]> git.jsancho.org Git - gacela.git/blobdiff - gacela_SDL.lisp
(no commit message)
[gacela.git] / gacela_SDL.lisp
index af72bf1712de85475736ad3b046331c3f3fef505..6ff5c1b02278dbe9d5860fc920329b0af771f0d3 100644 (file)
 
 (in-package :gacela)
 
+(defmacro mapcconst (type c-type name)
+  (let ((c-header (concatenate 'string c-type " gacela_" name " (void)"))
+       (c-body (concatenate 'string "return " name ";"))
+       (c-name (concatenate 'string "gacela_" name))
+       (lisp-name (intern (string-upcase name))))
+    `(progn
+       (defcfun ,c-header 0 ,c-body)
+       (defentry ,lisp-name () (,type ,c-name))
+       (eval-when (load) (defconstant ,lisp-name (,lisp-name))))))
+
 (clines "#include <SDL/SDL.h>")
 (clines "#include <SDL/SDL_image.h>")
 (clines "#include <SDL/SDL_ttf.h>")