[plt-scheme] C enum syntax
I've been using the C FFI and handling enumerated constants like so, which seems
to work fine:
(define some-const ((c-lambda () int "___result = SOME_CONST;")))
But I would rather do something like:
(define some-const (c-enum "SOME_CONST"))
So I tried:
(define-syntax (c-enum stx)
(syntax-case stx ()
((_ c)
(quasisyntax
((c-lambda () int
(unsyntax (format "___result = ~a;" (syntax c)))))))))
Which is apparently not correct. Could someone shed some light on what's wrong
with the `c-enum' syntax above? Also, is there a better approach to enums in
scheme?
Thanks,
David