From c843e4abe4940fd280670f0ca19586f6c57b5e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sat, 25 Feb 2023 02:07:56 -0300 Subject: Convert enums to parameters --- cmamut.lisp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'cmamut.lisp') diff --git a/cmamut.lisp b/cmamut.lisp index 8eac12f..fddf790 100644 --- a/cmamut.lisp +++ b/cmamut.lisp @@ -1,8 +1,6 @@ (in-package #:cmamut) ; TODO: Use c2ffi to extract the spec.json using the header file as parameter -; TODO: Enums are only seen by C++ constructs, C only sees numbers. -; When extracting C headers, enums should be converted into hash defines so that functions can use them easily. (defparameter +target-package+ (gensym)) @@ -88,13 +86,12 @@ (cooked-fields (queue:new))) (dotimes (j (length raw-fields)) (queue:add cooked-fields - (list (intern (gethash "name" (aref raw-fields j)) +target-package+) - (gethash "value" (aref raw-fields j))))) - `(sb-alien:define-alien-type - nil - (sb-alien:enum - ,name - ,@(queue:to-list cooked-fields))))) + `(defparameter + ,(intern (gethash "name" (aref raw-fields j)) +target-package+) + ,(gethash "value" (aref raw-fields j))))) + `(progn + ,name + ,@(queue:to-list cooked-fields)))) (defun generate-enum-references (raw-typedefs) (let ((enum-references (make-hash-table :test #'equal :size 256))) -- cgit v1.2.3