! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.marshall arrays assocs
classes.tuple combinators destructors generalizations generic
-kernel libc locals parser quotations sequences slots words ;
+kernel libc locals parser quotations sequences slots words
+alien.structs ;
IN: alien.marshall.structs
M: struct-wrapper dispose* underlying>> free ;
[ type>> ] [ reader>> ] [ writer>> ]
} cleave define-struct-accessors
] each ;
+
+: define-marshalled-struct ( name vocab fields -- )
+ [ define-struct ] [ 2drop define-struct-tuple ] 3bi ;
SYNTAX: MARSHALLED:
function-types-effect marshalled-function define-declared ;
+
+SYNTAX: M-STRUCTURE:
+ scan current-vocab parse-definition
+ define-marshalled-struct ;
alien.arrays alien.strings kernel math namespaces parser
sequences words quotations math.parser splitting grouping
effects assocs combinators lexer strings.parser alien.parser
-fry vocabs.parser words.constant alien.libraries
-alien.marshall.structs ;
+fry vocabs.parser words.constant alien.libraries ;
IN: alien.syntax
SYNTAX: DLL" lexer get skip-blank parse-string dlopen parsed ;
scan scan typedef ;
SYNTAX: C-STRUCT:
- scan current-vocab parse-definition [ define-struct ] 3keep
- 2drop define-struct-tuple ;
+ scan current-vocab parse-definition define-struct ;
SYNTAX: C-UNION:
scan parse-definition define-union ;