]> gitweb.factorcode.org Git - factor.git/blob - basis/gobject/ffi/ffi.factor
b6d31cf514a9338cdb6e3c32e69fa2a8f3f17d88
[factor.git] / basis / gobject / ffi / ffi.factor
1 ! Copyright (C) 2010 Anton Gorenko.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.destructors alien.libraries alien.syntax
4 combinators gobject-introspection literals math system vocabs ;
5 IN: gobject.ffi
6
7 ! these two are needed for the definition of GError and others.
8 ! otherwise we generate GError and some others in this vocab as well.
9 << "glib.ffi" require >>
10 USE: glib.ffi
11
12 LIBRARY: gobject
13
14 << "gobject" {
15     { [ os windows? ] [ "libgobject-2.0-0.dll" ] }
16     { [ os macosx? ] [ "libgobject-2.0.dylib" ] }
17     { [ os unix? ] [ "libgobject-2.0.so" ] }
18 } cond cdecl add-library >>
19
20 IMPLEMENT-STRUCTS: GValue GParamSpecVariant ;
21
22 GIR: vocab:gobject/GObject-2.0.gir
23
24 FORGET: GIOCondition
25 FORGET: G_IO_IN
26 FORGET: G_IO_OUT
27 FORGET: G_IO_PRI
28 FORGET: G_IO_ERR
29 FORGET: G_IO_HUP
30 FORGET: G_IO_NVAL
31
32 DESTRUCTOR: g_object_unref
33
34 CONSTANT: G_TYPE_INVALID $[ 0 2 shift ]
35 CONSTANT: G_TYPE_NONE $[ 1 2 shift ]
36 CONSTANT: G_TYPE_INTERFACE $[ 2 2 shift ]
37 CONSTANT: G_TYPE_CHAR $[ 3 2 shift ]
38 CONSTANT: G_TYPE_UCHAR $[ 4 2 shift ]
39 CONSTANT: G_TYPE_BOOLEAN $[ 5 2 shift ]
40 CONSTANT: G_TYPE_INT $[ 6 2 shift ]
41 CONSTANT: G_TYPE_UINT $[ 7 2 shift ]
42 CONSTANT: G_TYPE_LONG $[ 8 2 shift ]
43 CONSTANT: G_TYPE_ULONG $[ 9 2 shift ]
44 CONSTANT: G_TYPE_INT64 $[ 10 2 shift ]
45 CONSTANT: G_TYPE_UINT64 $[ 11 2 shift ]
46 CONSTANT: G_TYPE_ENUM $[ 12 2 shift ]
47 CONSTANT: G_TYPE_FLAGS $[ 13 2 shift ]
48 CONSTANT: G_TYPE_FLOAT $[ 14 2 shift ]
49 CONSTANT: G_TYPE_DOUBLE $[ 15 2 shift ]
50 CONSTANT: G_TYPE_STRING $[ 16 2 shift ]
51 CONSTANT: G_TYPE_POINTER $[ 17 2 shift ]
52 CONSTANT: G_TYPE_BOXED $[ 18 2 shift ]
53 CONSTANT: G_TYPE_PARAM $[ 19 2 shift ]
54 CONSTANT: G_TYPE_OBJECT $[ 20 2 shift ]
55
56 ! Macros
57
58 : g_signal_connect ( instance detailed_signal c_handler data -- result )
59     f 0 g_signal_connect_data ;
60
61 : g_signal_connect_after ( instance detailed_signal c_handler data -- result )
62     f G_CONNECT_AFTER g_signal_connect_data ;
63
64 : g_signal_connect_swapped ( instance detailed_signal c_handler data -- result )
65     f G_CONNECT_SWAPPED g_signal_connect_data ;