add record, a struct that names itself

(record point ...) emits the struct and a typedef of the same name, so
point stands alone wherever (struct point) had to -- in a var, a
pointer, an arglist, a sizeof. struct, union and enum keep C's
meaning, for a type that came from a header or is laid out to match one.
This commit is contained in:
2026-10-03 22:28:48 +03:00
parent 2512d52dd1
commit 622db8eadc
5 changed files with 71 additions and 1 deletions

View File

@@ -100,7 +100,7 @@
(('pub 'var . _)
(match-let ((('pub 'var name type . _) (strip-header-comments form 4)))
(cons (copy-form-source! form `(extern var ,name ,type)) acc)))
(('pub (or 'define 'defmacro 'enum 'import 'include 'struct 'typedef 'union) . _)
(('pub (or 'define 'defmacro 'enum 'import 'include 'record 'struct 'typedef 'union) . _)
(cons (copy-form-source! form (cdr form)) acc))
(('pub . _)
(sex-error form "pub must be followed by a definition" form))