alien.marshall.syntax: added M-STRUCTURE:

db4
Jeremy Hughes 2009-07-08 17:33:21 +12:00
parent 7d708a17c2
commit eab6d79ac4
3 changed files with 11 additions and 5 deletions

View File

@ -2,7 +2,8 @@
! 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 ;
@ -35,3 +36,6 @@ 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 ;

View File

@ -34,3 +34,7 @@ SYNTAX: C-MARSHALLED:
SYNTAX: MARSHALLED:
function-types-effect marshalled-function define-declared ;
SYNTAX: M-STRUCTURE:
scan current-vocab parse-definition
define-marshalled-struct ;

View File

@ -4,8 +4,7 @@ USING: accessors arrays alien alien.c-types alien.structs
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 ;
@ -23,8 +22,7 @@ SYNTAX: TYPEDEF:
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 ;