X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_misc.lisp;h=419181b7680236407ec82526a376eb1e475466c9;hb=bf0af06a8306983f0c4fae8375dd6973e64aa593;hp=8a7c2e433242b551ee3fbc6c2c229d142aaf436a;hpb=6b5631c92ca29a80af99d228b3fe346c5b5e8eee;p=gacela.git diff --git a/gacela_misc.lisp b/gacela_misc.lisp index 8a7c2e4..419181b 100755 --- a/gacela_misc.lisp +++ b/gacela_misc.lisp @@ -69,6 +69,16 @@ (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)))