gobject-introspection: rewrite gir files loading and code generation totally
generate girs from fresh sources ui.backend.gtk, ui.text.pango: update a little bit (this commit is unstable, because new GObject-introspection release (> 0.9) is much different from 0.6 and it needs more detailed annotations (e.g. to parse out/inout parameters), which are mostly missing now)db4
parent
f7573bf329
commit
913362a3a2
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,15 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.libraries alien.syntax combinators kernel
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
system
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
gobject-introspection glib.ffi gobject.ffi ;
|
|
||||||
IN: atk.ffi
|
IN: atk.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gobject.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: atk
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"atk" {
|
"atk" {
|
||||||
{ [ os winnt? ] [ "libatk-1.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libatk-1.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -13,11 +18,4 @@ IN: atk.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: guint64 AtkState
|
|
||||||
TYPEDEF: GSList AtkAttributeSet
|
|
||||||
|
|
||||||
! gir: error
|
|
||||||
C-TYPE: AtkPropertyValues
|
|
||||||
|
|
||||||
GIR: vocab:atk/Atk-1.0.gir
|
GIR: vocab:atk/Atk-1.0.gir
|
||||||
|
|
||||||
|
|
22284
basis/gdk/Gdk-2.0.gir
22284
basis/gdk/Gdk-2.0.gir
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,17 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.destructors alien.syntax
|
USING: alien alien.c-types alien.destructors alien.libraries
|
||||||
alien.libraries cairo.ffi combinators kernel system
|
alien.syntax cairo.ffi classes.struct combinators
|
||||||
gobject-introspection gdk.pixbuf.ffi gio.ffi glib.ffi gmodule.ffi
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
gobject.ffi pango.ffi ;
|
|
||||||
IN: gdk.ffi
|
IN: gdk.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"pango.ffi" require
|
||||||
|
"gdk.pixbuf.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gdk
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gdk" {
|
"gdk" {
|
||||||
{ [ os winnt? ] [ "libgdk-win32-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libgdk-win32-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -14,12 +20,6 @@ IN: gdk.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: guint32 GdkNativeWindow
|
|
||||||
TYPEDEF: guint32 GdkWChar
|
|
||||||
C-TYPE: GdkXEvent
|
|
||||||
|
|
||||||
REPLACE-C-TYPE: any gpointer
|
|
||||||
|
|
||||||
IMPLEMENT-STRUCTS: GdkEventAny GdkEventKey GdkEventButton
|
IMPLEMENT-STRUCTS: GdkEventAny GdkEventKey GdkEventButton
|
||||||
GdkEventScroll GdkEventMotion GdkEventExpose GdkEventVisibility
|
GdkEventScroll GdkEventMotion GdkEventExpose GdkEventVisibility
|
||||||
GdkEventCrossing GdkEventFocus GdkEventConfigure GdkEventProperty
|
GdkEventCrossing GdkEventFocus GdkEventConfigure GdkEventProperty
|
||||||
|
@ -27,7 +27,21 @@ GdkEventSelection GdkEventDND GdkEventProximity GdkEventClient
|
||||||
GdkEventNoExpose GdkEventWindowState GdkEventSetting
|
GdkEventNoExpose GdkEventWindowState GdkEventSetting
|
||||||
GdkEventOwnerChange GdkEventGrabBroken GdkRectangle ;
|
GdkEventOwnerChange GdkEventGrabBroken GdkRectangle ;
|
||||||
|
|
||||||
GIR: vocab:gdk/Gdk-2.0.gir
|
! <workaround these types are from cairo 1.10
|
||||||
|
STRUCT: cairo_rectangle_int_t
|
||||||
|
{ x int } { y int } { width int } { height int } ;
|
||||||
|
|
||||||
|
C-TYPE: cairo_region_t
|
||||||
|
! workaround>
|
||||||
|
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.RectangleInt cairo_rectangle_int_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.Region cairo_region_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.FontOptions cairo_font_options_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.Surface cairo_surface_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.Pattern cairo_pattern_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.Context cairo_t
|
||||||
|
FOREIGN-ENUM-TYPE: cairo.Content cairo_content_t
|
||||||
|
|
||||||
|
GIR: vocab:gdk/Gdk-3.0.gir
|
||||||
|
|
||||||
DESTRUCTOR: gdk_cursor_unref
|
DESTRUCTOR: gdk_cursor_unref
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,15 @@
|
||||||
! Copyright (C) 2010 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.libraries combinators kernel
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
system vocabs.parser words
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
gobject-introspection gdk.ffi gdk.pixbuf.ffi gio.ffi glib.ffi
|
|
||||||
gmodule.ffi gobject.ffi pango.ffi ;
|
|
||||||
IN: gdk.gl.ffi
|
IN: gdk.gl.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gdk.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gdk.gl
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gdk.gl" {
|
"gdk.gl" {
|
||||||
{ [ os winnt? ] [ drop ] }
|
{ [ os winnt? ] [ drop ] }
|
||||||
|
@ -14,7 +18,4 @@ IN: gdk.gl.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
<< ulong "unsigned long" current-vocab create typedef >>
|
GIR: vocab:gdk/gl/GdkGLExt-1.0.gir
|
||||||
|
|
||||||
GIR: vocab:gdk/gl/GdkGL-1.0.gir
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,15 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.libraries combinators kernel system
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
gobject-introspection gio.ffi glib.ffi gmodule.ffi gobject.ffi ;
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
EXCLUDE: alien.c-types => pointer ;
|
|
||||||
IN: gdk.pixbuf.ffi
|
IN: gdk.pixbuf.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gio.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gdk.pixbuf
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gdk.pixbuf" {
|
"gdk.pixbuf" {
|
||||||
{ [ os winnt? ] [ "libgdk_pixbuf-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libgdk_pixbuf-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -14,4 +19,3 @@ IN: gdk.pixbuf.ffi
|
||||||
>>
|
>>
|
||||||
|
|
||||||
GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
|
GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
|
||||||
|
|
||||||
|
|
39579
basis/gio/Gio-2.0.gir
39579
basis/gio/Gio-2.0.gir
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,15 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.libraries combinators kernel system
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
gobject-introspection glib.ffi gobject.ffi ;
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
EXCLUDE: alien.c-types => pointer ;
|
|
||||||
IN: gio.ffi
|
IN: gio.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gobject.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gio
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gio" {
|
"gio" {
|
||||||
{ [ os winnt? ] [ "libgio-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libgio-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -14,4 +19,3 @@ IN: gio.ffi
|
||||||
>>
|
>>
|
||||||
|
|
||||||
GIR: vocab:gio/Gio-2.0.gir
|
GIR: vocab:gio/Gio-2.0.gir
|
||||||
|
|
||||||
|
|
22182
basis/glib/GLib-2.0.gir
22182
basis/glib/GLib-2.0.gir
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,12 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.destructors
|
USING: alien alien.destructors alien.libraries alien.syntax
|
||||||
alien.libraries alien.syntax classes.struct combinators
|
combinators gobject-introspection gobject-introspection.standard-types
|
||||||
compiler.units gobject-introspection kernel system vocabs.parser
|
system ;
|
||||||
words ;
|
|
||||||
IN: glib.ffi
|
IN: glib.ffi
|
||||||
|
|
||||||
|
LIBRARY: glib
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"glib" {
|
"glib" {
|
||||||
{ [ os winnt? ] [ "libglib-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libglib-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -14,62 +15,6 @@ IN: glib.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: char gchar
|
|
||||||
TYPEDEF: uchar guchar
|
|
||||||
TYPEDEF: short gshort
|
|
||||||
TYPEDEF: ushort gushort
|
|
||||||
TYPEDEF: long glong
|
|
||||||
TYPEDEF: ulong gulong
|
|
||||||
TYPEDEF: int gint
|
|
||||||
TYPEDEF: uint guint
|
|
||||||
|
|
||||||
<<
|
|
||||||
int c-type clone
|
|
||||||
[ >c-bool ] >>unboxer-quot
|
|
||||||
[ c-bool> ] >>boxer-quot
|
|
||||||
object >>boxed-class
|
|
||||||
"gboolean" current-vocab create typedef
|
|
||||||
>>
|
|
||||||
|
|
||||||
TYPEDEF: char gint8
|
|
||||||
TYPEDEF: uchar guint8
|
|
||||||
TYPEDEF: short gint16
|
|
||||||
TYPEDEF: ushort guint16
|
|
||||||
TYPEDEF: int gint32
|
|
||||||
TYPEDEF: uint guint32
|
|
||||||
TYPEDEF: longlong gint64
|
|
||||||
TYPEDEF: ulonglong guint64
|
|
||||||
|
|
||||||
TYPEDEF: float gfloat
|
|
||||||
TYPEDEF: double gdouble
|
|
||||||
|
|
||||||
TYPEDEF: long ssize_t
|
|
||||||
TYPEDEF: long time_t
|
|
||||||
TYPEDEF: size_t gsize
|
|
||||||
TYPEDEF: ssize_t gssize
|
|
||||||
TYPEDEF: size_t GType
|
|
||||||
|
|
||||||
TYPEDEF: void* gpointer
|
|
||||||
TYPEDEF: void* gconstpointer
|
|
||||||
|
|
||||||
TYPEDEF: guint8 GDateDay
|
|
||||||
TYPEDEF: guint16 GDateYear
|
|
||||||
TYPEDEF: gint GPid
|
|
||||||
TYPEDEF: guint32 GQuark
|
|
||||||
TYPEDEF: gint32 GTime
|
|
||||||
TYPEDEF: glong gintptr
|
|
||||||
TYPEDEF: gint64 goffset
|
|
||||||
TYPEDEF: gulong guintptr
|
|
||||||
TYPEDEF: guint32 gunichar
|
|
||||||
TYPEDEF: guint16 gunichar2
|
|
||||||
|
|
||||||
TYPEDEF: gpointer pointer
|
|
||||||
|
|
||||||
STRUCT: fake-long-double { data char[10] } ;
|
|
||||||
REPLACE-C-TYPE: long\sdouble fake-long-double
|
|
||||||
|
|
||||||
REPLACE-C-TYPE: any gpointer
|
|
||||||
|
|
||||||
IMPLEMENT-STRUCTS: GPollFD GSource GSourceFuncs ;
|
IMPLEMENT-STRUCTS: GPollFD GSource GSourceFuncs ;
|
||||||
|
|
||||||
CONSTANT: G_MININT8 HEX: -80
|
CONSTANT: G_MININT8 HEX: -80
|
||||||
|
@ -93,4 +38,3 @@ DESTRUCTOR: g_free
|
||||||
CALLBACK: gboolean GSourceFuncsPrepareFunc ( GSource* source, gint* timeout_ ) ;
|
CALLBACK: gboolean GSourceFuncsPrepareFunc ( GSource* source, gint* timeout_ ) ;
|
||||||
CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ;
|
CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ;
|
||||||
CALLBACK: gboolean GSourceFuncsDispatchFunc ( GSource* source, GSourceFunc callback, gpointer user_data ) ;
|
CALLBACK: gboolean GSourceFuncsDispatchFunc ( GSource* source, GSourceFunc callback, gpointer user_data ) ;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
||||||
To affect the contents of this file, edit the original C definitions,
|
To affect the contents of this file, edit the original C definitions,
|
||||||
and/or use gtk-doc annotations. -->
|
and/or use gtk-doc annotations. -->
|
||||||
<repository version="1.0"
|
<repository version="1.2"
|
||||||
xmlns="http://www.gtk.org/introspection/core/1.0"
|
xmlns="http://www.gtk.org/introspection/core/1.0"
|
||||||
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
||||||
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
||||||
|
@ -12,11 +12,12 @@ and/or use gtk-doc annotations. -->
|
||||||
<namespace name="GModule"
|
<namespace name="GModule"
|
||||||
version="2.0"
|
version="2.0"
|
||||||
shared-library="libgmodule-2.0.so.0"
|
shared-library="libgmodule-2.0.so.0"
|
||||||
c:prefix="g">
|
c:identifier-prefixes="G"
|
||||||
<record name="Module" c:type="GModule">
|
c:symbol-prefixes="g">
|
||||||
|
<record name="Module" c:type="GModule" disguised="1">
|
||||||
<method name="close" c:identifier="g_module_close">
|
<method name="close" c:identifier="g_module_close">
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="boolean" c:type="gboolean"/>
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</method>
|
</method>
|
||||||
<method name="make_resident" c:identifier="g_module_make_resident">
|
<method name="make_resident" c:identifier="g_module_make_resident">
|
||||||
|
@ -24,24 +25,24 @@ and/or use gtk-doc annotations. -->
|
||||||
<type name="none" c:type="void"/>
|
<type name="none" c:type="void"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="name" c:identifier="g_module_name">
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="utf8" c:type="gchar*"/>
|
||||||
|
</return-value>
|
||||||
|
</method>
|
||||||
<method name="symbol" c:identifier="g_module_symbol">
|
<method name="symbol" c:identifier="g_module_symbol">
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="boolean" c:type="gboolean"/>
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter name="symbol_name" transfer-ownership="none">
|
<parameter name="symbol_name" transfer-ownership="none">
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="symbol" transfer-ownership="none">
|
<parameter name="symbol" transfer-ownership="none">
|
||||||
<type name="any" c:type="gpointer*"/>
|
<type name="gpointer" c:type="gpointer*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</method>
|
</method>
|
||||||
<method name="name" c:identifier="g_module_name">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="utf8" c:type="gchar*"/>
|
|
||||||
</return-value>
|
|
||||||
</method>
|
|
||||||
</record>
|
</record>
|
||||||
<callback name="ModuleCheckInit" c:type="GModuleCheckInit">
|
<callback name="ModuleCheckInit" c:type="GModuleCheckInit">
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
|
@ -68,7 +69,7 @@ and/or use gtk-doc annotations. -->
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</callback>
|
</callback>
|
||||||
<function name="build_path" c:identifier="g_module_build_path">
|
<function name="module_build_path" c:identifier="g_module_build_path">
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full">
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
|
@ -81,13 +82,15 @@ and/or use gtk-doc annotations. -->
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</function>
|
</function>
|
||||||
<function name="error" c:identifier="g_module_error">
|
<function name="module_error" c:identifier="g_module_error">
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</function>
|
</function>
|
||||||
<function name="open" c:identifier="g_module_open">
|
<function name="module_open"
|
||||||
<return-value transfer-ownership="full">
|
c:identifier="g_module_open"
|
||||||
|
introspectable="0">
|
||||||
|
<return-value>
|
||||||
<type name="Module" c:type="GModule*"/>
|
<type name="Module" c:type="GModule*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
<parameters>
|
<parameters>
|
||||||
|
@ -99,9 +102,9 @@ and/or use gtk-doc annotations. -->
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</function>
|
</function>
|
||||||
<function name="supported" c:identifier="g_module_supported">
|
<function name="module_supported" c:identifier="g_module_supported">
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="boolean" c:type="gboolean"/>
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</function>
|
</function>
|
||||||
</namespace>
|
</namespace>
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.libraries combinators kernel system
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
gobject-introspection glib.ffi ;
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
IN: gmodule.ffi
|
IN: gmodule.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"glib.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gmodule
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gmodule" {
|
"gmodule" {
|
||||||
{ [ os winnt? ] [ "libgmodule-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libgmodule-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -13,4 +19,3 @@ IN: gmodule.ffi
|
||||||
>>
|
>>
|
||||||
|
|
||||||
GIR: vocab:gmodule/GModule-2.0.gir
|
GIR: vocab:gmodule/GModule-2.0.gir
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,9 @@
|
||||||
! Copyright (C) 2010 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs kernel namespaces ;
|
USING: namespaces ;
|
||||||
IN: gobject-introspection.common
|
IN: gobject-introspection.common
|
||||||
|
|
||||||
CONSTANT: ffi-vocab "ffi"
|
SYMBOL: current-namespace-name
|
||||||
|
|
||||||
SYMBOL: current-lib
|
|
||||||
|
|
||||||
SYMBOL: type-infos
|
|
||||||
type-infos [ H{ } ] initialize
|
|
||||||
|
|
||||||
SYMBOL: aliases
|
|
||||||
aliases [ H{ } ] initialize
|
|
||||||
|
|
||||||
SYMBOL: implement-structs
|
SYMBOL: implement-structs
|
||||||
implement-structs [ V{ } ] initialize
|
implement-structs [ V{ } ] initialize
|
||||||
|
|
||||||
SYMBOL: replaced-c-types
|
|
||||||
replaced-c-types [ H{ } ] initialize
|
|
||||||
|
|
||||||
|
|
|
@ -1,240 +1,341 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.parser arrays assocs
|
USING: accessors alien alien.c-types alien.parser arrays assocs
|
||||||
classes.parser classes.struct combinators
|
classes.parser classes.struct combinators
|
||||||
combinators.short-circuit definitions effects fry
|
combinators.short-circuit definitions effects fry
|
||||||
gobject-introspection.common gobject-introspection.types kernel
|
gobject-introspection.common gobject-introspection.types kernel
|
||||||
math.parser namespaces parser quotations sequences
|
math.parser namespaces parser quotations sequences
|
||||||
|
|
||||||
|
gobject-introspection.standard-types
|
||||||
|
prettyprint ascii gobject-introspection.repository locals
|
||||||
|
compiler.units make splitting.monotonic
|
||||||
|
|
||||||
sequences.generalizations words words.constant ;
|
sequences.generalizations words words.constant ;
|
||||||
IN: gobject-introspection.ffi
|
IN: gobject-introspection.ffi
|
||||||
|
|
||||||
: string>c-type ( str -- c-type )
|
SYMBOL: constant-prefix
|
||||||
dup CHAR: * swap index [ cut ] [ "" ] if*
|
|
||||||
[ replaced-c-types get-global ?at drop ] dip
|
|
||||||
append parse-c-type ;
|
|
||||||
|
|
||||||
: define-each ( nodes quot -- )
|
: def-c-type ( c-type-name base-c-type -- )
|
||||||
'[ dup @ >>ffi drop ] each ; inline
|
swap (CREATE-C-TYPE) typedef ;
|
||||||
|
|
||||||
: function-ffi-invoker ( func -- quot )
|
: defer-c-type ( c-type-name -- c-type )
|
||||||
{
|
deferred-type swap (CREATE-C-TYPE) [ typedef ] keep ;
|
||||||
[ return>> c-type>> string>c-type ]
|
! create-in dup
|
||||||
[ drop current-lib get-global ]
|
! [ fake-definition ] [ undefined-def define ] bi ;
|
||||||
[ identifier>> ]
|
|
||||||
[ parameters>> [ c-type>> string>c-type ] map ]
|
|
||||||
[ varargs?>> [ void* suffix ] when ]
|
|
||||||
} cleave function-quot ;
|
|
||||||
|
|
||||||
: function-ffi-effect ( func -- effect )
|
:: defer-types ( types type-info-class -- )
|
||||||
[ parameters>> [ name>> ] map ]
|
types [
|
||||||
[ varargs?>> [ "varargs" suffix ] when ]
|
[ c-type>> defer-c-type ]
|
||||||
[ return>> type>> none-type? { } { "result" } ? ] tri
|
[ name>> qualified-name ] bi
|
||||||
<effect> ;
|
type-info-class new swap register-type
|
||||||
|
] each ;
|
||||||
|
|
||||||
: define-ffi-function ( func -- word )
|
: def-alias-c-type ( base-c-type c-type-name -- c-type )
|
||||||
[ identifier>> create-in dup ]
|
(CREATE-C-TYPE) [ typedef ] keep ;
|
||||||
[ function-ffi-invoker ] [ function-ffi-effect ] tri
|
|
||||||
define-declared ;
|
|
||||||
|
|
||||||
: define-ffi-functions ( functions -- )
|
: alias-c-type-name ( alias -- c-type-name )
|
||||||
[ define-ffi-function ] define-each ;
|
! <workaround for alises w/o c:type (Atk)
|
||||||
|
[ c-type>> ] [ name>> ] bi or ;
|
||||||
|
! workaround>
|
||||||
|
! c-type>> ;
|
||||||
|
|
||||||
: callback-ffi-invoker ( callback -- quot )
|
:: def-alias ( alias -- )
|
||||||
[ return>> c-type>> string>c-type ]
|
alias type>> get-type-info
|
||||||
[ parameters>> [ c-type>> string>c-type ] map ] bi
|
[ c-type>> alias alias-c-type-name def-alias-c-type ]
|
||||||
cdecl callback-quot ;
|
[ clone ] bi alias name>> qualified-name register-type ;
|
||||||
|
|
||||||
: callback-ffi-effect ( callback -- effect )
|
: def-aliases ( aliases -- )
|
||||||
[ parameters>> [ name>> ] map ]
|
[ def-alias ] each ;
|
||||||
[ return>> type>> none-type? { } { "result" } ? ] bi
|
|
||||||
<effect> ;
|
|
||||||
|
|
||||||
: define-ffi-callback ( callback -- word )
|
GENERIC: type>c-type ( type -- c-type )
|
||||||
[ c-type>> create-in [ void* swap typedef ] keep dup ] keep
|
|
||||||
[ callback-ffi-effect "callback-effect" set-word-prop ]
|
|
||||||
[ drop current-lib get-global "callback-library" set-word-prop ]
|
|
||||||
[ callback-ffi-invoker (( quot -- alien )) define-inline ] 2tri ;
|
|
||||||
|
|
||||||
: fix-signal-param-c-type ( param -- )
|
M: atomic-type type>c-type get-type-info c-type>> ;
|
||||||
dup [ c-type>> ] [ type>> ] bi
|
M: enum-type type>c-type get-type-info c-type>> ;
|
||||||
{
|
M: bitfield-type type>c-type get-type-info c-type>> ;
|
||||||
[ none-type? ]
|
M: record-type type>c-type get-type-info c-type>> <pointer> ;
|
||||||
[ simple-type? ]
|
M: union-type type>c-type get-type-info c-type>> <pointer> ;
|
||||||
[ enum-type? ]
|
M: boxed-type type>c-type get-type-info c-type>> <pointer> ;
|
||||||
[ bitfield-type? ]
|
M: callback-type type>c-type get-type-info c-type>> ;
|
||||||
} 1|| [ dup "*" tail? [ CHAR: * suffix ] unless ] unless
|
M: class-type type>c-type get-type-info c-type>> <pointer> ;
|
||||||
>>c-type drop ;
|
M: interface-type type>c-type get-type-info c-type>> <pointer> ;
|
||||||
|
|
||||||
: define-ffi-signal ( signal -- word )
|
M: boxed-array-type type>c-type
|
||||||
[ return>> fix-signal-param-c-type ]
|
name>> simple-type new swap >>name type>c-type ;
|
||||||
[ parameters>> [ fix-signal-param-c-type ] each ]
|
|
||||||
[ define-ffi-callback ] tri ;
|
|
||||||
|
|
||||||
: define-ffi-signals ( signals -- )
|
M: c-array-type type>c-type
|
||||||
[ define-ffi-signal ] define-each ;
|
element-type>> type>c-type <pointer> ;
|
||||||
|
|
||||||
: const-value ( const -- value )
|
M: fixed-size-array-type type>c-type
|
||||||
[ value>> ] [ type>> name>> ] bi {
|
[ element-type>> type>c-type ] [ fixed-size>> ] bi 2array ;
|
||||||
{ "int" [ string>number ] }
|
|
||||||
{ "double" [ string>number ] }
|
! <workaround for <type/> (in some signals and properties)
|
||||||
{ "utf8" [ ] }
|
PREDICATE: incorrect-type < simple-type name>> not ;
|
||||||
|
M: incorrect-type type>c-type drop void* ;
|
||||||
|
! workaround>
|
||||||
|
|
||||||
|
GENERIC: parse-const-value ( str data-type -- value )
|
||||||
|
|
||||||
|
M: atomic-type parse-const-value
|
||||||
|
name>> {
|
||||||
|
{ "gint" [ string>number ] }
|
||||||
|
{ "gdouble" [ string>number ] }
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: define-ffi-enum ( enum -- word )
|
M: utf8-type parse-const-value drop ;
|
||||||
[
|
|
||||||
members>> [
|
|
||||||
[ c-identifier>> create-in ]
|
|
||||||
[ value>> ] bi define-constant
|
|
||||||
] each
|
|
||||||
] [ c-type>> (CREATE-C-TYPE) [ int swap typedef ] keep ] bi ;
|
|
||||||
|
|
||||||
: define-ffi-enums ( enums -- )
|
: const-value ( const -- value )
|
||||||
[ define-ffi-enum ] define-each ;
|
[ value>> ] [ type>> ] bi parse-const-value ;
|
||||||
|
|
||||||
: define-ffi-bitfields ( bitfields -- )
|
: const-name ( const -- name )
|
||||||
[ define-ffi-enum ] define-each ;
|
name>> constant-prefix get swap "_" glue ;
|
||||||
|
|
||||||
: fields>struct-slots ( fields -- slots )
|
: def-const ( const -- )
|
||||||
|
[ const-name create-in dup reset-generic ]
|
||||||
|
[ const-value ] bi define-constant ;
|
||||||
|
|
||||||
|
: def-consts ( consts -- )
|
||||||
|
[ def-const ] each ;
|
||||||
|
|
||||||
|
: define-enum-member ( member -- )
|
||||||
|
[ c-identifier>> create-in dup reset-generic ]
|
||||||
|
[ value>> ] bi define-constant ;
|
||||||
|
|
||||||
|
: def-enum-type ( enum -- )
|
||||||
|
[ members>> [ define-enum-member ] each ]
|
||||||
|
[ c-type>> int def-c-type ] bi ;
|
||||||
|
|
||||||
|
: def-bitfield-type ( bitfield -- )
|
||||||
|
def-enum-type ;
|
||||||
|
|
||||||
|
GENERIC: parameter-type>c-type ( data-type -- c-type )
|
||||||
|
|
||||||
|
M: data-type parameter-type>c-type type>c-type ;
|
||||||
|
M: varargs-type parameter-type>c-type drop void* ;
|
||||||
|
|
||||||
|
: parameter-c-type ( parameter -- c-type )
|
||||||
|
[ type>> parameter-type>c-type ] keep
|
||||||
|
direction>> "in" = [ <pointer> ] unless ;
|
||||||
|
|
||||||
|
GENERIC: return-type>c-type ( data-type -- c-type )
|
||||||
|
|
||||||
|
M: data-type return-type>c-type type>c-type ;
|
||||||
|
M: none-type return-type>c-type drop void ;
|
||||||
|
|
||||||
|
: return-c-type ( return -- c-type )
|
||||||
|
type>> return-type>c-type ;
|
||||||
|
|
||||||
|
: parameter-name ( parameter -- name )
|
||||||
|
dup type>> varargs-type?
|
||||||
|
[ drop "varargs" ] [ name>> "!incorrect-name!" or ] if ;
|
||||||
|
|
||||||
|
: error-parameter ( -- parameter )
|
||||||
|
parameter new
|
||||||
|
"error" >>name
|
||||||
|
"in" >>direction
|
||||||
|
"none" >>transfer-ownership
|
||||||
|
simple-type new "GLib.Error" >>name >>type ;
|
||||||
|
|
||||||
|
: ?suffix-parameters-with-error ( callable -- parameters )
|
||||||
|
[ parameters>> ] [ throws?>> ] bi
|
||||||
|
[ error-parameter suffix ] when ;
|
||||||
|
|
||||||
|
: parameter-names&types ( callable -- names types )
|
||||||
|
[ [ parameter-c-type ] map ] [ [ parameter-name ] map ] bi ;
|
||||||
|
|
||||||
|
: def-function ( function -- )
|
||||||
|
{
|
||||||
|
[ return>> return-c-type ]
|
||||||
|
[ identifier>> ]
|
||||||
|
[ drop current-library get ]
|
||||||
|
[ ?suffix-parameters-with-error parameter-names&types ]
|
||||||
|
} cleave make-function define-inline ;
|
||||||
|
|
||||||
|
: def-functions ( functions -- )
|
||||||
|
[ def-function ] each ;
|
||||||
|
|
||||||
|
GENERIC: type>data-type ( type -- data-type )
|
||||||
|
|
||||||
|
M: type type>data-type
|
||||||
|
[ simple-type new ] dip name>> >>name ;
|
||||||
|
|
||||||
|
: word-started? ( word letter -- ? )
|
||||||
|
[ letter? ] [ LETTER? ] bi* and ; inline
|
||||||
|
|
||||||
|
: camel-case>underscore-separated ( str -- str' )
|
||||||
|
[ word-started? not ] monotonic-split "_" join >lower ;
|
||||||
|
|
||||||
|
: type>parameter-name ( type -- name )
|
||||||
|
name>> camel-case>underscore-separated ;
|
||||||
|
|
||||||
|
: type>parameter ( type -- parameter )
|
||||||
|
[ parameter new ] dip {
|
||||||
|
[ type>parameter-name >>name ]
|
||||||
|
[ type>data-type >>type ]
|
||||||
|
[ drop "in" >>direction "none" >>transfer-ownership ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
:: def-method ( method type -- )
|
||||||
|
method {
|
||||||
|
[ return>> return-c-type ]
|
||||||
|
[ identifier>> ]
|
||||||
|
[ drop current-library get ]
|
||||||
[
|
[
|
||||||
[ name>> ]
|
?suffix-parameters-with-error
|
||||||
[
|
type type>parameter prefix
|
||||||
[ c-type>> string>c-type ] [ array-info>> ] bi
|
parameter-names&types
|
||||||
[ fixed-size>> [ 2array ] when* ] when*
|
|
||||||
]
|
]
|
||||||
[ drop { } ] tri <struct-slot-spec>
|
} cleave make-function define-inline ;
|
||||||
] map ;
|
|
||||||
|
|
||||||
: define-ffi-record-defer ( record -- word )
|
: def-methods ( methods type -- )
|
||||||
c-type>> create-in void* swap [ typedef ] keep ;
|
[ def-method ] curry each ;
|
||||||
|
|
||||||
: define-ffi-records-defer ( records -- )
|
: def-callback-type ( callback -- )
|
||||||
[ define-ffi-record-defer ] define-each ;
|
{
|
||||||
|
[ drop current-library get ]
|
||||||
|
[ return>> return-c-type ]
|
||||||
|
[ c-type>> ]
|
||||||
|
[ ?suffix-parameters-with-error parameter-names&types ]
|
||||||
|
} cleave make-callback-type define-inline ;
|
||||||
|
|
||||||
: define-ffi-record ( record -- word )
|
GENERIC: field-type>c-type ( data-type -- c-type )
|
||||||
dup ffi>> forget
|
|
||||||
dup {
|
M: simple-type field-type>c-type type>c-type ;
|
||||||
[ fields>> empty? not ]
|
M: inner-callback-type field-type>c-type drop void* ;
|
||||||
[ c-type>> implement-structs get-global member? ]
|
M: array-type field-type>c-type type>c-type ;
|
||||||
} 1&&
|
|
||||||
|
: field>struct-slot ( field -- slot )
|
||||||
|
[ name>> ]
|
||||||
|
[ dup bits>> [ drop uint ] [ type>> field-type>c-type ] if ]
|
||||||
[
|
[
|
||||||
[ c-type>> create-class-in dup ]
|
|
||||||
[ fields>> fields>struct-slots ] bi define-struct-class
|
|
||||||
] [
|
|
||||||
[ disguised?>> void* void ? ]
|
|
||||||
[ c-type>> create-in ] bi [ typedef ] keep
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: define-ffi-records ( records -- )
|
|
||||||
[ define-ffi-record ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-record-content ( record -- )
|
|
||||||
{
|
|
||||||
[ constructors>> define-ffi-functions ]
|
|
||||||
[ functions>> define-ffi-functions ]
|
|
||||||
[ methods>> define-ffi-functions ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: define-ffi-records-content ( records -- )
|
|
||||||
[ define-ffi-record-content ] each ;
|
|
||||||
|
|
||||||
: define-ffi-union ( union -- word )
|
|
||||||
c-type>> create-in [ void* swap typedef ] keep ;
|
|
||||||
|
|
||||||
: define-ffi-unions ( unions -- )
|
|
||||||
[ define-ffi-union ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-callbacks ( callbacks -- )
|
|
||||||
[ define-ffi-callback ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-interface ( interface -- word )
|
|
||||||
c-type>> create-in [ void swap typedef ] keep ;
|
|
||||||
|
|
||||||
: define-ffi-interfaces ( interfaces -- )
|
|
||||||
[ define-ffi-interface ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-interface-content ( interface -- )
|
|
||||||
{
|
|
||||||
[ methods>> define-ffi-functions ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: define-ffi-interfaces-content ( interfaces -- )
|
|
||||||
[ define-ffi-interface-content ] each ;
|
|
||||||
|
|
||||||
: get-type-invoker ( name -- quot )
|
|
||||||
! hack
|
|
||||||
[ "GType" "glib.ffi" lookup current-lib get-global ] dip
|
|
||||||
{ } \ alien-invoke 5 narray >quotation ;
|
|
||||||
|
|
||||||
: define-ffi-class ( class -- word )
|
|
||||||
c-type>> create-in [ void swap typedef ] keep ;
|
|
||||||
|
|
||||||
: define-ffi-classes ( class -- )
|
|
||||||
[ define-ffi-class ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-class-content ( class -- )
|
|
||||||
{
|
|
||||||
[ constructors>> define-ffi-functions ]
|
|
||||||
[ functions>> define-ffi-functions ]
|
|
||||||
[ methods>> define-ffi-functions ]
|
|
||||||
[ signals>> define-ffi-signals ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: define-ffi-classes-content ( class -- )
|
|
||||||
[ define-ffi-class-content ] each ;
|
|
||||||
|
|
||||||
: define-get-type ( node -- word )
|
|
||||||
get-type>> dup { "intern" f } member? [ drop f ]
|
|
||||||
[
|
[
|
||||||
[ create-in dup ] [ get-type-invoker ] bi
|
[ drop ] ! [ writable?>> [ read-only , ] unless ]
|
||||||
{ } { "type" } <effect> define-declared
|
[ bits>> [ bits: , , ] when* ] bi
|
||||||
] if ;
|
] V{ } make
|
||||||
|
] tri <struct-slot-spec> ;
|
||||||
|
|
||||||
: define-get-types ( namespace -- )
|
: def-record-type ( record -- )
|
||||||
|
dup c-type>> implement-structs get-global member?
|
||||||
|
[
|
||||||
|
[ c-type>> create-class-in ]
|
||||||
|
[ fields>> [ field>struct-slot ] map ] bi
|
||||||
|
define-struct-class
|
||||||
|
] [ c-type>> void def-c-type ] if ;
|
||||||
|
|
||||||
|
: def-record ( record -- )
|
||||||
{
|
{
|
||||||
[ enums>> [ define-get-type drop ] each ]
|
[ def-record-type ]
|
||||||
[ bitfields>> [ define-get-type drop ] each ]
|
[ constructors>> def-functions ]
|
||||||
[ records>> [ define-get-type drop ] each ]
|
[ functions>> def-functions ]
|
||||||
[ unions>> [ define-get-type drop ] each ]
|
[ [ methods>> ] keep def-methods ]
|
||||||
[ interfaces>> [ define-get-type drop ] each ]
|
|
||||||
[ classes>> [ define-get-type drop ] each ]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: define-ffi-const ( const -- word )
|
: def-union-type ( union -- )
|
||||||
[ c-identifier>> create-in dup ] [ const-value ] bi
|
c-type>> void def-c-type ;
|
||||||
define-constant ;
|
|
||||||
|
|
||||||
: define-ffi-consts ( consts -- )
|
: def-union ( union -- )
|
||||||
[ define-ffi-const ] define-each ;
|
|
||||||
|
|
||||||
: define-ffi-alias ( alias -- )
|
|
||||||
drop ;
|
|
||||||
|
|
||||||
: define-ffi-aliases ( aliases -- )
|
|
||||||
[ define-ffi-alias ] each ;
|
|
||||||
|
|
||||||
: define-ffi-namespace ( namespace -- )
|
|
||||||
{
|
{
|
||||||
[ aliases>> define-ffi-aliases ]
|
[ def-union-type ]
|
||||||
[ consts>> define-ffi-consts ]
|
[ constructors>> def-functions ]
|
||||||
[ enums>> define-ffi-enums ]
|
[ functions>> def-functions ]
|
||||||
[ bitfields>> define-ffi-bitfields ]
|
[ [ methods>> ] keep def-methods ]
|
||||||
|
|
||||||
[ records>> define-ffi-records-defer ]
|
|
||||||
|
|
||||||
[ unions>> define-ffi-unions ]
|
|
||||||
[ interfaces>> define-ffi-interfaces ]
|
|
||||||
[ classes>> define-ffi-classes ]
|
|
||||||
[ callbacks>> define-ffi-callbacks ]
|
|
||||||
[ records>> define-ffi-records ]
|
|
||||||
|
|
||||||
[ records>> define-ffi-records-content ]
|
|
||||||
[ classes>> define-ffi-classes-content ]
|
|
||||||
[ interfaces>> define-ffi-interfaces-content ]
|
|
||||||
[ functions>> define-ffi-functions ]
|
|
||||||
|
|
||||||
[ define-get-types ]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: define-ffi-repository ( repository -- )
|
: def-boxed-type ( boxed -- )
|
||||||
namespace>> define-ffi-namespace ;
|
c-type>> void def-c-type ;
|
||||||
|
|
||||||
|
: signal-name ( signal type -- name )
|
||||||
|
swap [ c-type>> ] [ name>> ] bi* ":" glue ;
|
||||||
|
|
||||||
|
: user-data-parameter ( -- parameter )
|
||||||
|
parameter new
|
||||||
|
"user_data" >>name
|
||||||
|
"in" >>direction
|
||||||
|
"none" >>transfer-ownership
|
||||||
|
simple-type new "gpointer" >>name >>type ;
|
||||||
|
|
||||||
|
:: def-signal ( signal type -- )
|
||||||
|
signal {
|
||||||
|
[ drop current-library get ]
|
||||||
|
[ return>> return-c-type ]
|
||||||
|
[ type signal-name ]
|
||||||
|
[
|
||||||
|
parameters>> type type>parameter prefix
|
||||||
|
user-data-parameter suffix parameter-names&types
|
||||||
|
]
|
||||||
|
} cleave make-callback-type define-inline ;
|
||||||
|
|
||||||
|
: def-signals ( signals type -- )
|
||||||
|
[ def-signal ] curry each ;
|
||||||
|
|
||||||
|
: def-class-type ( class -- )
|
||||||
|
c-type>> void def-c-type ;
|
||||||
|
|
||||||
|
: def-class ( class -- )
|
||||||
|
{
|
||||||
|
[ def-class-type ]
|
||||||
|
[ constructors>> def-functions ]
|
||||||
|
[ functions>> def-functions ]
|
||||||
|
[ [ methods>> ] keep def-methods ]
|
||||||
|
[ [ signals>> ] keep def-signals ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: def-interface-type ( interface -- )
|
||||||
|
c-type>> void def-c-type ;
|
||||||
|
|
||||||
|
: def-interface ( class -- )
|
||||||
|
{
|
||||||
|
[ def-interface-type ]
|
||||||
|
[ functions>> def-functions ]
|
||||||
|
[ [ methods>> ] keep def-methods ]
|
||||||
|
[ [ signals>> ] keep def-signals ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: 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 ;
|
||||||
|
|
||||||
|
: 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-namespace ( namespace -- )
|
||||||
|
{
|
||||||
|
[ symbol-prefixes>> first >upper constant-prefix set ]
|
||||||
|
[ consts>> def-consts ]
|
||||||
|
|
||||||
|
[ enums>> defer-enums ]
|
||||||
|
[ bitfields>> defer-bitfields ]
|
||||||
|
[ records>> defer-records ]
|
||||||
|
[ unions>> defer-unions ]
|
||||||
|
[ boxeds>> defer-boxeds ]
|
||||||
|
[ callbacks>> defer-callbacks ]
|
||||||
|
[ interfaces>> defer-interfaces ]
|
||||||
|
[ classes>> defer-classes ]
|
||||||
|
|
||||||
|
[ aliases>> def-aliases ]
|
||||||
|
|
||||||
|
[ enums>> def-enums ]
|
||||||
|
[ bitfields>> def-bitfields ]
|
||||||
|
[ records>> def-records ]
|
||||||
|
[ unions>> def-unions ]
|
||||||
|
[ boxeds>> def-boxeds ]
|
||||||
|
[ callbacks>> def-callbacks ]
|
||||||
|
[ interfaces>> def-interfaces ]
|
||||||
|
[ classes>> def-classes ]
|
||||||
|
|
||||||
|
[ functions>> def-functions ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: def-ffi-repository ( repository -- )
|
||||||
|
namespace>> def-namespace ;
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators gobject-introspection.common
|
USING: accessors combinators gobject-introspection.common
|
||||||
gobject-introspection.ffi gobject-introspection.loader kernel lexer
|
gobject-introspection.ffi gobject-introspection.loader
|
||||||
locals math namespaces sequences strings.parser vocabs.parser xml ;
|
gobject-introspection.types kernel lexer locals namespaces parser
|
||||||
|
sequences xml ;
|
||||||
IN: gobject-introspection
|
IN: gobject-introspection
|
||||||
|
|
||||||
: with-child-vocab ( name quot -- )
|
<PRIVATE
|
||||||
swap current-vocab name>>
|
|
||||||
[ swap "." glue set-current-vocab call ] keep
|
|
||||||
set-current-vocab ; inline
|
|
||||||
|
|
||||||
:: define-gir-vocab ( file-name -- )
|
:: define-gir-vocab ( file-name -- )
|
||||||
file-name file>xml xml>repository
|
file-name file>xml xml>repository
|
||||||
|
|
||||||
current-vocab name>> dup ffi-vocab tail?
|
|
||||||
[ ffi-vocab length 1 + head* current-lib set-global ]
|
|
||||||
[ drop ] if ! throw the error
|
|
||||||
{
|
{
|
||||||
[ define-ffi-repository ]
|
[ namespace>> name>> current-namespace-name set-global ]
|
||||||
|
[ def-ffi-repository ]
|
||||||
} cleave
|
} cleave
|
||||||
V{ } clone implement-structs set-global
|
V{ } clone implement-structs set-global ;
|
||||||
H{ } clone replaced-c-types set-global ;
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
SYNTAX: GIR: scan define-gir-vocab ;
|
SYNTAX: GIR: scan define-gir-vocab ;
|
||||||
|
|
||||||
|
@ -28,6 +24,8 @@ SYNTAX: IMPLEMENT-STRUCTS:
|
||||||
";" parse-tokens
|
";" parse-tokens
|
||||||
implement-structs [ swap append! ] change-global ;
|
implement-structs [ swap append! ] change-global ;
|
||||||
|
|
||||||
SYNTAX: REPLACE-C-TYPE:
|
SYNTAX: FOREIGN-ENUM-TYPE:
|
||||||
scan unescape-string scan swap
|
scan-token scan-object swap register-enum-type ;
|
||||||
replaced-c-types get-global set-at ;
|
|
||||||
|
SYNTAX: FOREIGN-RECORD-TYPE:
|
||||||
|
scan-token scan-object swap register-record-type ;
|
||||||
|
|
|
@ -1,225 +1,75 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors ascii combinators fry
|
USING: accessors combinators gobject-introspection.repository kernel
|
||||||
gobject-introspection.common gobject-introspection.repository
|
literals math.parser sequences splitting xml.data xml.traversal ;
|
||||||
gobject-introspection.types literals kernel math.parser sequences
|
|
||||||
splitting xml.data xml.traversal ;
|
|
||||||
FROM: namespaces => set get ;
|
|
||||||
IN: gobject-introspection.loader
|
IN: gobject-introspection.loader
|
||||||
|
|
||||||
SYMBOL: namespace-prefix
|
: xml>simple-type ( xml -- type )
|
||||||
SYMBOL: namespace-PREFIX
|
[ simple-type new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
: word-started? ( word letter -- ? )
|
[
|
||||||
[ last letter? ] [ LETTER? ] bi* and ;
|
"type" tags-named
|
||||||
|
[ xml>simple-type ] map f like >>element-types
|
||||||
: camel>PREFIX ( name -- name' )
|
]
|
||||||
dup 1 head
|
|
||||||
[ 2dup word-started? [ [ CHAR: _ suffix ] dip ] when suffix ]
|
|
||||||
reduce rest >upper ;
|
|
||||||
|
|
||||||
: set-prefix ( prefix -- )
|
|
||||||
[ namespace-prefix set ]
|
|
||||||
[ camel>PREFIX namespace-PREFIX set ] bi ;
|
|
||||||
|
|
||||||
: camel>factor ( name -- name' )
|
|
||||||
dup 1 head
|
|
||||||
[ 2dup word-started? [ [ CHAR: - suffix ] dip ] when suffix ]
|
|
||||||
reduce rest >lower ;
|
|
||||||
|
|
||||||
: underscored>factor ( name -- name' )
|
|
||||||
[ [ CHAR: _ = not ] keep CHAR: - ? ] map >lower ;
|
|
||||||
|
|
||||||
: full-type-name>type ( name -- type )
|
|
||||||
[ type new ] dip
|
|
||||||
camel>factor "." split1 dup [ swap ] unless
|
|
||||||
[ >>namespace ] [ >>name ] bi* absolute-type ;
|
|
||||||
|
|
||||||
: node>type ( xml -- type )
|
|
||||||
"name" attr full-type-name>type ;
|
|
||||||
|
|
||||||
: xml>array-info ( xml -- array-info )
|
|
||||||
[ array-info new ] dip {
|
|
||||||
[ "zero-terminated" attr [ "1" = ] [ t ] if* >>zero-terminated? ]
|
|
||||||
[ "length" attr [ string>number ] [ f ] if* >>length ]
|
|
||||||
[ "fixed-size" attr [ string>number ] [ f ] if* >>fixed-size ]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>type ( xml -- array-info type )
|
: xml>varargs-type ( xml -- type )
|
||||||
|
drop varargs-type new ;
|
||||||
|
|
||||||
|
: xml>array-type ( xml -- type )
|
||||||
|
[ array-type new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
[ "zero-terminated" attr "0" = not >>zero-terminated? ]
|
||||||
|
[ "length" attr string>number >>length ]
|
||||||
|
[ "fixed-size" attr string>number >>fixed-size ]
|
||||||
|
[ "type" tag-named xml>simple-type >>element-type ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>inner-callback-type ( xml -- type )
|
||||||
|
[ inner-callback-type new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>type ( xml -- type )
|
||||||
dup name>> main>> {
|
dup name>> main>> {
|
||||||
{ "array"
|
{ "type" [ xml>simple-type ] }
|
||||||
[
|
{ "array"[ xml>array-type ] }
|
||||||
[ xml>array-info ]
|
{ "callback" [ xml>inner-callback-type ] }
|
||||||
[ first-child-tag node>type ] bi
|
{ "varargs" [ xml>varargs-type ] }
|
||||||
]
|
|
||||||
}
|
|
||||||
{ "type" [ node>type f swap ] }
|
|
||||||
{ "varargs" [ drop f f ] }
|
|
||||||
{ "callback" [ drop f "any" f type boa ] }
|
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
CONSTANT: type-tags {
|
CONSTANT: type-tags
|
||||||
$[ "array" <null-name> ]
|
$[ { "array" "type" "callback" "varargs" } [ <null-name> ] map ]
|
||||||
$[ "type" <null-name> ]
|
|
||||||
$[ "varargs" <null-name> ]
|
|
||||||
$[ "callback" <null-name> ]
|
|
||||||
}
|
|
||||||
|
|
||||||
: child-type-tag ( xml -- type-tag )
|
: child-type-tag ( xml -- type-tag )
|
||||||
children-tags [
|
children-tags [
|
||||||
type-tags [ swap tag-named? ] with any?
|
type-tags [ swap tag-named? ] with any?
|
||||||
] find nip ;
|
] find nip ;
|
||||||
|
|
||||||
: load-parameter ( param xml -- param )
|
: xml>alias ( xml -- alias )
|
||||||
[ "transfer-ownership" attr >>transfer-ownership ]
|
[ alias new ] dip {
|
||||||
[ child-type-tag "type" attr >>c-type ]
|
[ "name" attr >>name ]
|
||||||
[
|
[ "type" attr >>c-type ]
|
||||||
child-type-tag xml>type
|
[ child-type-tag xml>type >>type ]
|
||||||
[ [ >>array-info ] [ >>type ] bi* ] [ 2drop f ] if*
|
} cleave ;
|
||||||
] tri ;
|
|
||||||
|
: xml>const ( xml -- const )
|
||||||
|
[ const new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
[ "value" attr >>value ]
|
||||||
|
[ child-type-tag xml>type >>type ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
: load-type ( type xml -- type )
|
: load-type ( type xml -- type )
|
||||||
{
|
{
|
||||||
[ "name" attr camel>factor >>name ]
|
[ "name" attr >>name ]
|
||||||
[ node>type >>type ]
|
[ [ "type" attr ] [ "type-name" attr ] bi or >>c-type ]
|
||||||
[ "type" attr >>c-type ]
|
|
||||||
[ "type-name" attr >>type-name ]
|
|
||||||
[ "get-type" attr >>get-type ]
|
[ "get-type" attr >>get-type ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>parameter ( xml -- parameter )
|
|
||||||
[ parameter new ] dip {
|
|
||||||
[ "name" attr >>name ]
|
|
||||||
[ "direction" attr dup "in" ? >>direction ]
|
|
||||||
[ "allow-none" attr "1" = >>allow-none? ]
|
|
||||||
[ load-parameter ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: xml>return ( xml -- return )
|
|
||||||
[ return new ] dip {
|
|
||||||
[ drop "result" >>name ]
|
|
||||||
[ load-parameter ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: throws-parameter ( -- parameter )
|
|
||||||
parameter new
|
|
||||||
"error" >>name
|
|
||||||
"in" >>direction
|
|
||||||
"none" >>transfer-ownership
|
|
||||||
"GError**" >>c-type
|
|
||||||
"GLib.Error" full-type-name>type >>type ;
|
|
||||||
|
|
||||||
: extract-parameters ( xml -- parameters )
|
|
||||||
"parameters" tag-named "parameter" tags-named
|
|
||||||
[ xml>parameter ] map ;
|
|
||||||
|
|
||||||
: load-parameters ( callable xml -- callable )
|
|
||||||
[
|
|
||||||
[
|
|
||||||
extract-parameters
|
|
||||||
dup { f } tail? [ but-last [ t >>varargs? ] dip ] when
|
|
||||||
]
|
|
||||||
[ "throws" attr "1" = [ throws-parameter suffix ] when ] bi
|
|
||||||
>>parameters
|
|
||||||
]
|
|
||||||
[ "return-value" tag-named xml>return >>return ] bi ;
|
|
||||||
|
|
||||||
: xml>function ( xml -- function )
|
|
||||||
[ function new ] dip {
|
|
||||||
[ "name" attr underscored>factor >>name ]
|
|
||||||
[ "identifier" attr >>identifier ]
|
|
||||||
[ load-parameters ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: (type>param) ( type -- param )
|
|
||||||
[ parameter new ] dip
|
|
||||||
[ c-type>> CHAR: * suffix >>c-type ] [ type>> >>type ] bi
|
|
||||||
"none" >>transfer-ownership
|
|
||||||
"in" >>direction ;
|
|
||||||
|
|
||||||
: type>self-param ( type -- self )
|
|
||||||
(type>param) "self" >>name ;
|
|
||||||
|
|
||||||
: type>sender-param ( type -- sender )
|
|
||||||
(type>param) "sender" >>name ;
|
|
||||||
|
|
||||||
: signal-data-param ( -- param )
|
|
||||||
parameter new
|
|
||||||
"user_data" >>name
|
|
||||||
"gpointer" >>c-type
|
|
||||||
type new "any" >>name >>type
|
|
||||||
"none" >>transfer-ownership
|
|
||||||
"in" >>direction ;
|
|
||||||
|
|
||||||
: xml>property ( xml -- property )
|
|
||||||
[ property new ] dip {
|
|
||||||
[ "name" attr >>name ]
|
|
||||||
[ "writable" attr "1" = >>writable? ]
|
|
||||||
[ "readable" attr "0" = not >>readable? ]
|
|
||||||
[ "construct" attr "1" = >>construct? ]
|
|
||||||
[ "construct-only" attr "1" = >>construct-only? ]
|
|
||||||
[ child-type-tag xml>type nip >>type ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: xml>callback ( xml -- callback )
|
|
||||||
[ callback new ] dip {
|
|
||||||
[ load-type ]
|
|
||||||
[ load-parameters ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: xml>signal ( xml -- signal )
|
|
||||||
[ signal new ] dip {
|
|
||||||
[ "name" attr camel>factor >>name ]
|
|
||||||
[ node>type >>type ]
|
|
||||||
[ "type" attr >>c-type ]
|
|
||||||
[
|
|
||||||
load-parameters
|
|
||||||
[ signal-data-param suffix ] change-parameters
|
|
||||||
]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: load-functions ( xml tag-name -- functions )
|
|
||||||
tags-named [ xml>function ] map ;
|
|
||||||
|
|
||||||
: xml>class ( xml -- class )
|
|
||||||
[ class new ] dip {
|
|
||||||
[ load-type ]
|
|
||||||
[ "abstract" attr "1" = >>abstract? ]
|
|
||||||
[
|
|
||||||
"parent" attr [ full-type-name>type ] [ f ] if*
|
|
||||||
>>parent
|
|
||||||
]
|
|
||||||
[ "type-struct" attr >>type-struct ]
|
|
||||||
[ "constructor" load-functions >>constructors ]
|
|
||||||
[ "function" load-functions >>functions ]
|
|
||||||
[
|
|
||||||
"method" load-functions over type>self-param
|
|
||||||
'[ [ _ prefix ] change-parameters ] map
|
|
||||||
>>methods
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"signal" tags-named [ xml>signal ] map
|
|
||||||
over type>sender-param
|
|
||||||
'[ [ _ prefix ] change-parameters ] map
|
|
||||||
over c-type>> CHAR: : suffix
|
|
||||||
'[ dup name>> _ prepend >>c-type ] map
|
|
||||||
>>signals
|
|
||||||
]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: xml>interface ( xml -- interface )
|
|
||||||
[ interface new ] dip {
|
|
||||||
[ load-type ]
|
|
||||||
[
|
|
||||||
"method" load-functions over type>self-param
|
|
||||||
'[ [ _ prefix ] change-parameters ] map
|
|
||||||
>>methods
|
|
||||||
]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: xml>member ( xml -- member )
|
: xml>member ( xml -- member )
|
||||||
[ enum-member new ] dip {
|
[ enum-member new ] dip {
|
||||||
[ "name" attr underscored>factor >>name ]
|
[ "name" attr >>name ]
|
||||||
[ "identifier" attr >>c-identifier ]
|
[ "identifier" attr >>c-identifier ]
|
||||||
[ "value" attr string>number >>value ]
|
[ "value" attr string>number >>value ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
@ -230,78 +80,135 @@ CONSTANT: type-tags {
|
||||||
[ "member" tags-named [ xml>member ] map >>members ]
|
[ "member" tags-named [ xml>member ] map >>members ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
|
: load-parameter ( param xml -- param )
|
||||||
|
[ child-type-tag xml>type >>type ]
|
||||||
|
[ "transfer-ownership" attr >>transfer-ownership ] bi ;
|
||||||
|
|
||||||
|
: xml>parameter ( xml -- parameter )
|
||||||
|
[ parameter new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
[ "direction" attr dup "in" ? >>direction ]
|
||||||
|
[ "allow-none" attr "1" = >>allow-none? ]
|
||||||
|
[ child-type-tag xml>type >>type ]
|
||||||
|
[ "transfer-ownership" attr >>transfer-ownership ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>return ( xml -- return )
|
||||||
|
[ return new ] dip {
|
||||||
|
[ child-type-tag xml>type >>type ]
|
||||||
|
[ "transfer-ownership" attr >>transfer-ownership ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: load-callable ( callable xml -- callable )
|
||||||
|
[ "return-value" tag-named xml>return >>return ]
|
||||||
|
[
|
||||||
|
"parameters" tag-named "parameter" tags-named
|
||||||
|
[ xml>parameter ] map >>parameters
|
||||||
|
] bi ;
|
||||||
|
|
||||||
|
: xml>function ( xml -- function )
|
||||||
|
[ function new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
[ "identifier" attr >>identifier ]
|
||||||
|
[ load-callable ]
|
||||||
|
[ "throws" attr "1" = >>throws? ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: load-functions ( xml tag-name -- functions )
|
||||||
|
tags-named [ xml>function ] map ;
|
||||||
|
|
||||||
: xml>field ( xml -- field )
|
: xml>field ( xml -- field )
|
||||||
[ field new ] dip {
|
[ field new ] dip {
|
||||||
[ "name" attr >>name ]
|
[ "name" attr >>name ]
|
||||||
[ "writable" attr "1" = >>writable? ]
|
[ "writable" attr "1" = >>writable? ]
|
||||||
[
|
[ "bits" attr string>number >>bits ]
|
||||||
child-type-tag dup name>> main>> "callback" =
|
[ child-type-tag xml>type >>type ]
|
||||||
[ drop "gpointer" ] [ "type" attr ] if
|
|
||||||
>>c-type
|
|
||||||
]
|
|
||||||
[
|
|
||||||
child-type-tag xml>type
|
|
||||||
[ [ >>array-info ] [ >>type ] bi* ] [ 2drop f ] if*
|
|
||||||
]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>record ( xml -- record )
|
: xml>record ( xml -- record )
|
||||||
[ record new ] dip {
|
[ record new ] dip {
|
||||||
[ load-type ]
|
[ load-type ]
|
||||||
[ "disguised" attr "1" = >>disguised? ]
|
|
||||||
[ "field" tags-named [ xml>field ] map >>fields ]
|
[ "field" tags-named [ xml>field ] map >>fields ]
|
||||||
[ "constructor" load-functions >>constructors ]
|
[ "constructor" load-functions >>constructors ]
|
||||||
|
[ "method" load-functions >>methods ]
|
||||||
[ "function" load-functions >>functions ]
|
[ "function" load-functions >>functions ]
|
||||||
[
|
[ "disguised" attr "1" = >>disguised? ]
|
||||||
"method" load-functions over type>self-param
|
|
||||||
'[ [ _ prefix ] change-parameters ] map
|
|
||||||
>>methods
|
|
||||||
]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>union ( xml -- union )
|
: xml>union ( xml -- union )
|
||||||
[ union new ] dip load-type ;
|
[ union new ] dip {
|
||||||
|
[ load-type ]
|
||||||
: xml>alias ( xml -- alias )
|
[ "field" tags-named [ xml>field ] map >>fields ]
|
||||||
[ alias new ] dip {
|
[ "constructor" load-functions >>constructors ]
|
||||||
[ node>type >>name ]
|
[ "method" load-functions >>methods ]
|
||||||
[ "target" attr full-type-name>type >>target ]
|
[ "function" load-functions >>functions ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>const ( xml -- const )
|
: xml>callback ( xml -- callback )
|
||||||
[ const new ] dip {
|
[ callback new ] dip {
|
||||||
|
[ load-type ]
|
||||||
|
[ load-callable ]
|
||||||
|
[ "throws" attr "1" = >>throws? ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>signal ( xml -- signal )
|
||||||
|
[ signal new ] dip {
|
||||||
[ "name" attr >>name ]
|
[ "name" attr >>name ]
|
||||||
[
|
[ load-callable ]
|
||||||
"name" attr namespace-PREFIX get swap "_" glue
|
|
||||||
>>c-identifier
|
|
||||||
]
|
|
||||||
[ "value" attr >>value ]
|
|
||||||
[ child-type-tag "type" attr >>c-type ]
|
|
||||||
[ child-type-tag xml>type nip >>type ]
|
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>property ( xml -- property )
|
||||||
|
[ property new ] dip {
|
||||||
|
[ "name" attr >>name ]
|
||||||
|
[ "writable" attr "1" = >>writable? ]
|
||||||
|
[ "readable" attr "0" = not >>readable? ]
|
||||||
|
[ "construct" attr "1" = >>construct? ]
|
||||||
|
[ "construct-only" attr "1" = >>construct-only? ]
|
||||||
|
[ child-type-tag xml>type >>type ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>class ( xml -- class )
|
||||||
|
[ class new ] dip {
|
||||||
|
[ load-type ]
|
||||||
|
[ "abstract" attr "1" = >>abstract? ]
|
||||||
|
[ "parent" attr >>parent ]
|
||||||
|
[ "type-struct" attr >>type-struct ]
|
||||||
|
[ "constructor" load-functions >>constructors ]
|
||||||
|
[ "method" load-functions >>methods ]
|
||||||
|
[ "function" load-functions >>functions ]
|
||||||
|
[ "signal" tags-named [ xml>signal ] map >>signals ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>interface ( xml -- interface )
|
||||||
|
[ interface new ] dip {
|
||||||
|
[ load-type ]
|
||||||
|
[ "method" load-functions >>methods ]
|
||||||
|
[ "function" load-functions >>functions ]
|
||||||
|
[ "signal" tags-named [ xml>signal ] map >>signals ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: xml>boxed ( xml -- boxed )
|
||||||
|
[ boxed new ] dip
|
||||||
|
load-type ;
|
||||||
|
|
||||||
: xml>namespace ( xml -- namespace )
|
: xml>namespace ( xml -- namespace )
|
||||||
[ namespace new ] dip {
|
[ namespace new ] dip {
|
||||||
[ "name" attr camel>factor >>name ]
|
[ "name" attr >>name ]
|
||||||
[ "prefix" attr [ set-prefix ] keep >>prefix ]
|
[ "identifier-prefixes" attr "," split >>identifier-prefixes ]
|
||||||
|
[ "symbol-prefixes" attr "," split >>symbol-prefixes ]
|
||||||
[ "alias" tags-named [ xml>alias ] map >>aliases ]
|
[ "alias" tags-named [ xml>alias ] map >>aliases ]
|
||||||
[ "record" tags-named [ xml>record ] map >>records ]
|
|
||||||
[ "union" tags-named [ xml>union ] map >>unions ]
|
|
||||||
[ "callback" tags-named [ xml>callback ] map >>callbacks ]
|
|
||||||
[ "interface" tags-named [ xml>interface ] map >>interfaces ]
|
|
||||||
[ "class" tags-named [ xml>class ] map >>classes ]
|
|
||||||
[ "constant" tags-named [ xml>const ] map >>consts ]
|
[ "constant" tags-named [ xml>const ] map >>consts ]
|
||||||
[ "enumeration" tags-named [ xml>enum ] map >>enums ]
|
[ "enumeration" tags-named [ xml>enum ] map >>enums ]
|
||||||
[ "bitfield" tags-named [ xml>enum ] map >>bitfields ]
|
[ "bitfield" tags-named [ xml>enum ] map >>bitfields ]
|
||||||
|
[ "record" tags-named [ xml>record ] map >>records ]
|
||||||
|
[ "union" tags-named [ xml>union ] map >>unions ]
|
||||||
|
[ "boxed" tags-named [ xml>boxed ] map >>boxeds ]
|
||||||
|
[ "callback" tags-named [ xml>callback ] map >>callbacks ]
|
||||||
|
[ "class" tags-named [ xml>class ] map >>classes ]
|
||||||
|
[ "interface" tags-named [ xml>interface ] map >>interfaces ]
|
||||||
[ "function" load-functions >>functions ]
|
[ "function" load-functions >>functions ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: xml>repository ( xml -- repository )
|
: xml>repository ( xml -- repository )
|
||||||
[ repository new ] dip {
|
[ repository new ] dip
|
||||||
[
|
"namespace" tag-named xml>namespace >>namespace ;
|
||||||
"" "include" f <name> tags-named
|
|
||||||
[ "name" attr camel>factor ] map >>includes
|
|
||||||
]
|
|
||||||
[ "namespace" tag-named xml>namespace >>namespace ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
|
|
|
@ -1,64 +1,134 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: ;
|
USING: ;
|
||||||
IN: gobject-introspection.repository
|
IN: gobject-introspection.repository
|
||||||
|
|
||||||
TUPLE: node name ;
|
TUPLE: repository
|
||||||
|
namespace ;
|
||||||
|
|
||||||
TUPLE: repository includes namespace ;
|
TUPLE: namespace
|
||||||
|
name
|
||||||
|
identifier-prefixes
|
||||||
|
symbol-prefixes
|
||||||
|
aliases
|
||||||
|
consts
|
||||||
|
enums
|
||||||
|
bitfields
|
||||||
|
records
|
||||||
|
unions
|
||||||
|
boxeds
|
||||||
|
callbacks
|
||||||
|
classes
|
||||||
|
interfaces
|
||||||
|
functions ;
|
||||||
|
|
||||||
TUPLE: namespace < node
|
TUPLE: data-type
|
||||||
prefix aliases consts classes interfaces records unions callbacks
|
name ;
|
||||||
enums bitfields functions ;
|
|
||||||
|
|
||||||
TUPLE: alias < node target ;
|
TUPLE: simple-type < data-type
|
||||||
|
element-types ;
|
||||||
|
|
||||||
TUPLE: typed < node type c-type ;
|
TUPLE: array-type < data-type
|
||||||
|
zero-terminated?
|
||||||
|
fixed-size
|
||||||
|
length
|
||||||
|
element-type ;
|
||||||
|
|
||||||
TUPLE: const < typed
|
TUPLE: inner-callback-type < data-type ;
|
||||||
value c-identifier ffi ;
|
|
||||||
|
|
||||||
TUPLE: type-node < node
|
TUPLE: varargs-type < data-type ;
|
||||||
type c-type type-name get-type ffi ;
|
|
||||||
|
|
||||||
TUPLE: field < typed
|
TUPLE: alias
|
||||||
writable? length? array-info ;
|
name
|
||||||
|
c-type
|
||||||
|
type ;
|
||||||
|
|
||||||
TUPLE: record < type-node
|
TUPLE: const
|
||||||
fields constructors methods functions disguised? ;
|
name
|
||||||
|
value
|
||||||
|
type ;
|
||||||
|
|
||||||
TUPLE: union < type-node ;
|
TUPLE: type
|
||||||
|
name
|
||||||
|
c-type
|
||||||
|
get-type ;
|
||||||
|
|
||||||
TUPLE: class < record
|
TUPLE: enum-member
|
||||||
abstract? parent type-struct signals ;
|
name
|
||||||
|
value
|
||||||
|
c-identifier ;
|
||||||
|
|
||||||
TUPLE: interface < type-node
|
TUPLE: enum < type
|
||||||
methods ;
|
members ;
|
||||||
|
|
||||||
TUPLE: property < type-node
|
TUPLE: record < type
|
||||||
readable? writable? construct? construct-only? ;
|
fields
|
||||||
|
constructors
|
||||||
|
methods
|
||||||
|
functions
|
||||||
|
disguised? ;
|
||||||
|
|
||||||
TUPLE: callable < type-node
|
TUPLE: field
|
||||||
return parameters varargs? ;
|
name
|
||||||
|
writable?
|
||||||
|
bits
|
||||||
|
type ;
|
||||||
|
|
||||||
TUPLE: function < callable identifier ;
|
TUPLE: union < type
|
||||||
|
fields
|
||||||
|
constructors
|
||||||
|
methods
|
||||||
|
functions ;
|
||||||
|
|
||||||
TUPLE: callback < type-node return parameters varargs? ;
|
TUPLE: return
|
||||||
|
type
|
||||||
|
transfer-ownership ;
|
||||||
|
|
||||||
TUPLE: signal < callback ;
|
TUPLE: parameter
|
||||||
|
name
|
||||||
|
type
|
||||||
|
direction
|
||||||
|
allow-none?
|
||||||
|
transfer-ownership ;
|
||||||
|
|
||||||
TUPLE: parameter < typed
|
TUPLE: function
|
||||||
direction allow-none? length? transfer-ownership array-info
|
name
|
||||||
local ;
|
identifier
|
||||||
|
return
|
||||||
|
parameters
|
||||||
|
throws? ;
|
||||||
|
|
||||||
TUPLE: return < typed
|
TUPLE: callback < type
|
||||||
transfer-ownership array-info local ;
|
return
|
||||||
|
parameters
|
||||||
|
throws? ;
|
||||||
|
|
||||||
TUPLE: type name namespace ;
|
TUPLE: class < type
|
||||||
|
abstract?
|
||||||
|
parent
|
||||||
|
type-struct
|
||||||
|
constructors
|
||||||
|
methods
|
||||||
|
functions
|
||||||
|
signals ;
|
||||||
|
|
||||||
TUPLE: array-info zero-terminated? fixed-size length ;
|
TUPLE: interface < type
|
||||||
|
constructors
|
||||||
|
methods
|
||||||
|
functions
|
||||||
|
signals ;
|
||||||
|
|
||||||
TUPLE: enum-member < node value c-identifier ;
|
TUPLE: boxed < type ;
|
||||||
|
|
||||||
TUPLE: enum < type-node members ;
|
TUPLE: signal
|
||||||
|
name
|
||||||
|
return
|
||||||
|
parameters ;
|
||||||
|
|
||||||
|
TUPLE: property
|
||||||
|
name
|
||||||
|
readable?
|
||||||
|
writable?
|
||||||
|
construct?
|
||||||
|
construct-only?
|
||||||
|
type ;
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: accessors alien.c-types alien.syntax
|
||||||
|
classes.struct gobject-introspection.types kernel parser ;
|
||||||
|
IN: gobject-introspection.standard-types
|
||||||
|
|
||||||
|
<<
|
||||||
|
TYPEDEF: char gchar
|
||||||
|
TYPEDEF: uchar guchar
|
||||||
|
TYPEDEF: short gshort
|
||||||
|
TYPEDEF: ushort gushort
|
||||||
|
TYPEDEF: long glong
|
||||||
|
TYPEDEF: ulong gulong
|
||||||
|
TYPEDEF: int gint
|
||||||
|
TYPEDEF: uint guint
|
||||||
|
|
||||||
|
TYPEDEF: char gint8
|
||||||
|
TYPEDEF: uchar guint8
|
||||||
|
TYPEDEF: short gint16
|
||||||
|
TYPEDEF: ushort guint16
|
||||||
|
TYPEDEF: int gint32
|
||||||
|
TYPEDEF: uint guint32
|
||||||
|
TYPEDEF: longlong gint64
|
||||||
|
TYPEDEF: ulonglong guint64
|
||||||
|
|
||||||
|
TYPEDEF: float gfloat
|
||||||
|
TYPEDEF: double gdouble
|
||||||
|
|
||||||
|
TYPEDEF: gulong GType
|
||||||
|
TYPEDEF: void* gpointer
|
||||||
|
TYPEDEF: guint32 gunichar
|
||||||
|
TYPEDEF: void* va_list
|
||||||
|
|
||||||
|
int c-type clone
|
||||||
|
[ >c-bool ] >>unboxer-quot
|
||||||
|
[ c-bool> ] >>boxer-quot
|
||||||
|
object >>boxed-class
|
||||||
|
"gboolean" create-in typedef
|
||||||
|
|
||||||
|
STRUCT: longdouble { data char[10] } ;
|
||||||
|
>>
|
||||||
|
|
||||||
|
gchar "gchar" register-standard-type
|
||||||
|
guchar "guchar" register-standard-type
|
||||||
|
gshort "gshort" register-standard-type
|
||||||
|
gushort "gushort" register-standard-type
|
||||||
|
glong "glong" register-standard-type
|
||||||
|
gulong "gulong" register-standard-type
|
||||||
|
gint "gint" register-standard-type
|
||||||
|
guint "guint" register-standard-type
|
||||||
|
|
||||||
|
gint8 "gint8" register-standard-type
|
||||||
|
guint8 "guint8" register-standard-type
|
||||||
|
gint16 "gint16" register-standard-type
|
||||||
|
guint16 "guint16" register-standard-type
|
||||||
|
gint32 "gint32" register-standard-type
|
||||||
|
guint32 "guint32" register-standard-type
|
||||||
|
gint64 "gint64" register-standard-type
|
||||||
|
guint64 "guint64" register-standard-type
|
||||||
|
|
||||||
|
gfloat "gfloat" register-standard-type
|
||||||
|
gdouble "gdouble" register-standard-type
|
||||||
|
|
||||||
|
GType "GType" register-standard-type
|
||||||
|
gpointer "gpointer" register-standard-type
|
||||||
|
gunichar "gunichar" register-standard-type
|
||||||
|
va_list "va_list" register-standard-type
|
||||||
|
|
||||||
|
gboolean "gboolean" register-standard-type
|
||||||
|
pointer: gchar "utf8" register-standard-type
|
||||||
|
longdouble "long double" register-standard-type
|
|
@ -1,138 +1,112 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types assocs
|
USING: accessors alien.c-types assocs combinators.short-circuit
|
||||||
combinators.short-circuit gobject-introspection.common
|
gobject-introspection.common gobject-introspection.repository kernel
|
||||||
gobject-introspection.repository kernel namespaces
|
locals namespaces parser sequences sets ;
|
||||||
specialized-arrays ;
|
|
||||||
IN: gobject-introspection.types
|
IN: gobject-introspection.types
|
||||||
|
|
||||||
TUPLE: gwrapper { underlying alien } ;
|
SYMBOL: type-infos
|
||||||
TUPLE: grecord < gwrapper ;
|
type-infos [ H{ } ] initialize
|
||||||
TUPLE: gobject < gwrapper ;
|
|
||||||
|
|
||||||
SPECIALIZED-ARRAYS:
|
SYMBOL: standard-types
|
||||||
void* bool int uint char uchar short ushort long ulong
|
standard-types [ V{ } ] initialize
|
||||||
longlong ulonglong float double ;
|
|
||||||
|
|
||||||
CONSTANT: simple-types H{
|
TUPLE: type-info c-type ;
|
||||||
{ "any" {
|
|
||||||
void* *void* >void*-array <direct-void*-array>
|
|
||||||
} }
|
|
||||||
{ "boolean" {
|
|
||||||
bool *bool >bool-array <direct-bool-array>
|
|
||||||
} }
|
|
||||||
{ "int" {
|
|
||||||
int *int >int-array <direct-int-array>
|
|
||||||
} }
|
|
||||||
{ "uint" {
|
|
||||||
uint *uint >uint-array <direct-uint-array>
|
|
||||||
} }
|
|
||||||
{ "int8" {
|
|
||||||
char *char >char-array <direct-char-array>
|
|
||||||
} }
|
|
||||||
{ "uint8" {
|
|
||||||
uchar *uchar >uchar-array <direct-uchar-array>
|
|
||||||
} }
|
|
||||||
{ "int16" {
|
|
||||||
short *short >short-array <direct-short-array>
|
|
||||||
} }
|
|
||||||
{ "uint16" {
|
|
||||||
ushort *ushort >ushort-array <direct-ushort-array>
|
|
||||||
} }
|
|
||||||
{ "int32" {
|
|
||||||
int *int >int-array <direct-int-array>
|
|
||||||
} }
|
|
||||||
{ "uint32" {
|
|
||||||
uint *uint >uint-array <direct-uint-array>
|
|
||||||
} }
|
|
||||||
{ "int64" {
|
|
||||||
longlong *longlong
|
|
||||||
>longlong-array <direct-longlong-array>
|
|
||||||
} }
|
|
||||||
{ "uint64" {
|
|
||||||
ulonglong *ulonglong
|
|
||||||
>ulonglong-array <direct-ulonglong-array>
|
|
||||||
} }
|
|
||||||
{ "long" {
|
|
||||||
long *long >long-array <direct-long-array>
|
|
||||||
} }
|
|
||||||
{ "ulong" {
|
|
||||||
ulong *ulong >ulong-array <direct-ulong-array>
|
|
||||||
} }
|
|
||||||
{ "float" {
|
|
||||||
float *float >float-array <direct-float-array>
|
|
||||||
} }
|
|
||||||
{ "double" {
|
|
||||||
double *double >double-array <direct-double-array>
|
|
||||||
} }
|
|
||||||
{ "size_t" {
|
|
||||||
ulong *ulong >ulong-array <direct-ulong-array>
|
|
||||||
} }
|
|
||||||
{ "ssize_t" {
|
|
||||||
long *long >long-array <direct-long-array>
|
|
||||||
} }
|
|
||||||
{ "time_t" {
|
|
||||||
long *long >long-array <direct-long-array>
|
|
||||||
} }
|
|
||||||
{ "gtype" {
|
|
||||||
ulong *ulong >ulong-array <direct-ulong-array>
|
|
||||||
} }
|
|
||||||
}
|
|
||||||
|
|
||||||
TUPLE: type-info c-type-word type-word ;
|
|
||||||
|
|
||||||
|
TUPLE: atomic-info < type-info ;
|
||||||
TUPLE: enum-info < type-info ;
|
TUPLE: enum-info < type-info ;
|
||||||
|
|
||||||
TUPLE: bitfield-info < type-info ;
|
TUPLE: bitfield-info < type-info ;
|
||||||
|
|
||||||
TUPLE: record-info < type-info ;
|
TUPLE: record-info < type-info ;
|
||||||
|
|
||||||
TUPLE: union-info < type-info ;
|
TUPLE: union-info < type-info ;
|
||||||
|
TUPLE: boxed-info < type-info ;
|
||||||
TUPLE: callback-info < type-info ;
|
TUPLE: callback-info < type-info ;
|
||||||
|
|
||||||
TUPLE: class-info < type-info ;
|
TUPLE: class-info < type-info ;
|
||||||
|
|
||||||
TUPLE: interface-info < type-info ;
|
TUPLE: interface-info < type-info ;
|
||||||
|
|
||||||
: aliased-type ( alias -- type )
|
DEFER: find-type-info
|
||||||
aliases get ?at [ aliased-type ] when ;
|
|
||||||
|
|
||||||
: get-type-info ( type -- info )
|
PREDICATE: none-type < simple-type
|
||||||
aliased-type type-infos get at ;
|
name>> "none" = ;
|
||||||
|
|
||||||
PREDICATE: none-type < type
|
PREDICATE: atomic-type < simple-type
|
||||||
[ namespace>> not ] [ name>> "none" = ] bi and ;
|
find-type-info atomic-info? ;
|
||||||
|
|
||||||
PREDICATE: simple-type < type
|
PREDICATE: utf8-type < atomic-type
|
||||||
aliased-type
|
name>> "utf8" = ;
|
||||||
[ namespace>> not ] [ name>> simple-types key? ] bi and ;
|
|
||||||
|
|
||||||
PREDICATE: utf8-type < type
|
PREDICATE: enum-type < simple-type
|
||||||
aliased-type
|
find-type-info enum-info? ;
|
||||||
[ namespace>> not ] [ name>> "utf8" = ] bi and ;
|
|
||||||
|
|
||||||
PREDICATE: any-type < type
|
PREDICATE: bitfield-type < simple-type
|
||||||
aliased-type
|
find-type-info bitfield-info? ;
|
||||||
[ namespace>> not ] [ name>> "any" = ] bi and ;
|
|
||||||
|
|
||||||
PREDICATE: enum-type < type get-type-info enum-info? ;
|
PREDICATE: record-type < simple-type
|
||||||
|
find-type-info record-info? ;
|
||||||
|
|
||||||
PREDICATE: bitfield-type < type get-type-info bitfield-info? ;
|
PREDICATE: union-type < simple-type
|
||||||
|
find-type-info union-info? ;
|
||||||
|
|
||||||
PREDICATE: record-type < type get-type-info record-info? ;
|
PREDICATE: boxed-type < simple-type
|
||||||
|
find-type-info boxed-info? ;
|
||||||
|
|
||||||
PREDICATE: union-type < type get-type-info union-info? ;
|
PREDICATE: callback-type < simple-type
|
||||||
|
find-type-info callback-info? ;
|
||||||
|
|
||||||
PREDICATE: callback-type < type get-type-info callback-info? ;
|
PREDICATE: class-type < simple-type
|
||||||
|
find-type-info class-info? ;
|
||||||
|
|
||||||
PREDICATE: class-type < type get-type-info class-info? ;
|
PREDICATE: interface-type < simple-type
|
||||||
|
find-type-info interface-info? ;
|
||||||
|
|
||||||
PREDICATE: interface-type < type get-type-info interface-info? ;
|
PREDICATE: boxed-array-type < array-type name>> >boolean ;
|
||||||
|
PREDICATE: c-array-type < array-type name>> not ;
|
||||||
|
PREDICATE: fixed-size-array-type < c-array-type fixed-size>> >boolean ;
|
||||||
|
|
||||||
: absolute-type ( type -- type' )
|
: standard-type? ( data-type -- ? )
|
||||||
dup {
|
name>> standard-types get-global in? ;
|
||||||
[ namespace>> ] [ simple-type? ]
|
|
||||||
[ utf8-type? ] [ none-type? ]
|
|
||||||
} 1|| [ current-lib get-global >>namespace ] unless ;
|
|
||||||
|
|
||||||
|
: qualified-name ( name -- qualified-name )
|
||||||
|
current-namespace-name get-global swap "." glue ;
|
||||||
|
|
||||||
|
: qualified-type-name ( data-type -- name )
|
||||||
|
[ name>> ] keep {
|
||||||
|
[ name>> CHAR: . swap member? ]
|
||||||
|
[ none-type? ]
|
||||||
|
[ standard-type? ]
|
||||||
|
} 1|| [ qualified-name ] unless ;
|
||||||
|
|
||||||
|
ERROR: unknown-type-error type ;
|
||||||
|
|
||||||
|
: get-type-info ( data-type -- info )
|
||||||
|
qualified-type-name dup type-infos get-global at
|
||||||
|
[ ] [ unknown-type-error ] ?if ;
|
||||||
|
|
||||||
|
: find-type-info ( data-type -- info/f )
|
||||||
|
qualified-type-name type-infos get-global at ;
|
||||||
|
|
||||||
|
:: register-type ( c-type type-info name -- )
|
||||||
|
type-info c-type >>c-type name
|
||||||
|
type-infos get-global set-at ;
|
||||||
|
|
||||||
|
: register-standard-type ( c-type name -- )
|
||||||
|
dup standard-types get-global adjoin
|
||||||
|
atomic-info new swap register-type ;
|
||||||
|
|
||||||
|
: register-atomic-type ( c-type name -- )
|
||||||
|
atomic-info new swap register-type ;
|
||||||
|
|
||||||
|
: register-enum-type ( c-type name -- )
|
||||||
|
enum-info new swap register-type ;
|
||||||
|
|
||||||
|
: register-record-type ( c-type name -- )
|
||||||
|
record-info new swap register-type ;
|
||||||
|
|
||||||
|
ERROR: deferred-type-error ;
|
||||||
|
|
||||||
|
<<
|
||||||
|
void* c-type clone
|
||||||
|
[ drop deferred-type-error ] >>unboxer-quot
|
||||||
|
[ drop deferred-type-error ] >>boxer-quot
|
||||||
|
object >>boxed-class
|
||||||
|
"deferred-type" create-in typedef
|
||||||
|
>>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,15 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax alien.destructors alien.libraries
|
USING: alien alien.destructors alien.libraries alien.syntax
|
||||||
classes.struct combinators kernel literals math system
|
combinators gobject-introspection literals math system vocabs.loader ;
|
||||||
gobject-introspection glib.ffi ;
|
|
||||||
EXCLUDE: alien.c-types => pointer ;
|
|
||||||
IN: gobject.ffi
|
IN: gobject.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"glib.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gobject
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gobject" {
|
"gobject" {
|
||||||
{ [ os winnt? ] [ "libobject-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libobject-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -14,17 +18,12 @@ IN: gobject.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: void* GSignalCMarshaller
|
IMPLEMENT-STRUCTS: GValue GParamSpecVariant ;
|
||||||
TYPEDEF: gchar** GStrv
|
|
||||||
TYPEDEF: gchar* gchararray
|
|
||||||
|
|
||||||
GIR: vocab:gobject/GObject-2.0.gir
|
GIR: vocab:gobject/GObject-2.0.gir
|
||||||
|
|
||||||
IN: gobject.ffi
|
IN: gobject.ffi
|
||||||
|
|
||||||
FORGET: GValue
|
|
||||||
STRUCT: GValue { g_type GType } { data guint64[2] } ;
|
|
||||||
|
|
||||||
FORGET: GIOCondition
|
FORGET: GIOCondition
|
||||||
FORGET: G_IO_IN
|
FORGET: G_IO_IN
|
||||||
FORGET: G_IO_OUT
|
FORGET: G_IO_OUT
|
||||||
|
@ -33,12 +32,8 @@ FORGET: G_IO_ERR
|
||||||
FORGET: G_IO_HUP
|
FORGET: G_IO_HUP
|
||||||
FORGET: G_IO_NVAL
|
FORGET: G_IO_NVAL
|
||||||
|
|
||||||
FUNCTION: void g_object_unref ( GObject* self ) ;
|
|
||||||
|
|
||||||
DESTRUCTOR: g_object_unref
|
DESTRUCTOR: g_object_unref
|
||||||
|
|
||||||
TYPEDEF: GParamSpec GParam
|
|
||||||
|
|
||||||
CONSTANT: G_TYPE_INVALID $[ 0 2 shift ]
|
CONSTANT: G_TYPE_INVALID $[ 0 2 shift ]
|
||||||
CONSTANT: G_TYPE_NONE $[ 1 2 shift ]
|
CONSTANT: G_TYPE_NONE $[ 1 2 shift ]
|
||||||
CONSTANT: G_TYPE_INTERFACE $[ 2 2 shift ]
|
CONSTANT: G_TYPE_INTERFACE $[ 2 2 shift ]
|
||||||
|
@ -71,4 +66,3 @@ CONSTANT: G_TYPE_OBJECT $[ 20 2 shift ]
|
||||||
|
|
||||||
: g_signal_connect_swapped ( instance detailed_signal c_handler data -- result )
|
: g_signal_connect_swapped ( instance detailed_signal c_handler data -- result )
|
||||||
f G_CONNECT_SWAPPED g_signal_connect_data ;
|
f G_CONNECT_SWAPPED g_signal_connect_data ;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,18 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax alien.destructors alien.libraries
|
USING: alien alien.c-types alien.destructors alien.libraries
|
||||||
cairo.ffi combinators kernel system
|
alien.syntax combinators gobject-introspection
|
||||||
gobject-introspection atk.ffi gdk.ffi gdk.pixbuf.ffi gio.ffi
|
gobject-introspection.standard-types kernel pango.ffi system
|
||||||
glib.ffi gmodule.ffi gobject.ffi pango.ffi ;
|
vocabs.loader ;
|
||||||
EXCLUDE: alien.c-types => pointer ;
|
|
||||||
IN: gtk.ffi
|
IN: gtk.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"atk.ffi" require
|
||||||
|
"gdk.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gtk
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gtk" {
|
"gtk" {
|
||||||
{ [ os winnt? ] [ "libgtk-win32-2.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libgtk-win32-2.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -15,14 +21,14 @@ IN: gtk.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: void GtkAllocation
|
|
||||||
TYPEDEF: void GtkEnumValue
|
|
||||||
TYPEDEF: void GtkFlagValue
|
|
||||||
TYPEDEF: GType GtkType
|
|
||||||
|
|
||||||
IMPLEMENT-STRUCTS: GtkTreeIter ;
|
IMPLEMENT-STRUCTS: GtkTreeIter ;
|
||||||
|
|
||||||
GIR: vocab:gtk/Gtk-2.0.gir
|
GIR: vocab:gtk/Gtk-3.0.gir
|
||||||
|
|
||||||
DESTRUCTOR: gtk_widget_destroy
|
DESTRUCTOR: gtk_widget_destroy
|
||||||
|
|
||||||
|
! <workaround
|
||||||
|
FORGET: gtk_im_context_get_preedit_string
|
||||||
|
FUNCTION: void
|
||||||
|
gtk_im_context_get_preedit_string ( GtkIMContext* imcontext, gchar** str, PangoAttrList** attrs, gint* cursor_pos ) ;
|
||||||
|
! workaround>
|
||||||
|
|
|
@ -1,173 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
|
||||||
To affect the contents of this file, edit the original C definitions,
|
|
||||||
and/or use gtk-doc annotations. -->
|
|
||||||
<repository version="1.0"
|
|
||||||
xmlns="http://www.gtk.org/introspection/core/1.0"
|
|
||||||
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
|
||||||
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
|
||||||
<include name="Atk" version="1.0"/>
|
|
||||||
<include name="GLib" version="2.0"/>
|
|
||||||
<include name="GModule" version="2.0"/>
|
|
||||||
<include name="GObject" version="2.0"/>
|
|
||||||
<include name="Gdk" version="2.0"/>
|
|
||||||
<include name="GdkPixbuf" version="2.0"/>
|
|
||||||
<include name="Gio" version="2.0"/>
|
|
||||||
<include name="Gtk" version="2.0"/>
|
|
||||||
<include name="Pango" version="1.0"/>
|
|
||||||
<include name="cairo" version="1.0"/>
|
|
||||||
<package name="gtk+-2.0"/>
|
|
||||||
<namespace name="Gtk"
|
|
||||||
version="1.0"
|
|
||||||
shared-library="libgtkglext-x11-1.0.so.0"
|
|
||||||
c:prefix="Gtk">
|
|
||||||
<bitfield name="GLDebugFlag" c:type="GtkGLDebugFlag">
|
|
||||||
<member name="misc" value="1" c:identifier="GTK_GL_DEBUG_MISC"/>
|
|
||||||
<member name="func" value="2" c:identifier="GTK_GL_DEBUG_FUNC"/>
|
|
||||||
</bitfield>
|
|
||||||
<constant name="GTKGLEXT_BINARY_AGE" value="0">
|
|
||||||
<type name="int"/>
|
|
||||||
</constant>
|
|
||||||
<constant name="GTKGLEXT_INTERFACE_AGE" value="0">
|
|
||||||
<type name="int"/>
|
|
||||||
</constant>
|
|
||||||
<constant name="GTKGLEXT_MAJOR_VERSION" value="1">
|
|
||||||
<type name="int"/>
|
|
||||||
</constant>
|
|
||||||
<constant name="GTKGLEXT_MICRO_VERSION" value="0">
|
|
||||||
<type name="int"/>
|
|
||||||
</constant>
|
|
||||||
<constant name="GTKGLEXT_MINOR_VERSION" value="2">
|
|
||||||
<type name="int"/>
|
|
||||||
</constant>
|
|
||||||
<constant name="func__" value="<unknown>">
|
|
||||||
<type name="utf8"/>
|
|
||||||
</constant>
|
|
||||||
<function name="gl_init" c:identifier="gtk_gl_init">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="none" c:type="void"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="argc" direction="out" transfer-ownership="full">
|
|
||||||
<type name="int" c:type="int*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="argv" transfer-ownership="none">
|
|
||||||
<type name="utf8" c:type="char***"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="gl_init_check" c:identifier="gtk_gl_init_check">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="argc" direction="out" transfer-ownership="full">
|
|
||||||
<type name="int" c:type="int*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="argv" transfer-ownership="none">
|
|
||||||
<type name="utf8" c:type="char***"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="gl_parse_args" c:identifier="gtk_gl_parse_args">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="argc" direction="out" transfer-ownership="full">
|
|
||||||
<type name="int" c:type="int*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="argv" transfer-ownership="none">
|
|
||||||
<type name="utf8" c:type="char***"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_create_gl_context"
|
|
||||||
c:identifier="gtk_widget_create_gl_context">
|
|
||||||
<return-value transfer-ownership="full">
|
|
||||||
<type name="GdkGLContext" c:type="GdkGLContext*"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="share_list" transfer-ownership="none">
|
|
||||||
<type name="GdkGLContext" c:type="GdkGLContext*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="direct" transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="render_type" transfer-ownership="none">
|
|
||||||
<type name="int" c:type="int"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_get_gl_config"
|
|
||||||
c:identifier="gtk_widget_get_gl_config">
|
|
||||||
<return-value transfer-ownership="full">
|
|
||||||
<type name="GdkGLConfig" c:type="GdkGLConfig*"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_get_gl_context"
|
|
||||||
c:identifier="gtk_widget_get_gl_context">
|
|
||||||
<return-value transfer-ownership="full">
|
|
||||||
<type name="GdkGLContext" c:type="GdkGLContext*"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_get_gl_window"
|
|
||||||
c:identifier="gtk_widget_get_gl_window">
|
|
||||||
<return-value transfer-ownership="full">
|
|
||||||
<type name="GdkGLWindow" c:type="GdkGLWindow*"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_is_gl_capable"
|
|
||||||
c:identifier="gtk_widget_is_gl_capable">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
<function name="widget_set_gl_capability"
|
|
||||||
c:identifier="gtk_widget_set_gl_capability">
|
|
||||||
<return-value transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</return-value>
|
|
||||||
<parameters>
|
|
||||||
<parameter name="widget" transfer-ownership="none">
|
|
||||||
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="glconfig" transfer-ownership="none">
|
|
||||||
<type name="GdkGLConfig" c:type="GdkGLConfig*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="share_list" transfer-ownership="none">
|
|
||||||
<type name="GdkGLContext" c:type="GdkGLContext*"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="direct" transfer-ownership="none">
|
|
||||||
<type name="boolean" c:type="gboolean"/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="render_type" transfer-ownership="none">
|
|
||||||
<type name="int" c:type="int"/>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
|
||||||
</function>
|
|
||||||
</namespace>
|
|
||||||
</repository>
|
|
|
@ -0,0 +1,213 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
||||||
|
To affect the contents of this file, edit the original C definitions,
|
||||||
|
and/or use gtk-doc annotations. -->
|
||||||
|
<repository version="1.2"
|
||||||
|
xmlns="http://www.gtk.org/introspection/core/1.0"
|
||||||
|
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
||||||
|
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
||||||
|
<include name="Atk" version="1.0"/>
|
||||||
|
<include name="GLib" version="2.0"/>
|
||||||
|
<include name="GModule" version="2.0"/>
|
||||||
|
<include name="GObject" version="2.0"/>
|
||||||
|
<include name="Gdk" version="3.0"/>
|
||||||
|
<include name="GdkGLExt" version="1.0"/>
|
||||||
|
<include name="GdkPixbuf" version="2.0"/>
|
||||||
|
<include name="Gio" version="2.0"/>
|
||||||
|
<include name="Gtk" version="3.0"/>
|
||||||
|
<include name="Pango" version="1.0"/>
|
||||||
|
<include name="cairo" version="1.0"/>
|
||||||
|
<package name="gtkglext-1.0"/>
|
||||||
|
<namespace name="GtkGL"
|
||||||
|
version="1.0"
|
||||||
|
shared-library="libgtkglext-x11-1.0.so.0"
|
||||||
|
c:identifier-prefixes="GtkGL,Gtk"
|
||||||
|
c:symbol-prefixes="gtk_gl,gtk">
|
||||||
|
<bitfield name="DebugFlag" c:type="GtkGLDebugFlag">
|
||||||
|
<member name="misc" value="1" c:identifier="GTK_GL_DEBUG_MISC"/>
|
||||||
|
<member name="func" value="2" c:identifier="GTK_GL_DEBUG_FUNC"/>
|
||||||
|
</bitfield>
|
||||||
|
<function name="init" c:identifier="gtk_gl_init">
|
||||||
|
<doc xml:whitespace="preserve">Call this function before using any other GtkGLExt functions in your
|
||||||
|
applications. It will initialize everything needed to operate the library
|
||||||
|
and parses some standard command line options. @argc and
|
||||||
|
never see those standard arguments.
|
||||||
|
<note><para>
|
||||||
|
This function will terminate your program if it was unable to initialize
|
||||||
|
the library for some reason. If you want your program to fall back to a
|
||||||
|
textual interface you want to call gtk_gl_init_check() instead.
|
||||||
|
</para></note></doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="argc"
|
||||||
|
direction="inout"
|
||||||
|
caller-allocates="0"
|
||||||
|
transfer-ownership="full">
|
||||||
|
<doc xml:whitespace="preserve">Address of the <parameter>argc</parameter> parameter of your <function>main()</function> function. Changed if any arguments were handled.</doc>
|
||||||
|
<type name="gint" c:type="int*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="argv"
|
||||||
|
direction="inout"
|
||||||
|
caller-allocates="0"
|
||||||
|
transfer-ownership="full"
|
||||||
|
allow-none="1">
|
||||||
|
<doc xml:whitespace="preserve">Address of the <parameter>argv</parameter> parameter of <function>main()</function>. Any parameters understood by gtk_gl_init() are stripped before return.</doc>
|
||||||
|
<array length="0" c:type="char***">
|
||||||
|
<type name="utf8"/>
|
||||||
|
</array>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="init_check" c:identifier="gtk_gl_init_check">
|
||||||
|
<doc xml:whitespace="preserve">This function does the same work as gtk_gl_init() with only
|
||||||
|
initialized. Instead it returns %FALSE on failure.
|
||||||
|
This way the application can fall back to some other means of communication
|
||||||
|
with the user - for example a curses or command line interface.
|
||||||
|
%FALSE otherwise.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">%TRUE if the GUI has been successfully initialized,</doc>
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="argc"
|
||||||
|
direction="inout"
|
||||||
|
caller-allocates="0"
|
||||||
|
transfer-ownership="full">
|
||||||
|
<doc xml:whitespace="preserve">Address of the <parameter>argc</parameter> parameter of your <function>main()</function> function. Changed if any arguments were handled.</doc>
|
||||||
|
<type name="gint" c:type="int*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="argv"
|
||||||
|
direction="inout"
|
||||||
|
caller-allocates="0"
|
||||||
|
transfer-ownership="full"
|
||||||
|
allow-none="1">
|
||||||
|
<doc xml:whitespace="preserve">Address of the <parameter>argv</parameter> parameter of <function>main()</function>. Any parameters understood by gtk_gl_init() are stripped before return.</doc>
|
||||||
|
<array length="0" c:type="char***">
|
||||||
|
<type name="utf8"/>
|
||||||
|
</array>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_create_gl_context"
|
||||||
|
c:identifier="gtk_widget_create_gl_context">
|
||||||
|
<doc xml:whitespace="preserve">Creates a new #GdkGLContext with the appropriate #GdkGLDrawable
|
||||||
|
for this widget. The GL context must be freed when you're
|
||||||
|
finished with it. See also gtk_widget_get_gl_context().</doc>
|
||||||
|
<return-value transfer-ownership="full">
|
||||||
|
<doc xml:whitespace="preserve">the new #GdkGLContext.</doc>
|
||||||
|
<type name="GdkGL.Context" c:type="GdkGLContext*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GtkWidget.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="share_list" transfer-ownership="none" allow-none="1">
|
||||||
|
<doc xml:whitespace="preserve">the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place.</doc>
|
||||||
|
<type name="GdkGL.Context" c:type="GdkGLContext*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="direct" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">whether rendering is to be done with a direct connection to the graphics system.</doc>
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="render_type" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not used).</doc>
|
||||||
|
<type name="gint" c:type="int"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_get_gl_config"
|
||||||
|
c:identifier="gtk_widget_get_gl_config">
|
||||||
|
<doc xml:whitespace="preserve">Returns the #GdkGLConfig referred by the @widget.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the #GdkGLConfig.</doc>
|
||||||
|
<type name="GdkGL.Config" c:type="GdkGLConfig*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GtkWidget.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_get_gl_context"
|
||||||
|
c:identifier="gtk_widget_get_gl_context">
|
||||||
|
<doc xml:whitespace="preserve">Returns the #GdkGLContext with the appropriate #GdkGLDrawable
|
||||||
|
for this widget. Unlike the GL context returned by
|
||||||
|
gtk_widget_create_gl_context(), this context is owned by the widget.
|
||||||
|
#GdkGLContext is needed for the function gdk_gl_drawable_begin,
|
||||||
|
or for sharing display lists (see gtk_widget_set_gl_capability()).</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the #GdkGLContext.</doc>
|
||||||
|
<type name="GdkGL.Context" c:type="GdkGLContext*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GtkWidget.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_get_gl_window"
|
||||||
|
c:identifier="gtk_widget_get_gl_window">
|
||||||
|
<doc xml:whitespace="preserve">Returns the #GdkGLWindow owned by the @widget.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the #GdkGLWindow.</doc>
|
||||||
|
<type name="GdkGL.Window" c:type="GdkGLWindow*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GtkWidget.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_is_gl_capable"
|
||||||
|
c:identifier="gtk_widget_is_gl_capable">
|
||||||
|
<doc xml:whitespace="preserve">Returns whether the @widget is OpenGL-capable.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">TRUE if the @widget is OpenGL-capable, FALSE otherwise.</doc>
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GtkWidget.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="widget_set_gl_capability"
|
||||||
|
c:identifier="gtk_widget_set_gl_capability">
|
||||||
|
<doc xml:whitespace="preserve">Set the OpenGL-capability to the @widget.
|
||||||
|
This function prepares the widget for its use with OpenGL.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">TRUE if it is successful, FALSE otherwise.</doc>
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="widget" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the #GtkWidget to be used as the rendering area.</doc>
|
||||||
|
<type name="Gtk.Widget" c:type="GtkWidget*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="glconfig" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #GdkGLConfig.</doc>
|
||||||
|
<type name="GdkGL.Config" c:type="GdkGLConfig*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="share_list" transfer-ownership="none" allow-none="1">
|
||||||
|
<doc xml:whitespace="preserve">the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place.</doc>
|
||||||
|
<type name="GdkGL.Context" c:type="GdkGLContext*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="direct" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">whether rendering is to be done with a direct connection to the graphics system.</doc>
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="render_type" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not used).</doc>
|
||||||
|
<type name="gint" c:type="int"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
</namespace>
|
||||||
|
</repository>
|
|
@ -1,11 +1,16 @@
|
||||||
! Copyright (C) 2010 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.libraries combinators kernel system
|
USING: alien alien.libraries alien.syntax combinators
|
||||||
gobject-introspection gdk.ffi gdk.pixbuf.ffi gdk.gl.ffi gio.ffi
|
gobject-introspection kernel system vocabs.loader ;
|
||||||
glib.ffi gmodule.ffi gobject.ffi gtk.ffi ;
|
|
||||||
EXCLUDE: alien.c-types => pointer ;
|
|
||||||
IN: gtk.gl.ffi
|
IN: gtk.gl.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gtk.ffi" require
|
||||||
|
"gdk.gl.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: gtk.gl
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"gtk.gl" {
|
"gtk.gl" {
|
||||||
{ [ os winnt? ] [ drop ] }
|
{ [ os winnt? ] [ drop ] }
|
||||||
|
@ -14,5 +19,4 @@ IN: gtk.gl.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
GIR: vocab:gtk/gl/GtkGL-1.0.gir
|
GIR: vocab:gtk/gl/GtkGLExt-1.0.gir
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
<!-- This file was automatically generated from C sources - DO NOT EDIT!
|
||||||
To affect the contents of this file, edit the original C definitions,
|
To affect the contents of this file, edit the original C definitions,
|
||||||
and/or use gtk-doc annotations. -->
|
and/or use gtk-doc annotations. -->
|
||||||
<repository version="1.0"
|
<repository version="1.2"
|
||||||
xmlns="http://www.gtk.org/introspection/core/1.0"
|
xmlns="http://www.gtk.org/introspection/core/1.0"
|
||||||
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
xmlns:c="http://www.gtk.org/introspection/c/1.0"
|
||||||
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
||||||
|
@ -18,173 +18,361 @@ and/or use gtk-doc annotations. -->
|
||||||
<namespace name="PangoCairo"
|
<namespace name="PangoCairo"
|
||||||
version="1.0"
|
version="1.0"
|
||||||
shared-library="libpangocairo-1.0.so.0"
|
shared-library="libpangocairo-1.0.so.0"
|
||||||
c:prefix="PangoCairo">
|
c:identifier-prefixes="PangoCairo"
|
||||||
<record name="FcFontMap" c:type="PangoCairoFcFontMap">
|
c:symbol-prefixes="pango_cairo">
|
||||||
</record>
|
<class name="FcFontMap"
|
||||||
<record name="Font"
|
c:symbol-prefix="fc_font_map"
|
||||||
|
c:type="PangoCairoFcFontMap"
|
||||||
|
parent="Pango.FontMap"
|
||||||
|
glib:type-name="PangoCairoFcFontMap"
|
||||||
|
glib:get-type="pango_cairo_fc_font_map_get_type">
|
||||||
|
<implements name="FontMap"/>
|
||||||
|
<field name="parent_instance" introspectable="0">
|
||||||
|
<type c:type="PangoFcFontMap"/>
|
||||||
|
</field>
|
||||||
|
<field name="dpi">
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</field>
|
||||||
|
<field name="library">
|
||||||
|
<type name="freetype2.Library" c:type="FT_Library"/>
|
||||||
|
</field>
|
||||||
|
</class>
|
||||||
|
<interface name="Font"
|
||||||
|
c:symbol-prefix="font"
|
||||||
c:type="PangoCairoFont"
|
c:type="PangoCairoFont"
|
||||||
doc="#PangoCairoFont is an interface exported by fonts for
|
version="1.18"
|
||||||
|
glib:type-name="PangoCairoFont"
|
||||||
|
glib:get-type="pango_cairo_font_get_type">
|
||||||
|
<doc xml:whitespace="preserve">#PangoCairoFont is an interface exported by fonts for
|
||||||
use with Cairo. The actual type of the font will depend
|
use with Cairo. The actual type of the font will depend
|
||||||
on the particular font technology Cairo was compiled to use."
|
on the particular font technology Cairo was compiled to use.</doc>
|
||||||
|
<prerequisite name="Pango.Font"/>
|
||||||
|
<method name="get_scaled_font"
|
||||||
|
c:identifier="pango_cairo_font_get_scaled_font"
|
||||||
version="1.18">
|
version="1.18">
|
||||||
</record>
|
<doc xml:whitespace="preserve">Gets the #cairo_scaled_font_t used by @font.
|
||||||
<record name="FontGlyphExtentsCacheEntry"
|
The scaled font can be referenced and kept using
|
||||||
c:type="PangoCairoFontGlyphExtentsCacheEntry">
|
cairo_scaled_font_reference().
|
||||||
</record>
|
or %NULL if @font is %NULL.</doc>
|
||||||
<record name="FontHexBoxInfo" c:type="PangoCairoFontHexBoxInfo">
|
|
||||||
<field name="font" writable="1">
|
|
||||||
<type name="Font" c:type="PangoCairoFont*"/>
|
|
||||||
</field>
|
|
||||||
<field name="rows" writable="1">
|
|
||||||
<type name="int" c:type="int"/>
|
|
||||||
</field>
|
|
||||||
<field name="digit_width" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="digit_height" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="pad_x" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="pad_y" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="line_width" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="box_descent" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
<field name="box_height" writable="1">
|
|
||||||
<type name="double" c:type="double"/>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
<record name="FontIface" c:type="PangoCairoFontIface">
|
|
||||||
</record>
|
|
||||||
<record name="FontMap"
|
|
||||||
c:type="PangoCairoFontMap"
|
|
||||||
doc="#PangoCairoFontMap is an interface exported by font maps for
|
|
||||||
use with Cairo. The actual type of the font map will depend
|
|
||||||
on the particular font technology Cairo was compiled to use."
|
|
||||||
version="1.10">
|
|
||||||
<constructor name="new"
|
|
||||||
c:identifier="pango_cairo_font_map_new"
|
|
||||||
doc="Creates a new #PangoCairoFontMap object; a fontmap is used
|
|
||||||
to cache information about available fonts, and holds
|
|
||||||
certain global parameters such as the resolution.
|
|
||||||
In most cases, you can use pango_cairo_font_map_get_default()
|
|
||||||
instead.
|
|
||||||
Note that the type of the returned object will depend
|
|
||||||
on the particular font backend Cairo was compiled to use;
|
|
||||||
You generally should only use the #PangoFontMap and
|
|
||||||
#PangoCairoFontMap interfaces on the returned object.
|
|
||||||
be freed with g_object_unref()."
|
|
||||||
version="1.10">
|
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full">
|
||||||
<type name="FontMap" c:type="PangoFontMap*"/>
|
<doc xml:whitespace="preserve">the #cairo_scaled_font_t used by @font,</doc>
|
||||||
|
<type name="cairo.ScaledFont" c:type="cairo_scaled_font_t*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</constructor>
|
</method>
|
||||||
|
</interface>
|
||||||
|
<interface name="FontMap"
|
||||||
|
c:symbol-prefix="font_map"
|
||||||
|
c:type="PangoCairoFontMap"
|
||||||
|
version="1.10"
|
||||||
|
glib:type-name="PangoCairoFontMap"
|
||||||
|
glib:get-type="pango_cairo_font_map_get_type">
|
||||||
|
<doc xml:whitespace="preserve">#PangoCairoFontMap is an interface exported by font maps for
|
||||||
|
use with Cairo. The actual type of the font map will depend
|
||||||
|
on the particular font technology Cairo was compiled to use.</doc>
|
||||||
|
<prerequisite name="Pango.FontMap"/>
|
||||||
|
<method name="create_context"
|
||||||
|
c:identifier="pango_cairo_font_map_create_context"
|
||||||
|
version="1.10"
|
||||||
|
introspectable="0"
|
||||||
|
deprecated="Use pango_font_map_create_context() instead."
|
||||||
|
deprecated-version="1.22">
|
||||||
|
<doc xml:whitespace="preserve">Create a #PangoContext for the given fontmap.</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the newly created context; free with g_object_unref().</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</return-value>
|
||||||
|
</method>
|
||||||
|
<method name="get_font_type"
|
||||||
|
c:identifier="pango_cairo_font_map_get_font_type"
|
||||||
|
version="1.18">
|
||||||
|
<doc xml:whitespace="preserve">Gets the type of Cairo font backend that @fontmap uses.</doc>
|
||||||
|
<return-value transfer-ownership="full">
|
||||||
|
<doc xml:whitespace="preserve">the #cairo_font_type_t cairo font backend type</doc>
|
||||||
|
<type name="cairo.FontType" c:type="cairo_font_type_t"/>
|
||||||
|
</return-value>
|
||||||
|
</method>
|
||||||
|
<method name="get_resolution"
|
||||||
|
c:identifier="pango_cairo_font_map_get_resolution"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the resolution in "dots per inch"</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</return-value>
|
||||||
|
</method>
|
||||||
<method name="set_default"
|
<method name="set_default"
|
||||||
c:identifier="pango_cairo_font_map_set_default"
|
c:identifier="pango_cairo_font_map_set_default"
|
||||||
doc="Sets a default #PangoCairoFontMap to use with Cairo.
|
version="1.22">
|
||||||
|
<doc xml:whitespace="preserve">Sets a default #PangoCairoFontMap to use with Cairo.
|
||||||
This can be used to change the Cairo font backend that the
|
This can be used to change the Cairo font backend that the
|
||||||
default fontmap uses for example. The old default font map
|
default fontmap uses for example. The old default font map
|
||||||
is unreffed and the new font map referenced.
|
is unreffed and the new font map referenced.
|
||||||
A value of %NULL for @fontmap will cause the current default
|
A value of %NULL for @fontmap will cause the current default
|
||||||
font map to be released and a new default font
|
font map to be released and a new default font
|
||||||
map to be created on demand, using pango_cairo_font_map_new()."
|
map to be created on demand, using pango_cairo_font_map_new().</doc>
|
||||||
version="1.22">
|
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="none" c:type="void"/>
|
<type name="none" c:type="void"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_resolution"
|
<method name="set_resolution"
|
||||||
c:identifier="pango_cairo_font_map_set_resolution"
|
c:identifier="pango_cairo_font_map_set_resolution"
|
||||||
doc="involved; the terminology is conventional.)
|
version="1.10">
|
||||||
Sets the resolution for the fontmap. This is a scale factor between
|
<doc xml:whitespace="preserve">Sets the resolution for the fontmap. This is a scale factor between
|
||||||
points specified in a #PangoFontDescription and Cairo units. The
|
points specified in a #PangoFontDescription and Cairo units. The
|
||||||
default value is 96, meaning that a 10 point font will be 13
|
default value is 96, meaning that a 10 point font will be 13
|
||||||
units high. (10 * 96. / 72. = 13.3)."
|
units high. (10 * 96. / 72. = 13.3).</doc>
|
||||||
version="1.10">
|
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="none" c:type="void"/>
|
<type name="none" c:type="void"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter name="dpi" transfer-ownership="none">
|
<parameter name="dpi" transfer-ownership="none">
|
||||||
<type name="double" c:type="double"/>
|
<doc xml:whitespace="preserve">the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_resolution"
|
</interface>
|
||||||
c:identifier="pango_cairo_font_map_get_resolution"
|
<callback name="ShapeRendererFunc" c:type="PangoCairoShapeRendererFunc">
|
||||||
doc="Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()"
|
|
||||||
version="1.10">
|
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="double" c:type="double"/>
|
<type name="none" c:type="void"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</method>
|
<parameters>
|
||||||
<method name="create_context"
|
<parameter name="cr" transfer-ownership="none">
|
||||||
c:identifier="pango_cairo_font_map_create_context"
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
doc="Create a #PangoContext for the given fontmap."
|
</parameter>
|
||||||
version="1.10"
|
<parameter name="attr" transfer-ownership="none">
|
||||||
deprecated="Use pango_font_map_create_context() instead."
|
<type name="Pango.AttrShape" c:type="PangoAttrShape*"/>
|
||||||
deprecated-version="1.22">
|
</parameter>
|
||||||
<return-value transfer-ownership="full">
|
<parameter name="do_path" transfer-ownership="none">
|
||||||
<type name="Pango.Context" c:type="PangoContext*"/>
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
</return-value>
|
</parameter>
|
||||||
</method>
|
<parameter name="data" transfer-ownership="none">
|
||||||
</record>
|
<type name="gpointer" c:type="gpointer"/>
|
||||||
<record name="FontMapIface" c:type="PangoCairoFontMapIface">
|
</parameter>
|
||||||
</record>
|
</parameters>
|
||||||
<record name="FontPrivate" c:type="PangoCairoFontPrivate">
|
</callback>
|
||||||
</record>
|
<function name="context_get_font_options"
|
||||||
<record name="FontPrivateScaledFontData"
|
c:identifier="pango_cairo_context_get_font_options"
|
||||||
c:type="PangoCairoFontPrivateScaledFontData">
|
|
||||||
</record>
|
|
||||||
<constant name="HEIGHT_SQUARES" value="2.5">
|
|
||||||
<type name="double"/>
|
|
||||||
</constant>
|
|
||||||
<record name="Renderer" c:type="PangoCairoRenderer">
|
|
||||||
</record>
|
|
||||||
<function name="context_get_resolution"
|
|
||||||
c:identifier="pango_cairo_context_get_resolution"
|
|
||||||
doc="Gets the resolution for the context. See pango_cairo_context_set_resolution()
|
|
||||||
be returned if no resolution has previously been set."
|
|
||||||
version="1.10">
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Retrieves any font rendering options previously set with
|
||||||
|
pango_cairo_font_map_set_font_options(). This function does not report options
|
||||||
|
that are derived from the target surface by pango_cairo_update_context()
|
||||||
|
if no options have been set. This value is owned by the context
|
||||||
|
and must not be modified or freed.</doc>
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="double" c:type="double"/>
|
<doc xml:whitespace="preserve">the font options previously set on the context, or %NULL</doc>
|
||||||
|
<type name="cairo.FontOptions" c:type="cairo_font_options_t*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter name="context" transfer-ownership="none">
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
<type name="Pango.Context" c:type="PangoContext*"/>
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</function>
|
</function>
|
||||||
|
<function name="context_get_resolution"
|
||||||
|
c:identifier="pango_cairo_context_get_resolution"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Gets the resolution for the context. See pango_cairo_context_set_resolution()
|
||||||
|
be returned if no resolution has previously been set.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the resolution in "dots per inch". A negative value will</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="context_get_shape_renderer"
|
||||||
|
c:identifier="pango_cairo_context_get_shape_renderer"
|
||||||
|
version="1.18"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Sets callback function for context to use for rendering attributes
|
||||||
|
of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
|
||||||
|
details.
|
||||||
|
Retrieves callback function and associated user data for rendering
|
||||||
|
attributes of type %PANGO_ATTR_SHAPE as set by
|
||||||
|
pango_cairo_context_set_shape_renderer(), if any.
|
||||||
|
if no shape rendering callback have been set.</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the shape rendering callback previously set on the context, or %NULL</doc>
|
||||||
|
<type name="ShapeRendererFunc" c:type="PangoCairoShapeRendererFunc"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="data" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">Pointer to #gpointer to return user data</doc>
|
||||||
|
<type name="gpointer" c:type="gpointer*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="context_set_font_options"
|
||||||
|
c:identifier="pango_cairo_context_set_font_options"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Sets the font options used when rendering text with this context.
|
||||||
|
These options override any options that pango_cairo_update_context()
|
||||||
|
derives from the target surface.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="options" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #cairo_font_options_t, or %NULL to unset any previously set options. A copy is made.</doc>
|
||||||
|
<type name="cairo.FontOptions" c:type="cairo_font_options_t*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
<function name="context_set_resolution"
|
<function name="context_set_resolution"
|
||||||
c:identifier="pango_cairo_context_set_resolution"
|
c:identifier="pango_cairo_context_set_resolution"
|
||||||
doc="involved; the terminology is conventional.) A 0 or negative value
|
version="1.10">
|
||||||
means to use the resolution from the font map.
|
<doc xml:whitespace="preserve">Sets the resolution for the context. This is a scale factor between
|
||||||
Sets the resolution for the context. This is a scale factor between
|
|
||||||
points specified in a #PangoFontDescription and Cairo units. The
|
points specified in a #PangoFontDescription and Cairo units. The
|
||||||
default value is 96, meaning that a 10 point font will be 13
|
default value is 96, meaning that a 10 point font will be 13
|
||||||
units high. (10 * 96. / 72. = 13.3)."
|
units high. (10 * 96. / 72. = 13.3).</doc>
|
||||||
version="1.10">
|
|
||||||
<return-value transfer-ownership="none">
|
<return-value transfer-ownership="none">
|
||||||
<type name="none" c:type="void"/>
|
<type name="none" c:type="void"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter name="context" transfer-ownership="none">
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
<type name="Pango.Context" c:type="PangoContext*"/>
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="dpi" transfer-ownership="none">
|
<parameter name="dpi" transfer-ownership="none">
|
||||||
<type name="double" c:type="double"/>
|
<doc xml:whitespace="preserve">the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="context_set_shape_renderer"
|
||||||
|
c:identifier="pango_cairo_context_set_shape_renderer"
|
||||||
|
version="1.18">
|
||||||
|
<doc xml:whitespace="preserve">Sets callback function for context to use for rendering attributes
|
||||||
|
of type %PANGO_ATTR_SHAPE. See #PangoCairoShapeRendererFunc for
|
||||||
|
details.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="func"
|
||||||
|
transfer-ownership="none"
|
||||||
|
scope="notified"
|
||||||
|
closure="2"
|
||||||
|
destroy="3">
|
||||||
|
<doc xml:whitespace="preserve">Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.</doc>
|
||||||
|
<type name="ShapeRendererFunc" c:type="PangoCairoShapeRendererFunc"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="data" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">User data that will be passed to @func.</doc>
|
||||||
|
<type name="gpointer" c:type="gpointer"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="dnotify" transfer-ownership="none" scope="async">
|
||||||
|
<doc xml:whitespace="preserve">Callback that will be called when the context is freed to release @data, or %NULL.</doc>
|
||||||
|
<type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="create_context"
|
||||||
|
c:identifier="pango_cairo_create_context"
|
||||||
|
version="1.22"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Creates a context object set up to match the current transformation
|
||||||
|
and target surface of the Cairo context. This context can then be
|
||||||
|
used to create a layout using pango_layout_new().
|
||||||
|
This function is a convenience function that creates a context using
|
||||||
|
the default font map, then updates it to @cr. If you just need to
|
||||||
|
create a layout for use with @cr and do not need to access #PangoContext
|
||||||
|
directly, you can use pango_cairo_create_layout() instead.
|
||||||
|
g_object_unref().</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the newly created #PangoContext. Free with</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="create_layout"
|
||||||
|
c:identifier="pango_cairo_create_layout"
|
||||||
|
version="1.10"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Creates a layout object set up to match the current transformation
|
||||||
|
and target surface of the Cairo context. This layout can then be
|
||||||
|
used for text measurement with functions like
|
||||||
|
pango_layout_get_size() or drawing with functions like
|
||||||
|
pango_cairo_show_layout(). If you change the transformation
|
||||||
|
or target surface for @cr, you need to call pango_cairo_update_layout()
|
||||||
|
This function is the most convenient way to use Cairo with Pango,
|
||||||
|
however it is slightly inefficient since it creates a separate
|
||||||
|
#PangoContext object for each layout. This might matter in an
|
||||||
|
application that was laying out large amounts of text.
|
||||||
|
g_object_unref().</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the newly created #PangoLayout. Free with</doc>
|
||||||
|
<type name="Pango.Layout" c:type="PangoLayout*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="error_underline_path"
|
||||||
|
c:identifier="pango_cairo_error_underline_path"
|
||||||
|
version="1.14">
|
||||||
|
<doc xml:whitespace="preserve">Add a squiggly line to the current path in the specified cairo context that
|
||||||
|
approximately covers the given rectangle in the style of an underline used
|
||||||
|
to indicate a spelling error. (The width of the underline is rounded to an
|
||||||
|
integer number of up/down segments and the resulting rectangle is centered
|
||||||
|
in the original rectangle)</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="x" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">The X coordinate of one corner of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="y" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">The Y coordinate of one corner of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="width" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">Non-negative width of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="height" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">Non-negative height of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</function>
|
</function>
|
||||||
<function name="font_map_get_default"
|
<function name="font_map_get_default"
|
||||||
c:identifier="pango_cairo_font_map_get_default"
|
c:identifier="pango_cairo_font_map_get_default"
|
||||||
doc="Gets a default #PangoCairoFontMap to use with Cairo.
|
version="1.10"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Gets a default #PangoCairoFontMap to use with Cairo.
|
||||||
Note that the type of the returned object will depend
|
Note that the type of the returned object will depend
|
||||||
on the particular font backend Cairo was compiled to use;
|
on the particular font backend Cairo was compiled to use;
|
||||||
You generally should only use the #PangoFontMap and
|
You generally should only use the #PangoFontMap and
|
||||||
|
@ -193,11 +381,278 @@ The default Cairo fontmap can be changed by using
|
||||||
pango_cairo_font_map_set_default(). This can be used to
|
pango_cairo_font_map_set_default(). This can be used to
|
||||||
change the Cairo font backend that the default fontmap
|
change the Cairo font backend that the default fontmap
|
||||||
uses for example.
|
uses for example.
|
||||||
object is owned by Pango and must not be freed."
|
object is owned by Pango and must not be freed.</doc>
|
||||||
version="1.10">
|
<return-value>
|
||||||
<return-value transfer-ownership="full">
|
<doc xml:whitespace="preserve">the default Cairo fontmap for Pango. This</doc>
|
||||||
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
|
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
</function>
|
</function>
|
||||||
|
<function name="font_map_new"
|
||||||
|
c:identifier="pango_cairo_font_map_new"
|
||||||
|
version="1.10"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Creates a new #PangoCairoFontMap object; a fontmap is used
|
||||||
|
to cache information about available fonts, and holds
|
||||||
|
certain global parameters such as the resolution.
|
||||||
|
In most cases, you can use pango_cairo_font_map_get_default()
|
||||||
|
instead.
|
||||||
|
Note that the type of the returned object will depend
|
||||||
|
on the particular font backend Cairo was compiled to use;
|
||||||
|
You generally should only use the #PangoFontMap and
|
||||||
|
#PangoCairoFontMap interfaces on the returned object.
|
||||||
|
be freed with g_object_unref().</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the newly allocated #PangoFontMap, which should</doc>
|
||||||
|
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
|
||||||
|
</return-value>
|
||||||
|
</function>
|
||||||
|
<function name="font_map_new_for_font_type"
|
||||||
|
c:identifier="pango_cairo_font_map_new_for_font_type"
|
||||||
|
version="1.18"
|
||||||
|
introspectable="0">
|
||||||
|
<doc xml:whitespace="preserve">Creates a new #PangoCairoFontMap object of the type suitable
|
||||||
|
to be used with cairo font backend of type @fonttype.
|
||||||
|
In most cases one should simply use @pango_cairo_font_map_new(),
|
||||||
|
or in fact in most of those cases, just use
|
||||||
|
which should be freed with g_object_unref(),
|
||||||
|
or %NULL if the requested cairo font backend is
|
||||||
|
not supported / compiled in.</doc>
|
||||||
|
<return-value>
|
||||||
|
<doc xml:whitespace="preserve">the newly allocated #PangoFontMap of suitable type</doc>
|
||||||
|
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="fonttype" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">desired #cairo_font_type_t</doc>
|
||||||
|
<type name="cairo.FontType" c:type="cairo_font_type_t"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="glyph_string_path"
|
||||||
|
c:identifier="pango_cairo_glyph_string_path">
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="font" transfer-ownership="none">
|
||||||
|
<type name="Pango.Font" c:type="PangoFont*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="glyphs" transfer-ownership="none">
|
||||||
|
<type name="Pango.GlyphString" c:type="PangoGlyphString*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="layout_line_path"
|
||||||
|
c:identifier="pango_cairo_layout_line_path"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Adds the text in #PangoLayoutLine to the current path in the
|
||||||
|
specified cairo context. The origin of the glyphs (the left edge
|
||||||
|
of the line) will be at the current point of the cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="line" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoLayoutLine</doc>
|
||||||
|
<type name="Pango.LayoutLine" c:type="PangoLayoutLine*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="layout_path"
|
||||||
|
c:identifier="pango_cairo_layout_path"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Adds the text in a #PangoLayout to the current path in the
|
||||||
|
specified cairo context. The top-left corner of the #PangoLayout
|
||||||
|
will be at the current point of the cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="layout" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Pango layout</doc>
|
||||||
|
<type name="Pango.Layout" c:type="PangoLayout*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="show_error_underline"
|
||||||
|
c:identifier="pango_cairo_show_error_underline"
|
||||||
|
version="1.14">
|
||||||
|
<doc xml:whitespace="preserve">Draw a squiggly line in the specified cairo context that approximately
|
||||||
|
covers the given rectangle in the style of an underline used to indicate a
|
||||||
|
spelling error. (The width of the underline is rounded to an integer
|
||||||
|
number of up/down segments and the resulting rectangle is centered in the
|
||||||
|
original rectangle)</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="x" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">The X coordinate of one corner of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="y" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">The Y coordinate of one corner of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="width" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">Non-negative width of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="height" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">Non-negative height of the rectangle</doc>
|
||||||
|
<type name="gdouble" c:type="double"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="show_glyph_item"
|
||||||
|
c:identifier="pango_cairo_show_glyph_item"
|
||||||
|
version="1.22">
|
||||||
|
<doc xml:whitespace="preserve">Draws the glyphs in @glyph_item in the specified cairo context,
|
||||||
|
embedding the text associated with the glyphs in the output if the
|
||||||
|
output format supports it (PDF for example), otherwise it acts
|
||||||
|
similar to pango_cairo_show_glyph_string().
|
||||||
|
The origin of the glyphs (the left edge of the baseline) will
|
||||||
|
be drawn at the current point of the cairo context.
|
||||||
|
Note that @text is the start of the text for layout, which is then
|
||||||
|
indexed by <literal>@glyph_item->item->offset</literal>.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="text" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">the UTF-8 text that @glyph_item refers to</doc>
|
||||||
|
<type name="utf8" c:type="char*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="glyph_item" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoGlyphItem</doc>
|
||||||
|
<type name="Pango.GlyphItem" c:type="PangoGlyphItem*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="show_glyph_string"
|
||||||
|
c:identifier="pango_cairo_show_glyph_string"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Draws the glyphs in @glyphs in the specified cairo context.
|
||||||
|
The origin of the glyphs (the left edge of the baseline) will
|
||||||
|
be drawn at the current point of the cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="font" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoFont from a #PangoCairoFontMap</doc>
|
||||||
|
<type name="Pango.Font" c:type="PangoFont*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="glyphs" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoGlyphString</doc>
|
||||||
|
<type name="Pango.GlyphString" c:type="PangoGlyphString*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="show_layout"
|
||||||
|
c:identifier="pango_cairo_show_layout"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Draws a #PangoLayout in the specified cairo context.
|
||||||
|
The top-left corner of the #PangoLayout will be drawn
|
||||||
|
at the current point of the cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="layout" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Pango layout</doc>
|
||||||
|
<type name="Pango.Layout" c:type="PangoLayout*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="show_layout_line"
|
||||||
|
c:identifier="pango_cairo_show_layout_line"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Draws a #PangoLayoutLine in the specified cairo context.
|
||||||
|
The origin of the glyphs (the left edge of the line) will
|
||||||
|
be drawn at the current point of the cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="line" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoLayoutLine</doc>
|
||||||
|
<type name="Pango.LayoutLine" c:type="PangoLayoutLine*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="update_context"
|
||||||
|
c:identifier="pango_cairo_update_context"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Updates a #PangoContext previously created for use with Cairo to
|
||||||
|
match the current transformation and target surface of a Cairo
|
||||||
|
context. If any layouts have been created for the context,
|
||||||
|
it's necessary to call pango_layout_context_changed() on those
|
||||||
|
layouts.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="context" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoContext, from a pangocairo font map</doc>
|
||||||
|
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
|
<function name="update_layout"
|
||||||
|
c:identifier="pango_cairo_update_layout"
|
||||||
|
version="1.10">
|
||||||
|
<doc xml:whitespace="preserve">Updates the private #PangoContext of a #PangoLayout created with
|
||||||
|
pango_cairo_create_layout() to match the current transformation
|
||||||
|
and target surface of a Cairo context.</doc>
|
||||||
|
<return-value transfer-ownership="none">
|
||||||
|
<type name="none" c:type="void"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="cr" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a Cairo context</doc>
|
||||||
|
<type name="cairo.Context" c:type="cairo_t*"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="layout" transfer-ownership="none">
|
||||||
|
<doc xml:whitespace="preserve">a #PangoLayout, from pango_cairo_create_layout()</doc>
|
||||||
|
<type name="Pango.Layout" c:type="PangoLayout*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</function>
|
||||||
</namespace>
|
</namespace>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
! Copyright (C) 2010 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.libraries alien.syntax cairo.ffi
|
USING: alien alien.libraries alien.syntax cairo.ffi combinators
|
||||||
combinators kernel system
|
gobject-introspection system vocabs.loader ;
|
||||||
gobject-introspection pango.ffi ;
|
|
||||||
IN: pango.cairo.ffi
|
IN: pango.cairo.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"pango.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: pango.cairo
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"pango.cairo" {
|
"pango.cairo" {
|
||||||
{ [ os winnt? ] [ "libpangocairo-1.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libpangocairo-1.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -13,14 +18,9 @@ IN: pango.cairo.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.Context cairo_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.ScaledFont cairo_scaled_font_t
|
||||||
|
FOREIGN-ENUM-TYPE: cairo.FontType cairo_font_type_t
|
||||||
|
FOREIGN-RECORD-TYPE: cairo.FontOptions cairo_font_options_t
|
||||||
|
|
||||||
GIR: vocab:pango/cairo/PangoCairo-1.0.gir
|
GIR: vocab:pango/cairo/PangoCairo-1.0.gir
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_update_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_show_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoLayout*
|
|
||||||
pango_cairo_create_layout ( cairo_t* cr ) ;
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
! Copyright (C) 2009 Anton Gorenko.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.destructors alien.libraries
|
USING: alien alien.c-types alien.destructors alien.libraries
|
||||||
alien.syntax combinators kernel system
|
alien.syntax combinators gobject-introspection
|
||||||
gobject-introspection glib.ffi ;
|
gobject-introspection.standard-types system vocabs.loader ;
|
||||||
IN: pango.ffi
|
IN: pango.ffi
|
||||||
|
|
||||||
|
<<
|
||||||
|
"gobject.ffi" require
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: pango
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"pango" {
|
"pango" {
|
||||||
{ [ os winnt? ] [ "libpango-1.0-0.dll" cdecl add-library ] }
|
{ [ os winnt? ] [ "libpango-1.0-0.dll" cdecl add-library ] }
|
||||||
|
@ -13,9 +19,6 @@ IN: pango.ffi
|
||||||
} cond
|
} cond
|
||||||
>>
|
>>
|
||||||
|
|
||||||
TYPEDEF: void PangoLayoutRun
|
|
||||||
TYPEDEF: guint32 PangoGlyph
|
|
||||||
|
|
||||||
IMPLEMENT-STRUCTS: PangoRectangle ;
|
IMPLEMENT-STRUCTS: PangoRectangle ;
|
||||||
|
|
||||||
GIR: vocab:pango/Pango-1.0.gir
|
GIR: vocab:pango/Pango-1.0.gir
|
||||||
|
@ -23,3 +26,14 @@ GIR: vocab:pango/Pango-1.0.gir
|
||||||
DESTRUCTOR: pango_font_description_free
|
DESTRUCTOR: pango_font_description_free
|
||||||
DESTRUCTOR: pango_layout_iter_free
|
DESTRUCTOR: pango_layout_iter_free
|
||||||
|
|
||||||
|
! <workaround
|
||||||
|
|
||||||
|
FORGET: pango_layout_line_index_to_x
|
||||||
|
FUNCTION: void
|
||||||
|
pango_layout_line_index_to_x ( PangoLayoutLine* line, gint index_, gboolean trailing, gint* x_pos ) ;
|
||||||
|
|
||||||
|
FORGET: pango_layout_line_x_to_index
|
||||||
|
FUNCTION: gboolean
|
||||||
|
pango_layout_line_x_to_index ( PangoLayoutLine* line, gint x_pos, gint* index_, gint* trailing ) ;
|
||||||
|
|
||||||
|
! workaround>
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
! Copyright (C) 2010 Anton Gorenko, Philipp Brüschweiler.
|
! Copyright (C) 2010 Anton Gorenko, Philipp Brüschweiler.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.accessors alien.c-types alien.data
|
USING: accessors alien.accessors alien.c-types alien.data
|
||||||
alien.strings arrays assocs classes.struct command-line destructors
|
alien.strings alien.syntax arrays assocs classes.struct command-line
|
||||||
gdk.ffi gdk.gl.ffi glib.ffi gobject.ffi gtk.ffi gtk.gl.ffi io.backend
|
destructors gdk.ffi gdk.gl.ffi glib.ffi
|
||||||
io.backend.unix.multiplexers io.encodings.utf8 io.thread kernel libc
|
gobject-introspection.standard-types gobject.ffi gtk.ffi gtk.gl.ffi
|
||||||
literals locals math math.bitwise math.order math.vectors namespaces
|
io.backend io.backend.unix.multiplexers io.encodings.utf8 io.thread
|
||||||
sequences strings system threads ui ui.backend ui.clipboards
|
kernel libc literals locals math math.bitwise math.order math.vectors
|
||||||
ui.event-loop ui.gadgets ui.gadgets.editors ui.gadgets.private
|
namespaces sequences strings system threads ui ui.backend
|
||||||
ui.gadgets.worlds ui.gestures ui.pixel-formats
|
ui.clipboards ui.event-loop ui.gadgets ui.gadgets.editors
|
||||||
|
ui.gadgets.private ui.gadgets.worlds ui.gestures ui.pixel-formats
|
||||||
ui.pixel-formats.private ui.private ;
|
ui.pixel-formats.private ui.private ;
|
||||||
IN: ui.backend.gtk
|
IN: ui.backend.gtk
|
||||||
|
|
||||||
|
@ -144,33 +145,33 @@ CONSTANT: modifiers
|
||||||
|
|
||||||
CONSTANT: action-key-codes
|
CONSTANT: action-key-codes
|
||||||
H{
|
H{
|
||||||
{ $ GDK_BackSpace "BACKSPACE" }
|
{ $ GDK_KEY_BackSpace "BACKSPACE" }
|
||||||
{ $ GDK_Tab "TAB" }
|
{ $ GDK_KEY_Tab "TAB" }
|
||||||
{ $ GDK_Return "RET" }
|
{ $ GDK_KEY_Return "RET" }
|
||||||
{ $ GDK_KP_Enter "ENTER" }
|
{ $ GDK_KEY_KP_Enter "ENTER" }
|
||||||
{ $ GDK_Escape "ESC" }
|
{ $ GDK_KEY_Escape "ESC" }
|
||||||
{ $ GDK_Delete "DELETE" }
|
{ $ GDK_KEY_Delete "DELETE" }
|
||||||
{ $ GDK_Home "HOME" }
|
{ $ GDK_KEY_Home "HOME" }
|
||||||
{ $ GDK_Left "LEFT" }
|
{ $ GDK_KEY_Left "LEFT" }
|
||||||
{ $ GDK_Up "UP" }
|
{ $ GDK_KEY_Up "UP" }
|
||||||
{ $ GDK_Right "RIGHT" }
|
{ $ GDK_KEY_Right "RIGHT" }
|
||||||
{ $ GDK_Down "DOWN" }
|
{ $ GDK_KEY_Down "DOWN" }
|
||||||
{ $ GDK_Page_Up "PAGE_UP" }
|
{ $ GDK_KEY_Page_Up "PAGE_UP" }
|
||||||
{ $ GDK_Page_Down "PAGE_DOWN" }
|
{ $ GDK_KEY_Page_Down "PAGE_DOWN" }
|
||||||
{ $ GDK_End "END" }
|
{ $ GDK_KEY_End "END" }
|
||||||
{ $ GDK_Begin "BEGIN" }
|
{ $ GDK_KEY_Begin "BEGIN" }
|
||||||
{ $ GDK_F1 "F1" }
|
{ $ GDK_KEY_F1 "F1" }
|
||||||
{ $ GDK_F2 "F2" }
|
{ $ GDK_KEY_F2 "F2" }
|
||||||
{ $ GDK_F3 "F3" }
|
{ $ GDK_KEY_F3 "F3" }
|
||||||
{ $ GDK_F4 "F4" }
|
{ $ GDK_KEY_F4 "F4" }
|
||||||
{ $ GDK_F5 "F5" }
|
{ $ GDK_KEY_F5 "F5" }
|
||||||
{ $ GDK_F6 "F6" }
|
{ $ GDK_KEY_F6 "F6" }
|
||||||
{ $ GDK_F7 "F7" }
|
{ $ GDK_KEY_F7 "F7" }
|
||||||
{ $ GDK_F8 "F8" }
|
{ $ GDK_KEY_F8 "F8" }
|
||||||
{ $ GDK_F9 "F9" }
|
{ $ GDK_KEY_F9 "F9" }
|
||||||
{ $ GDK_F10 "F10" }
|
{ $ GDK_KEY_F10 "F10" }
|
||||||
{ $ GDK_F11 "F11" }
|
{ $ GDK_KEY_F11 "F11" }
|
||||||
{ $ GDK_F12 "F12" }
|
{ $ GDK_KEY_F12 "F12" }
|
||||||
}
|
}
|
||||||
|
|
||||||
: event-modifiers ( event -- seq )
|
: event-modifiers ( event -- seq )
|
||||||
|
@ -195,30 +196,24 @@ CONSTANT: action-key-codes
|
||||||
|
|
||||||
: on-motion ( win event user-data -- ? )
|
: on-motion ( win event user-data -- ? )
|
||||||
drop swap
|
drop swap
|
||||||
[ GdkEventMotion memory>struct event-loc ] dip window
|
[ event-loc ] dip window
|
||||||
move-hand fire-motion t ;
|
move-hand fire-motion t ;
|
||||||
|
|
||||||
: on-enter ( win event user-data -- ? )
|
|
||||||
on-motion ;
|
|
||||||
|
|
||||||
: on-leave ( win event user-data -- ? )
|
: on-leave ( win event user-data -- ? )
|
||||||
3drop forget-rollover t ;
|
3drop forget-rollover t ;
|
||||||
|
|
||||||
: on-button-press ( win event user-data -- ? )
|
: on-button-press ( win event user-data -- ? )
|
||||||
drop swap [
|
drop swap [
|
||||||
GdkEventButton memory>struct
|
|
||||||
mouse-event>gesture [ <button-down> ] dip
|
mouse-event>gesture [ <button-down> ] dip
|
||||||
] dip window send-button-down t ;
|
] dip window send-button-down t ;
|
||||||
|
|
||||||
: on-button-release ( win event user-data -- ? )
|
: on-button-release ( win event user-data -- ? )
|
||||||
drop swap [
|
drop swap [
|
||||||
GdkEventButton memory>struct
|
|
||||||
mouse-event>gesture [ <button-up> ] dip
|
mouse-event>gesture [ <button-up> ] dip
|
||||||
] dip window send-button-up t ;
|
] dip window send-button-up t ;
|
||||||
|
|
||||||
: on-scroll ( win event user-data -- ? )
|
: on-scroll ( win event user-data -- ? )
|
||||||
drop swap [
|
drop swap [
|
||||||
GdkEventScroll memory>struct
|
|
||||||
[ scroll-direction ] [ event-loc ] bi
|
[ scroll-direction ] [ event-loc ] bi
|
||||||
] dip window send-scroll t ;
|
] dip window send-scroll t ;
|
||||||
|
|
||||||
|
@ -227,7 +222,6 @@ CONSTANT: action-key-codes
|
||||||
[ gdk_keyval_to_unicode [ f ] [ 1string ] if-zero f ] ?if ;
|
[ gdk_keyval_to_unicode [ f ] [ 1string ] if-zero f ] ?if ;
|
||||||
|
|
||||||
: key-event>gesture ( event -- mods sym/f action? )
|
: key-event>gesture ( event -- mods sym/f action? )
|
||||||
GdkEventKey memory>struct
|
|
||||||
[ event-modifiers ] [ key-sym ] bi ;
|
[ event-modifiers ] [ key-sym ] bi ;
|
||||||
|
|
||||||
: on-key-press ( win event user-data -- ? )
|
: on-key-press ( win event user-data -- ? )
|
||||||
|
@ -250,8 +244,6 @@ CONSTANT: action-key-codes
|
||||||
GtkWidget:motion-notify-event connect-signal
|
GtkWidget:motion-notify-event connect-signal
|
||||||
win "leave-notify-event" [ on-leave yield ]
|
win "leave-notify-event" [ on-leave yield ]
|
||||||
GtkWidget:leave-notify-event connect-signal
|
GtkWidget:leave-notify-event connect-signal
|
||||||
win "enter-notify-event" [ on-enter yield ]
|
|
||||||
GtkWidget:enter-notify-event connect-signal
|
|
||||||
win "button-press-event" [ on-button-press yield ]
|
win "button-press-event" [ on-button-press yield ]
|
||||||
GtkWidget:button-press-event connect-signal
|
GtkWidget:button-press-event connect-signal
|
||||||
win "button-release-event" [ on-button-release yield ]
|
win "button-release-event" [ on-button-release yield ]
|
||||||
|
@ -323,7 +315,7 @@ M: editor get-cursor-loc&dim
|
||||||
[ delete-cursor-surrounding t ] [ 3drop f ] if nip ;
|
[ delete-cursor-surrounding t ] [ 3drop f ] if nip ;
|
||||||
|
|
||||||
: get-preedit-string ( im-context -- str cursor-pos )
|
: get-preedit-string ( im-context -- str cursor-pos )
|
||||||
{ void* int } [ f swap gtk_im_context_get_preedit_string ]
|
{ pointer: gchar gint } [ f swap gtk_im_context_get_preedit_string ]
|
||||||
with-out-parameters
|
with-out-parameters
|
||||||
[ [ utf8 alien>string ] [ g_free ] bi ] dip ;
|
[ [ utf8 alien>string ] [ g_free ] bi ] dip ;
|
||||||
|
|
||||||
|
@ -340,7 +332,11 @@ M: editor get-cursor-loc&dim
|
||||||
|
|
||||||
: gadget-cursor-location ( gadget -- rectangle )
|
: gadget-cursor-location ( gadget -- rectangle )
|
||||||
[ gadget-location ] [ get-cursor-loc&dim ] bi [ v+ ] dip
|
[ gadget-location ] [ get-cursor-loc&dim ] bi [ v+ ] dip
|
||||||
[ first2 ] bi@ GdkRectangle <struct-boa> ;
|
[ first2 ] bi@
|
||||||
|
! <workaround
|
||||||
|
cairo_rectangle_int_t <struct-boa> ;
|
||||||
|
! workaround>
|
||||||
|
! GdkRectangle <struct-boa> ;
|
||||||
|
|
||||||
: update-cursor-location ( im-context gadget -- )
|
: update-cursor-location ( im-context gadget -- )
|
||||||
gadget-cursor-location gtk_im_context_set_cursor_location ;
|
gadget-cursor-location gtk_im_context_set_cursor_location ;
|
||||||
|
@ -464,7 +460,7 @@ M: gtk-ui-backend (free-pixel-format)
|
||||||
|
|
||||||
M: gtk-ui-backend (pixel-format-attribute)
|
M: gtk-ui-backend (pixel-format-attribute)
|
||||||
[ handle>> ] [ >gl-config-attribs ] bi*
|
[ handle>> ] [ >gl-config-attribs ] bi*
|
||||||
{ int } [ gdk_gl_config_get_attrib drop ]
|
{ gint } [ gdk_gl_config_get_attrib drop ]
|
||||||
with-out-parameters ;
|
with-out-parameters ;
|
||||||
|
|
||||||
M: window-handle select-gl-context ( handle -- )
|
M: window-handle select-gl-context ( handle -- )
|
||||||
|
@ -557,16 +553,20 @@ M: gtk-ui-backend beep
|
||||||
gdk_beep ;
|
gdk_beep ;
|
||||||
|
|
||||||
M:: gtk-ui-backend system-alert ( caption text -- )
|
M:: gtk-ui-backend system-alert ( caption text -- )
|
||||||
|
[
|
||||||
f GTK_DIALOG_MODAL GTK_MESSAGE_WARNING GTK_BUTTONS_OK
|
f GTK_DIALOG_MODAL GTK_MESSAGE_WARNING GTK_BUTTONS_OK
|
||||||
caption utf8 string>alien f gtk_message_dialog_new
|
caption utf8 string>alien f
|
||||||
[ text utf8 string>alien f gtk_message_dialog_format_secondary_text ]
|
gtk_message_dialog_new >k_widget_destroy
|
||||||
[ gtk_dialog_run drop ]
|
[
|
||||||
[ gtk_widget_destroy ] tri ;
|
text utf8 string>alien f
|
||||||
|
gtk_message_dialog_format_secondary_text
|
||||||
|
] [ gtk_dialog_run drop ] bi
|
||||||
|
] with-destructors ;
|
||||||
|
|
||||||
M: gtk-ui-backend (with-ui)
|
M: gtk-ui-backend (with-ui)
|
||||||
[
|
[
|
||||||
f f gtk_init
|
0 <int> f <void*> gtk_init
|
||||||
f f gtk_gl_init
|
0 <int> f <void*> gtk_gl_init
|
||||||
init-clipboard
|
init-clipboard
|
||||||
start-ui
|
start-ui
|
||||||
stop-io-thread
|
stop-io-thread
|
||||||
|
@ -577,6 +577,7 @@ M: gtk-ui-backend (with-ui)
|
||||||
] with-destructors
|
] with-destructors
|
||||||
] ui-running ;
|
] ui-running ;
|
||||||
|
|
||||||
|
|
||||||
gtk-ui-backend ui-backend set-global
|
gtk-ui-backend ui-backend set-global
|
||||||
|
|
||||||
[ "ui.tools" ] main-vocab-hook set-global
|
[ "ui.tools" ] main-vocab-hook set-global
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
! Copyright (C) 2009, 2010 Slava Pestov.
|
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.c-types alien.strings arrays assocs cache cairo
|
USING: accessors alien.c-types alien.data alien.strings arrays assocs
|
||||||
cairo.ffi classes.struct combinators destructors fonts fry
|
cache cairo cairo.ffi classes.struct combinators destructors fonts fry
|
||||||
init io.encodings.utf8 kernel math math.rectangles math.vectors
|
gobject.ffi init io.encodings.utf8 kernel math math.rectangles
|
||||||
memoize namespaces sequences ui.text ui.text.private
|
math.vectors memoize namespaces pango.cairo.ffi pango.ffi sequences
|
||||||
gobject.ffi pango.ffi pango.cairo.ffi ;
|
ui.text ui.text.private ;
|
||||||
IN: ui.text.pango
|
IN: ui.text.pango
|
||||||
|
|
||||||
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
||||||
|
@ -69,16 +69,17 @@ SYMBOL: dpi
|
||||||
: line-offset>x ( layout n -- x )
|
: line-offset>x ( layout n -- x )
|
||||||
#! n is an index into the UTF8 encoding of the text
|
#! n is an index into the UTF8 encoding of the text
|
||||||
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
|
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
|
||||||
f 0 <int> [ pango_layout_line_index_to_x ] keep
|
f { int } [ pango_layout_line_index_to_x ] with-out-parameters
|
||||||
*int pango>float ;
|
pango>float ;
|
||||||
|
|
||||||
: x>line-offset ( layout x -- n )
|
: x>line-offset ( layout x -- n )
|
||||||
#! n is an index into the UTF8 encoding of the text
|
#! n is an index into the UTF8 encoding of the text
|
||||||
[
|
[
|
||||||
[ first-line ] dip
|
[ first-line ] dip
|
||||||
float>pango 0 <int> 0 <int>
|
float>pango
|
||||||
[ pango_layout_line_x_to_index drop ] 2keep
|
{ int int }
|
||||||
[ *int ] bi@ swap
|
[ pango_layout_line_x_to_index drop ] with-out-parameters
|
||||||
|
swap
|
||||||
] [ drop string>> ] 2bi utf8-index> + ;
|
] [ drop string>> ] 2bi utf8-index> + ;
|
||||||
|
|
||||||
: selection-start/end ( selection -- start end )
|
: selection-start/end ( selection -- start end )
|
||||||
|
|
Loading…
Reference in New Issue