]> git.jsancho.org Git - gacela.git/blobdiff - gacela_misc.lisp
(no commit message)
[gacela.git] / gacela_misc.lisp
index 8a7c2e433242b551ee3fbc6c2c229d142aaf436a..419181b7680236407ec82526a376eb1e475466c9 100755 (executable)
                        (t (power (* p 2) n)))))
          (power 1 n)))
 
+(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))))))
+
 ;Geometry
 (defun dotp (dot)
   (match-pattern dot '(0 0)))