summaryrefslogtreecommitdiff
path: root/cmamut.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2023-01-30 13:15:17 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2023-01-30 13:15:17 -0300
commit04acd68670c8ced173db02fec5fd0cfd4d85369d (patch)
treefb7fd82b646db6915b858c0b5e96231b1db55e58 /cmamut.lisp
parentf37fc65a449f6e3166d987152e90599776fd32a6 (diff)
downloadcmamut-04acd68670c8ced173db02fec5fd0cfd4d85369d.tar.gz
cmamut-04acd68670c8ced173db02fec5fd0cfd4d85369d.zip
Change order of definition and add arrays
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))))