summaryrefslogtreecommitdiff
path: root/cmamut.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'cmamut.lisp')
-rw-r--r--cmamut.lisp10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmamut.lisp b/cmamut.lisp
index d572342..2a3e47a 100644
--- a/cmamut.lisp
+++ b/cmamut.lisp
@@ -46,6 +46,8 @@
'sb-alien:int)
((string= tag ":long")
'sb-alien:long)
+ ((string= tag ":array")
+ (cook-array raw-type))
((string= tag ":struct")
(list 'sb-alien:struct (gethash "name" raw-type)))
((string= tag ":union")
@@ -56,6 +58,11 @@
(cook-union raw-type))
(t tag))))
+(defun cook-array (raw-array)
+ `(sb-alien:array
+ ,(cook-type (gethash "type" raw-array))
+ ,(gethash "size" raw-array)))
+
(defun cook-function (raw-function &optional name-transformer)
(let ((raw-params (gethash "parameters" raw-function))
(cooked-params (queue:new)))
@@ -161,11 +168,10 @@
:direction :output
:if-exists :overwrite
:if-does-not-exist :create)
-; definitions must be written in the following order to avoid "unknown type" errors
(princ ";;; GENERATED BY CMAMUT" f)
(terpri f)
- (format f "~{~s~&~}" (spec-typedefs spec))
(format f "~{~s~&~}" (spec-enums spec))
+ (format f "~{~s~&~}" (spec-typedefs spec))
(format f "~{~s~&~}" (spec-structs spec))
(format f "~{~s~&~}" (spec-unions spec))
(format f "~{~s~&~}" (spec-functions spec))))