From 04acd68670c8ced173db02fec5fd0cfd4d85369d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Mon, 30 Jan 2023 13:15:17 -0300 Subject: Change order of definition and add arrays --- cmamut.lisp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cmamut.lisp') 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)))) -- cgit v1.2.3