]> gitweb.factorcode.org Git - factor.git/commitdiff
gobject-introspection: internal strucs (*Class, *Iface or *Private) are generated...
authorAnton Gorenko <ex.rzrjck@gmail.com>
Sat, 5 Mar 2011 19:05:02 +0000 (01:05 +0600)
committerAnton Gorenko <ex.rzrjck@gmail.com>
Sat, 5 Mar 2011 19:05:02 +0000 (01:05 +0600)
basis/gobject-introspection/ffi/ffi.factor
basis/gobject-introspection/loader/loader.factor
basis/gobject-introspection/repository/repository.factor

index 53f0944c2074eca920d4fb72c532eeb0354a5ab7..3b56c78a2acb56d72f4d453cf2789576cc314188 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2010 Anton Gorenko.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.parser arrays ascii
-classes.parser classes.struct combinators gobject-introspection.common
-gobject-introspection.repository gobject-introspection.types kernel
-locals make math.parser namespaces parser sequences
-splitting.monotonic words words.constant ;
+classes.parser classes.struct combinators combinators.short-circuit
+gobject-introspection.common gobject-introspection.repository
+gobject-introspection.types kernel locals make math.parser namespaces
+parser sequences splitting.monotonic vocabs.parser words
+words.constant ;
 IN: gobject-introspection.ffi
 
 SYMBOL: constant-prefix
@@ -226,6 +227,14 @@ M: array-type field-type>c-type type>c-type ;
 : def-union-type ( union -- )
     c-type>> void def-c-type ;
 
+: private-record? ( record -- ? )
+    {
+        [ struct-for>> ]
+        [ name>> "Class" tail? ]
+        [ name>> "Private" tail? ]
+        [ name>> "Iface" tail? ]
+    } 1|| ;
+
 : def-union ( union -- )
     {
         [ def-union-type ]
@@ -286,22 +295,30 @@ M: array-type field-type>c-type type>c-type ;
 
 : defer-enums ( enums -- ) enum-info defer-types ;
 : defer-bitfields ( bitfields -- ) bitfield-info defer-types ;
-: defer-records ( records -- ) record-info defer-types ;
 : defer-unions ( unions -- ) union-info defer-types ;
 : defer-boxeds ( boxeds -- ) boxed-info defer-types ;
 : defer-callbacks ( callbacks -- ) callback-info defer-types ;
 : defer-interfaces ( interfaces -- ) interface-info defer-types ;
 : defer-classes ( class -- ) class-info defer-types ;
 
+: defer-records ( records -- )
+    [ private-record? ] partition
+    [ begin-private record-info defer-types end-private ]
+    [ record-info defer-types ] bi* ;
+
 : def-enums ( enums -- ) [ def-enum-type ] each ;
 : def-bitfields ( bitfields -- ) [ def-bitfield-type ] each ;
-: def-records ( records -- ) [ def-record ] each ;
 : def-unions ( unions -- ) [ def-union ] each ;
 : def-boxeds ( boxeds -- ) [ def-boxed-type ] each ;
 : def-callbacks ( callbacks -- ) [ def-callback-type ] each ;
 : def-interfaces ( interfaces -- ) [ def-interface ] each ;
 : def-classes ( classes -- ) [ def-class ] each ;
 
+: def-records ( records -- )
+    [ private-record? ] partition
+    [ begin-private [ def-record ] each end-private ]
+    [ [ def-record ] each ] bi* ;
+
 : def-namespace ( namespace -- )
     {
         [ symbol-prefixes>> first >upper constant-prefix set ]
index 3bc139e35bf38d1198189c9e44408d97f904edeb..aedd07231afbfa3223c945521fada2ceecf6bf29 100644 (file)
@@ -133,6 +133,7 @@ CONSTANT: type-tags
         [ "method" load-functions >>methods ]
         [ "function" load-functions >>functions ]
         [ "disguised" attr "1" = >>disguised? ]
+        [ "is-gtype-struct-for" attr >>struct-for ]
     } cleave ;
 
 : xml>union ( xml -- union )
index 4344c99526a4888eaea162634bcf8706829937cc..87ebcb1308c20bf102b2908695f0116a64a72af5 100644 (file)
@@ -66,7 +66,8 @@ TUPLE: record < type
     constructors
     methods
     functions
-    disguised? ;
+    disguised?
+    struct-for ;
 
 TUPLE: field
     name