]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.marshall.syntax: added M-STRUCTURE:
authorJeremy Hughes <jedahu@gmail.com>
Wed, 8 Jul 2009 05:33:21 +0000 (17:33 +1200)
committerJeremy Hughes <jedahu@gmail.com>
Wed, 8 Jul 2009 05:33:21 +0000 (17:33 +1200)
basis/alien/marshall/structs/structs.factor
basis/alien/marshall/syntax/syntax.factor
basis/alien/syntax/syntax.factor

index 2fbe73563dfcef9a2939a52ce505b95d86d70050..2ebade8f0283a2a60b540a669a42be28fe9e7613 100644 (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 ;
index ab794ed4a80998540fbc28362faed28fe69683dc..4453b1a4059bc1dc3d96f32e0785aa005e393046 100644 (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 ;
index ba2cbd9e53f57d013168dcec46cc6d3d1d2ac7d3..d479e6d498e5a37b46ab5326f07300c1b3d22223 100644 (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 ;