]> gitweb.factorcode.org Git - factor.git/commitdiff
gobject-introspection: add REPLACE-C-TYPE: parsing word
authorAnton Gorenko <ex.rzrjck@gmail.com>
Sun, 25 Jul 2010 16:18:32 +0000 (22:18 +0600)
committerAnton Gorenko <ex.rzrjck@gmail.com>
Sun, 25 Jul 2010 16:18:32 +0000 (22:18 +0600)
basis/gdk/ffi/ffi.factor
basis/glib/ffi/ffi.factor
basis/gobject-introspection/common/common.factor
basis/gobject-introspection/ffi/ffi.factor
basis/gobject-introspection/gobject-introspection.factor
basis/gobject/ffi/ffi.factor
extra/gstreamer/net/ffi/ffi.factor

index 11dbbc6fdb6efda957829ff1413e7c255f0d23a7..28a9f7be370088e346444c346b43da31cb3c8478 100644 (file)
@@ -18,6 +18,8 @@ TYPEDEF: guint32 GdkNativeWindow
 TYPEDEF: guint32 GdkWChar
 C-TYPE: GdkXEvent
 
+REPLACE-C-TYPE: any gpointer
+
 IMPLEMENT-STRUCTS: GdkEventAny GdkEventKey GdkEventButton
 GdkEventScroll GdkEventMotion GdkEventExpose GdkEventVisibility
 GdkEventCrossing GdkEventFocus GdkEventConfigure GdkEventProperty
index d7b265004e934a5a2348bd950e1a66df60aa922a..f810348aa0685cc734e2b67a7c19bda4e1cb6f27 100644 (file)
@@ -13,8 +13,6 @@ IN: glib.ffi
 } cond
 >>
 
-<< double "long double" current-vocab create typedef >>
-
 TYPEDEF: char gchar
 TYPEDEF: uchar guchar
 TYPEDEF: short gshort
@@ -65,7 +63,9 @@ TYPEDEF: guint32 gunichar
 TYPEDEF: guint16 gunichar2
 
 TYPEDEF: gpointer pointer
-TYPEDEF: gpointer any
+
+REPLACE-C-TYPE: long\sdouble double
+REPLACE-C-TYPE: any gpointer
 
 IMPLEMENT-STRUCTS: GPollFD GSource GSourceFuncs ;
 
index 8bf2c7eb789bc965f3cb6a1ba40e0e8f5615c569..7ffca04bdec29c17c9e1b9f2cf5bb6a5c57ba43a 100644 (file)
@@ -14,4 +14,8 @@ SYMBOL: aliases
 aliases [ H{ } ] initialize
 
 SYMBOL: implement-structs
+implement-structs [ V{ } ] initialize
+
+SYMBOL: replaced-c-types
+replaced-c-types [ H{ } ] initialize
 
index 9af01865535af3c88fc0dd29cb8053492e828ae9..fb58ede1f6832acb1dbf0d1430cb6d5496f812a4 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Anton Gorenko.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.parser arrays
+USING: accessors alien alien.c-types alien.parser arrays assocs
 classes.parser classes.struct combinators
 combinators.short-circuit definitions effects fry
 gobject-introspection.common gobject-introspection.types kernel
@@ -9,7 +9,9 @@ sequences.generalizations words words.constant ;
 IN: gobject-introspection.ffi
 
 : string>c-type ( str -- c-type )
-    parse-c-type ;
+    dup CHAR: * swap index [ cut ] [ "" ] if*
+    [ replaced-c-types get-global ?at drop ] dip
+    append parse-c-type ;
     
 : define-each ( nodes quot -- )
     '[ dup @ >>ffi drop ] each ; inline
index f0a5a982b2934b51c6972a31f466755665513e31..ae934ea76fffa1c5c2148d74f3cfcdadf7e6ed3e 100755 (executable)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2009 Anton Gorenko.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators gobject-introspection.common
-gobject-introspection.ffi gobject-introspection.loader
-kernel lexer locals math namespaces sequences vocabs.parser xml ;
+gobject-introspection.ffi gobject-introspection.loader kernel lexer
+locals math namespaces sequences strings.parser vocabs.parser xml ;
 IN: gobject-introspection
 
 : with-child-vocab ( name quot -- )
@@ -19,9 +19,15 @@ IN: gobject-introspection
     {
         [ define-ffi-repository ]
     } cleave
-    f implement-structs set-global ;
+    V{ } clone implement-structs set-global
+    H{ } clone replaced-c-types set-global ;
 
 SYNTAX: GIR: scan define-gir-vocab ;
 
 SYNTAX: IMPLEMENT-STRUCTS:
-    ";" parse-tokens implement-structs set-global ;
+    ";" parse-tokens
+    implement-structs [ swap append! ] change-global ;
+
+SYNTAX: REPLACE-C-TYPE:
+    scan unescape-string scan swap
+    replaced-c-types get-global set-at ;
index 2904ceb833bdfca7634306a4286192c470c7ad1b..7e2c5eace6ad09efa981c3a272171a201a9aed60 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Anton Gorenko.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.syntax alien.destructors alien.libraries
-combinators kernel literals math system
+classes.struct combinators kernel literals math system
 gobject-introspection glib.ffi ;
 EXCLUDE: alien.c-types => pointer ;
 IN: gobject.ffi
@@ -18,12 +18,13 @@ TYPEDEF: void* GSignalCMarshaller
 TYPEDEF: void GStrv
 TYPEDEF: gchar* gchararray
 
-IMPLEMENT-STRUCTS: GValue ;
-
 GIR: vocab:gobject/GObject-2.0.gir
 
 IN: gobject.ffi
 
+FORGET: GValue
+STRUCT: GValue { g_type GType } { data guint64[2] } ;
+
 FORGET: GIOCondition
 FORGET: G_IO_IN
 FORGET: G_IO_OUT
index 5c5e315c39a2e012d2a4aeea655240b18b45c304..fbd5148ff47c7c023c04e2e92c6ddc2848e498cd 100644 (file)
@@ -13,5 +13,7 @@ IN: gstreamer.net.ffi
 } cond
 >>
 
+REPLACE-C-TYPE: any gpointer
+
 GIR: vocab:gstreamer/net/GstNet-0.10.gir