gobject-introspection: add REPLACE-C-TYPE: parsing word
							parent
							
								
									0f9a2265a7
								
							
						
					
					
						commit
						d82a78f89b
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,5 +13,7 @@ IN: gstreamer.net.ffi
 | 
			
		|||
} cond
 | 
			
		||||
>>
 | 
			
		||||
 | 
			
		||||
REPLACE-C-TYPE: any gpointer
 | 
			
		||||
 | 
			
		||||
GIR: vocab:gstreamer/net/GstNet-0.10.gir
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue