1 ! Copyright (C) 2009 Anton Gorenko.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.c-types alien.destructors
4 alien.libraries alien.strings alien.syntax combinators gir
5 io.encodings.utf8 kernel system vocabs.parser words ;
10 { [ os winnt? ] [ "libglib-2.0-0.dll" cdecl add-library ] }
11 { [ os macosx? ] [ "/opt/local/lib/libglib-2.0.0.dylib" cdecl add-library ] }
12 { [ os unix? ] [ "libglib-2.0.so" cdecl add-library ] }
16 << double "long double" current-vocab create typedef >>
21 TYPEDEF: ushort gushort
29 [ >c-bool ] >>unboxer-quot
30 [ c-bool> ] >>boxer-quot
32 "gboolean" current-vocab create typedef
38 TYPEDEF: ushort guint16
41 TYPEDEF: longlong gint64
42 TYPEDEF: ulonglong guint64
45 TYPEDEF: double gdouble
50 TYPEDEF: ssize_t gssize
53 TYPEDEF: void* gpointer
54 TYPEDEF: void* gconstpointer
56 TYPEDEF: guint8 GDateDay
57 TYPEDEF: guint16 GDateYear
59 TYPEDEF: guint32 GQuark
61 TYPEDEF: glong gintptr
62 TYPEDEF: gint64 goffset
63 TYPEDEF: gulong guintptr
64 TYPEDEF: guint32 gunichar
65 TYPEDEF: guint16 gunichar2
67 TYPEDEF: gpointer pointer
70 IMPLEMENT-STRUCTS: GError GPollFD GSource GSourceFuncs ;
72 GIR: vocab:glib/GLib-2.0.gir
74 DESTRUCTOR: g_source_unref
77 CALLBACK: gboolean GSourceFuncsPrepareFunc ( GSource* source, gint* timeout_ ) ;
78 CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ;
79 CALLBACK: gboolean GSourceFuncsDispatchFunc ( GSource* source, GSourceFunc callback, gpointer user_data ) ;
81 ERROR: g-error domain code message ;
83 : GError>g-error ( GError -- g-error )
84 [ domain>> g_quark_to_string utf8 alien>string ]
86 [ message>> utf8 alien>string ] tri
89 : handle-GError ( GError/f -- )