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.
|
||||
USING: alien alien.libraries alien.syntax combinators kernel
|
||||
system
|
||||
gobject-introspection glib.ffi gobject.ffi ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: atk.ffi
|
||||
|
||||
<<
|
||||
"gobject.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: atk
|
||||
|
||||
<<
|
||||
"atk" {
|
||||
{ [ os winnt? ] [ "libatk-1.0-0.dll" cdecl add-library ] }
|
||||
|
@ -13,11 +18,4 @@ IN: atk.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
TYPEDEF: guint64 AtkState
|
||||
TYPEDEF: GSList AtkAttributeSet
|
||||
|
||||
! gir: error
|
||||
C-TYPE: AtkPropertyValues
|
||||
|
||||
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.
|
||||
USING: alien alien.c-types alien.destructors alien.syntax
|
||||
alien.libraries cairo.ffi combinators kernel system
|
||||
gobject-introspection gdk.pixbuf.ffi gio.ffi glib.ffi gmodule.ffi
|
||||
gobject.ffi pango.ffi ;
|
||||
USING: alien alien.c-types alien.destructors alien.libraries
|
||||
alien.syntax cairo.ffi classes.struct combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gdk.ffi
|
||||
|
||||
<<
|
||||
"pango.ffi" require
|
||||
"gdk.pixbuf.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gdk
|
||||
|
||||
<<
|
||||
"gdk" {
|
||||
{ [ os winnt? ] [ "libgdk-win32-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -14,12 +20,6 @@ IN: gdk.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
TYPEDEF: guint32 GdkNativeWindow
|
||||
TYPEDEF: guint32 GdkWChar
|
||||
C-TYPE: GdkXEvent
|
||||
|
||||
REPLACE-C-TYPE: any gpointer
|
||||
|
||||
IMPLEMENT-STRUCTS: GdkEventAny GdkEventKey GdkEventButton
|
||||
GdkEventScroll GdkEventMotion GdkEventExpose GdkEventVisibility
|
||||
GdkEventCrossing GdkEventFocus GdkEventConfigure GdkEventProperty
|
||||
|
@ -27,7 +27,21 @@ GdkEventSelection GdkEventDND GdkEventProximity GdkEventClient
|
|||
GdkEventNoExpose GdkEventWindowState GdkEventSetting
|
||||
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
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,15 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types alien.libraries combinators kernel
|
||||
system vocabs.parser words
|
||||
gobject-introspection gdk.ffi gdk.pixbuf.ffi gio.ffi glib.ffi
|
||||
gmodule.ffi gobject.ffi pango.ffi ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gdk.gl.ffi
|
||||
|
||||
<<
|
||||
"gdk.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gdk.gl
|
||||
|
||||
<<
|
||||
"gdk.gl" {
|
||||
{ [ os winnt? ] [ drop ] }
|
||||
|
@ -14,7 +18,4 @@ IN: gdk.gl.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
<< ulong "unsigned long" current-vocab create typedef >>
|
||||
|
||||
GIR: vocab:gdk/gl/GdkGL-1.0.gir
|
||||
|
||||
GIR: vocab:gdk/gl/GdkGLExt-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.
|
||||
USING: alien alien.libraries combinators kernel system
|
||||
gobject-introspection gio.ffi glib.ffi gmodule.ffi gobject.ffi ;
|
||||
EXCLUDE: alien.c-types => pointer ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gdk.pixbuf.ffi
|
||||
|
||||
<<
|
||||
"gio.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gdk.pixbuf
|
||||
|
||||
<<
|
||||
"gdk.pixbuf" {
|
||||
{ [ 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
|
||||
|
||||
|
|
39131
basis/gio/Gio-2.0.gir
39131
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.
|
||||
USING: alien alien.libraries combinators kernel system
|
||||
gobject-introspection glib.ffi gobject.ffi ;
|
||||
EXCLUDE: alien.c-types => pointer ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gio.ffi
|
||||
|
||||
<<
|
||||
"gobject.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gio
|
||||
|
||||
<<
|
||||
"gio" {
|
||||
{ [ os winnt? ] [ "libgio-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -14,4 +19,3 @@ IN: gio.ffi
|
|||
>>
|
||||
|
||||
GIR: vocab:gio/Gio-2.0.gir
|
||||
|
||||
|
|
22216
basis/glib/GLib-2.0.gir
22216
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.
|
||||
USING: accessors alien alien.c-types alien.destructors
|
||||
alien.libraries alien.syntax classes.struct combinators
|
||||
compiler.units gobject-introspection kernel system vocabs.parser
|
||||
words ;
|
||||
USING: alien alien.destructors alien.libraries alien.syntax
|
||||
combinators gobject-introspection gobject-introspection.standard-types
|
||||
system ;
|
||||
IN: glib.ffi
|
||||
|
||||
LIBRARY: glib
|
||||
|
||||
<<
|
||||
"glib" {
|
||||
{ [ os winnt? ] [ "libglib-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -14,62 +15,6 @@ IN: glib.ffi
|
|||
} 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 ;
|
||||
|
||||
CONSTANT: G_MININT8 HEX: -80
|
||||
|
@ -93,4 +38,3 @@ DESTRUCTOR: g_free
|
|||
CALLBACK: gboolean GSourceFuncsPrepareFunc ( GSource* source, gint* timeout_ ) ;
|
||||
CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ;
|
||||
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!
|
||||
To affect the contents of this file, edit the original C definitions,
|
||||
and/or use gtk-doc annotations. -->
|
||||
<repository version="1.0"
|
||||
<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">
|
||||
|
@ -12,11 +12,12 @@ and/or use gtk-doc annotations. -->
|
|||
<namespace name="GModule"
|
||||
version="2.0"
|
||||
shared-library="libgmodule-2.0.so.0"
|
||||
c:prefix="g">
|
||||
<record name="Module" c:type="GModule">
|
||||
c:identifier-prefixes="G"
|
||||
c:symbol-prefixes="g">
|
||||
<record name="Module" c:type="GModule" disguised="1">
|
||||
<method name="close" c:identifier="g_module_close">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="boolean" c:type="gboolean"/>
|
||||
<type name="gboolean" c:type="gboolean"/>
|
||||
</return-value>
|
||||
</method>
|
||||
<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"/>
|
||||
</return-value>
|
||||
</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">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="boolean" c:type="gboolean"/>
|
||||
<type name="gboolean" c:type="gboolean"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="symbol_name" transfer-ownership="none">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</parameter>
|
||||
<parameter name="symbol" transfer-ownership="none">
|
||||
<type name="any" c:type="gpointer*"/>
|
||||
<type name="gpointer" c:type="gpointer*"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="name" c:identifier="g_module_name">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</return-value>
|
||||
</method>
|
||||
</record>
|
||||
<callback name="ModuleCheckInit" c:type="GModuleCheckInit">
|
||||
<return-value transfer-ownership="none">
|
||||
|
@ -68,7 +69,7 @@ and/or use gtk-doc annotations. -->
|
|||
</parameter>
|
||||
</parameters>
|
||||
</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">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</return-value>
|
||||
|
@ -81,13 +82,15 @@ and/or use gtk-doc annotations. -->
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="error" c:identifier="g_module_error">
|
||||
<function name="module_error" c:identifier="g_module_error">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</return-value>
|
||||
</function>
|
||||
<function name="open" c:identifier="g_module_open">
|
||||
<return-value transfer-ownership="full">
|
||||
<function name="module_open"
|
||||
c:identifier="g_module_open"
|
||||
introspectable="0">
|
||||
<return-value>
|
||||
<type name="Module" c:type="GModule*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
|
@ -99,9 +102,9 @@ and/or use gtk-doc annotations. -->
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="supported" c:identifier="g_module_supported">
|
||||
<function name="module_supported" c:identifier="g_module_supported">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="boolean" c:type="gboolean"/>
|
||||
<type name="gboolean" c:type="gboolean"/>
|
||||
</return-value>
|
||||
</function>
|
||||
</namespace>
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
! Copyright (C) 2009 Anton Gorenko.
|
||||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.libraries combinators kernel system
|
||||
gobject-introspection glib.ffi ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gmodule.ffi
|
||||
|
||||
<<
|
||||
"glib.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gmodule
|
||||
|
||||
<<
|
||||
"gmodule" {
|
||||
{ [ os winnt? ] [ "libgmodule-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -13,4 +19,3 @@ IN: gmodule.ffi
|
|||
>>
|
||||
|
||||
GIR: vocab:gmodule/GModule-2.0.gir
|
||||
|
||||
|
|
|
@ -1,21 +1,9 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs kernel namespaces ;
|
||||
USING: namespaces ;
|
||||
IN: gobject-introspection.common
|
||||
|
||||
CONSTANT: ffi-vocab "ffi"
|
||||
|
||||
SYMBOL: current-lib
|
||||
|
||||
SYMBOL: type-infos
|
||||
type-infos [ H{ } ] initialize
|
||||
|
||||
SYMBOL: aliases
|
||||
aliases [ H{ } ] initialize
|
||||
SYMBOL: current-namespace-name
|
||||
|
||||
SYMBOL: implement-structs
|
||||
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.
|
||||
USING: accessors alien alien.c-types alien.parser arrays assocs
|
||||
classes.parser classes.struct combinators
|
||||
combinators.short-circuit definitions effects fry
|
||||
gobject-introspection.common gobject-introspection.types kernel
|
||||
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 ;
|
||||
IN: gobject-introspection.ffi
|
||||
|
||||
: string>c-type ( str -- c-type )
|
||||
dup CHAR: * swap index [ cut ] [ "" ] if*
|
||||
[ replaced-c-types get-global ?at drop ] dip
|
||||
append parse-c-type ;
|
||||
|
||||
: define-each ( nodes quot -- )
|
||||
'[ dup @ >>ffi drop ] each ; inline
|
||||
SYMBOL: constant-prefix
|
||||
|
||||
: function-ffi-invoker ( func -- quot )
|
||||
{
|
||||
[ return>> c-type>> string>c-type ]
|
||||
[ drop current-lib get-global ]
|
||||
[ identifier>> ]
|
||||
[ parameters>> [ c-type>> string>c-type ] map ]
|
||||
[ varargs?>> [ void* suffix ] when ]
|
||||
} cleave function-quot ;
|
||||
: def-c-type ( c-type-name base-c-type -- )
|
||||
swap (CREATE-C-TYPE) typedef ;
|
||||
|
||||
: function-ffi-effect ( func -- effect )
|
||||
[ parameters>> [ name>> ] map ]
|
||||
[ varargs?>> [ "varargs" suffix ] when ]
|
||||
[ return>> type>> none-type? { } { "result" } ? ] tri
|
||||
<effect> ;
|
||||
: defer-c-type ( c-type-name -- c-type )
|
||||
deferred-type swap (CREATE-C-TYPE) [ typedef ] keep ;
|
||||
! create-in dup
|
||||
! [ fake-definition ] [ undefined-def define ] bi ;
|
||||
|
||||
: define-ffi-function ( func -- word )
|
||||
[ identifier>> create-in dup ]
|
||||
[ function-ffi-invoker ] [ function-ffi-effect ] tri
|
||||
define-declared ;
|
||||
:: defer-types ( types type-info-class -- )
|
||||
types [
|
||||
[ c-type>> defer-c-type ]
|
||||
[ name>> qualified-name ] bi
|
||||
type-info-class new swap register-type
|
||||
] each ;
|
||||
|
||||
: define-ffi-functions ( functions -- )
|
||||
[ define-ffi-function ] define-each ;
|
||||
: def-alias-c-type ( base-c-type c-type-name -- c-type )
|
||||
(CREATE-C-TYPE) [ typedef ] keep ;
|
||||
|
||||
: callback-ffi-invoker ( callback -- quot )
|
||||
[ return>> c-type>> string>c-type ]
|
||||
[ parameters>> [ c-type>> string>c-type ] map ] bi
|
||||
cdecl callback-quot ;
|
||||
: alias-c-type-name ( alias -- c-type-name )
|
||||
! <workaround for alises w/o c:type (Atk)
|
||||
[ c-type>> ] [ name>> ] bi or ;
|
||||
! workaround>
|
||||
! c-type>> ;
|
||||
|
||||
: callback-ffi-effect ( callback -- effect )
|
||||
[ parameters>> [ name>> ] map ]
|
||||
[ return>> type>> none-type? { } { "result" } ? ] bi
|
||||
<effect> ;
|
||||
:: def-alias ( alias -- )
|
||||
alias type>> get-type-info
|
||||
[ c-type>> alias alias-c-type-name def-alias-c-type ]
|
||||
[ clone ] bi alias name>> qualified-name register-type ;
|
||||
|
||||
: define-ffi-callback ( callback -- word )
|
||||
[ 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 ;
|
||||
: def-aliases ( aliases -- )
|
||||
[ def-alias ] each ;
|
||||
|
||||
: fix-signal-param-c-type ( param -- )
|
||||
dup [ c-type>> ] [ type>> ] bi
|
||||
{
|
||||
[ none-type? ]
|
||||
[ simple-type? ]
|
||||
[ enum-type? ]
|
||||
[ bitfield-type? ]
|
||||
} 1|| [ dup "*" tail? [ CHAR: * suffix ] unless ] unless
|
||||
>>c-type drop ;
|
||||
GENERIC: type>c-type ( type -- c-type )
|
||||
|
||||
: define-ffi-signal ( signal -- word )
|
||||
[ return>> fix-signal-param-c-type ]
|
||||
[ parameters>> [ fix-signal-param-c-type ] each ]
|
||||
[ define-ffi-callback ] tri ;
|
||||
|
||||
: define-ffi-signals ( signals -- )
|
||||
[ define-ffi-signal ] define-each ;
|
||||
M: atomic-type type>c-type get-type-info c-type>> ;
|
||||
M: enum-type type>c-type get-type-info c-type>> ;
|
||||
M: bitfield-type type>c-type get-type-info c-type>> ;
|
||||
M: record-type type>c-type get-type-info c-type>> <pointer> ;
|
||||
M: union-type type>c-type get-type-info c-type>> <pointer> ;
|
||||
M: boxed-type type>c-type get-type-info c-type>> <pointer> ;
|
||||
M: callback-type type>c-type get-type-info c-type>> ;
|
||||
M: class-type type>c-type get-type-info c-type>> <pointer> ;
|
||||
M: interface-type type>c-type get-type-info c-type>> <pointer> ;
|
||||
|
||||
: const-value ( const -- value )
|
||||
[ value>> ] [ type>> name>> ] bi {
|
||||
{ "int" [ string>number ] }
|
||||
{ "double" [ string>number ] }
|
||||
{ "utf8" [ ] }
|
||||
M: boxed-array-type type>c-type
|
||||
name>> simple-type new swap >>name type>c-type ;
|
||||
|
||||
M: c-array-type type>c-type
|
||||
element-type>> type>c-type <pointer> ;
|
||||
|
||||
M: fixed-size-array-type type>c-type
|
||||
[ element-type>> type>c-type ] [ fixed-size>> ] bi 2array ;
|
||||
|
||||
! <workaround for <type/> (in some signals and properties)
|
||||
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 ;
|
||||
|
||||
: define-ffi-enum ( enum -- word )
|
||||
[
|
||||
members>> [
|
||||
[ c-identifier>> create-in ]
|
||||
[ value>> ] bi define-constant
|
||||
] each
|
||||
] [ c-type>> (CREATE-C-TYPE) [ int swap typedef ] keep ] bi ;
|
||||
M: utf8-type parse-const-value drop ;
|
||||
|
||||
: define-ffi-enums ( enums -- )
|
||||
[ define-ffi-enum ] define-each ;
|
||||
|
||||
: define-ffi-bitfields ( bitfields -- )
|
||||
[ define-ffi-enum ] define-each ;
|
||||
: const-value ( const -- value )
|
||||
[ value>> ] [ type>> ] bi parse-const-value ;
|
||||
|
||||
: fields>struct-slots ( fields -- slots )
|
||||
[
|
||||
[ name>> ]
|
||||
: const-name ( const -- name )
|
||||
name>> constant-prefix get swap "_" glue ;
|
||||
|
||||
: 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 ]
|
||||
[
|
||||
[ c-type>> string>c-type ] [ array-info>> ] bi
|
||||
[ fixed-size>> [ 2array ] when* ] when*
|
||||
?suffix-parameters-with-error
|
||||
type type>parameter prefix
|
||||
parameter-names&types
|
||||
]
|
||||
[ drop { } ] tri <struct-slot-spec>
|
||||
] map ;
|
||||
} cleave make-function define-inline ;
|
||||
|
||||
: define-ffi-record-defer ( record -- word )
|
||||
c-type>> create-in void* swap [ typedef ] keep ;
|
||||
: def-methods ( methods type -- )
|
||||
[ def-method ] curry each ;
|
||||
|
||||
: define-ffi-records-defer ( records -- )
|
||||
[ define-ffi-record-defer ] define-each ;
|
||||
: def-callback-type ( callback -- )
|
||||
{
|
||||
[ 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 )
|
||||
dup ffi>> forget
|
||||
dup {
|
||||
[ fields>> empty? not ]
|
||||
[ c-type>> implement-structs get-global member? ]
|
||||
} 1&&
|
||||
GENERIC: field-type>c-type ( data-type -- c-type )
|
||||
|
||||
M: simple-type field-type>c-type type>c-type ;
|
||||
M: inner-callback-type field-type>c-type drop void* ;
|
||||
M: array-type field-type>c-type type>c-type ;
|
||||
|
||||
: 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 ;
|
||||
[
|
||||
[ drop ] ! [ writable?>> [ read-only , ] unless ]
|
||||
[ bits>> [ bits: , , ] when* ] bi
|
||||
] V{ } make
|
||||
] tri <struct-slot-spec> ;
|
||||
|
||||
: define-ffi-records ( records -- )
|
||||
[ define-ffi-record ] define-each ;
|
||||
: 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 ;
|
||||
|
||||
: define-ffi-record-content ( record -- )
|
||||
: def-record ( record -- )
|
||||
{
|
||||
[ constructors>> define-ffi-functions ]
|
||||
[ functions>> define-ffi-functions ]
|
||||
[ methods>> define-ffi-functions ]
|
||||
[ def-record-type ]
|
||||
[ constructors>> def-functions ]
|
||||
[ functions>> def-functions ]
|
||||
[ [ methods>> ] keep def-methods ]
|
||||
} cleave ;
|
||||
|
||||
: define-ffi-records-content ( records -- )
|
||||
[ define-ffi-record-content ] each ;
|
||||
: def-union-type ( union -- )
|
||||
c-type>> void def-c-type ;
|
||||
|
||||
: 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 -- )
|
||||
: def-union ( union -- )
|
||||
{
|
||||
[ methods>> define-ffi-functions ]
|
||||
[ def-union-type ]
|
||||
[ constructors>> def-functions ]
|
||||
[ functions>> def-functions ]
|
||||
[ [ methods>> ] keep def-methods ]
|
||||
} cleave ;
|
||||
|
||||
: define-ffi-interfaces-content ( interfaces -- )
|
||||
[ define-ffi-interface-content ] each ;
|
||||
: def-boxed-type ( boxed -- )
|
||||
c-type>> void def-c-type ;
|
||||
|
||||
: get-type-invoker ( name -- quot )
|
||||
! hack
|
||||
[ "GType" "glib.ffi" lookup current-lib get-global ] dip
|
||||
{ } \ alien-invoke 5 narray >quotation ;
|
||||
: 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 ;
|
||||
|
||||
: define-ffi-class ( class -- word )
|
||||
c-type>> create-in [ void swap typedef ] keep ;
|
||||
: def-signals ( signals type -- )
|
||||
[ def-signal ] curry each ;
|
||||
|
||||
: define-ffi-classes ( class -- )
|
||||
[ define-ffi-class ] define-each ;
|
||||
: def-class-type ( class -- )
|
||||
c-type>> void def-c-type ;
|
||||
|
||||
: define-ffi-class-content ( class -- )
|
||||
: def-class ( class -- )
|
||||
{
|
||||
[ constructors>> define-ffi-functions ]
|
||||
[ functions>> define-ffi-functions ]
|
||||
[ methods>> define-ffi-functions ]
|
||||
[ signals>> define-ffi-signals ]
|
||||
[ def-class-type ]
|
||||
[ constructors>> def-functions ]
|
||||
[ functions>> def-functions ]
|
||||
[ [ methods>> ] keep def-methods ]
|
||||
[ [ signals>> ] keep def-signals ]
|
||||
} cleave ;
|
||||
|
||||
: define-ffi-classes-content ( class -- )
|
||||
[ define-ffi-class-content ] each ;
|
||||
: def-interface-type ( interface -- )
|
||||
c-type>> void def-c-type ;
|
||||
|
||||
: define-get-type ( node -- word )
|
||||
get-type>> dup { "intern" f } member? [ drop f ]
|
||||
[
|
||||
[ create-in dup ] [ get-type-invoker ] bi
|
||||
{ } { "type" } <effect> define-declared
|
||||
] if ;
|
||||
|
||||
: define-get-types ( namespace -- )
|
||||
: def-interface ( class -- )
|
||||
{
|
||||
[ enums>> [ define-get-type drop ] each ]
|
||||
[ bitfields>> [ define-get-type drop ] each ]
|
||||
[ records>> [ define-get-type drop ] each ]
|
||||
[ unions>> [ define-get-type drop ] each ]
|
||||
[ interfaces>> [ define-get-type drop ] each ]
|
||||
[ classes>> [ define-get-type drop ] each ]
|
||||
[ def-interface-type ]
|
||||
[ functions>> def-functions ]
|
||||
[ [ methods>> ] keep def-methods ]
|
||||
[ [ signals>> ] keep def-signals ]
|
||||
} cleave ;
|
||||
|
||||
: define-ffi-const ( const -- word )
|
||||
[ c-identifier>> create-in dup ] [ const-value ] bi
|
||||
define-constant ;
|
||||
: 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 ;
|
||||
|
||||
: define-ffi-consts ( consts -- )
|
||||
[ define-ffi-const ] define-each ;
|
||||
: 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 ;
|
||||
|
||||
: define-ffi-alias ( alias -- )
|
||||
drop ;
|
||||
|
||||
: define-ffi-aliases ( aliases -- )
|
||||
[ define-ffi-alias ] each ;
|
||||
|
||||
: define-ffi-namespace ( namespace -- )
|
||||
: def-namespace ( namespace -- )
|
||||
{
|
||||
[ aliases>> define-ffi-aliases ]
|
||||
[ consts>> define-ffi-consts ]
|
||||
[ enums>> define-ffi-enums ]
|
||||
[ bitfields>> define-ffi-bitfields ]
|
||||
|
||||
[ records>> define-ffi-records-defer ]
|
||||
[ symbol-prefixes>> first >upper constant-prefix set ]
|
||||
[ consts>> def-consts ]
|
||||
|
||||
[ 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 ]
|
||||
[ enums>> defer-enums ]
|
||||
[ bitfields>> defer-bitfields ]
|
||||
[ records>> defer-records ]
|
||||
[ unions>> defer-unions ]
|
||||
[ boxeds>> defer-boxeds ]
|
||||
[ callbacks>> defer-callbacks ]
|
||||
[ interfaces>> defer-interfaces ]
|
||||
[ classes>> defer-classes ]
|
||||
|
||||
[ define-get-types ]
|
||||
[ 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 ;
|
||||
|
||||
: define-ffi-repository ( repository -- )
|
||||
namespace>> define-ffi-namespace ;
|
||||
: 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.
|
||||
USING: accessors assocs combinators gobject-introspection.common
|
||||
gobject-introspection.ffi gobject-introspection.loader kernel lexer
|
||||
locals math namespaces sequences strings.parser vocabs.parser xml ;
|
||||
USING: accessors combinators gobject-introspection.common
|
||||
gobject-introspection.ffi gobject-introspection.loader
|
||||
gobject-introspection.types kernel lexer locals namespaces parser
|
||||
sequences xml ;
|
||||
IN: gobject-introspection
|
||||
|
||||
: with-child-vocab ( name quot -- )
|
||||
swap current-vocab name>>
|
||||
[ swap "." glue set-current-vocab call ] keep
|
||||
set-current-vocab ; inline
|
||||
<PRIVATE
|
||||
|
||||
:: define-gir-vocab ( file-name -- )
|
||||
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
|
||||
V{ } clone implement-structs set-global
|
||||
H{ } clone replaced-c-types set-global ;
|
||||
V{ } clone implement-structs set-global ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
SYNTAX: GIR: scan define-gir-vocab ;
|
||||
|
||||
|
@ -28,6 +24,8 @@ SYNTAX: IMPLEMENT-STRUCTS:
|
|||
";" parse-tokens
|
||||
implement-structs [ swap append! ] change-global ;
|
||||
|
||||
SYNTAX: REPLACE-C-TYPE:
|
||||
scan unescape-string scan swap
|
||||
replaced-c-types get-global set-at ;
|
||||
SYNTAX: FOREIGN-ENUM-TYPE:
|
||||
scan-token scan-object swap register-enum-type ;
|
||||
|
||||
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.
|
||||
USING: accessors ascii combinators fry
|
||||
gobject-introspection.common gobject-introspection.repository
|
||||
gobject-introspection.types literals kernel math.parser sequences
|
||||
splitting xml.data xml.traversal ;
|
||||
FROM: namespaces => set get ;
|
||||
USING: accessors combinators gobject-introspection.repository kernel
|
||||
literals math.parser sequences splitting xml.data xml.traversal ;
|
||||
IN: gobject-introspection.loader
|
||||
|
||||
SYMBOL: namespace-prefix
|
||||
SYMBOL: namespace-PREFIX
|
||||
|
||||
: word-started? ( word letter -- ? )
|
||||
[ last letter? ] [ LETTER? ] bi* and ;
|
||||
|
||||
: 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 ]
|
||||
: xml>simple-type ( xml -- type )
|
||||
[ simple-type new ] dip {
|
||||
[ "name" attr >>name ]
|
||||
[
|
||||
"type" tags-named
|
||||
[ xml>simple-type ] map f like >>element-types
|
||||
]
|
||||
} 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>> {
|
||||
{ "array"
|
||||
[
|
||||
[ xml>array-info ]
|
||||
[ first-child-tag node>type ] bi
|
||||
]
|
||||
}
|
||||
{ "type" [ node>type f swap ] }
|
||||
{ "varargs" [ drop f f ] }
|
||||
{ "callback" [ drop f "any" f type boa ] }
|
||||
{ "type" [ xml>simple-type ] }
|
||||
{ "array"[ xml>array-type ] }
|
||||
{ "callback" [ xml>inner-callback-type ] }
|
||||
{ "varargs" [ xml>varargs-type ] }
|
||||
} case ;
|
||||
|
||||
CONSTANT: type-tags {
|
||||
$[ "array" <null-name> ]
|
||||
$[ "type" <null-name> ]
|
||||
$[ "varargs" <null-name> ]
|
||||
$[ "callback" <null-name> ]
|
||||
}
|
||||
CONSTANT: type-tags
|
||||
$[ { "array" "type" "callback" "varargs" } [ <null-name> ] map ]
|
||||
|
||||
: child-type-tag ( xml -- type-tag )
|
||||
children-tags [
|
||||
type-tags [ swap tag-named? ] with any?
|
||||
] find nip ;
|
||||
|
||||
: load-parameter ( param xml -- param )
|
||||
[ "transfer-ownership" attr >>transfer-ownership ]
|
||||
[ child-type-tag "type" attr >>c-type ]
|
||||
[
|
||||
child-type-tag xml>type
|
||||
[ [ >>array-info ] [ >>type ] bi* ] [ 2drop f ] if*
|
||||
] tri ;
|
||||
|
||||
: xml>alias ( xml -- alias )
|
||||
[ alias new ] dip {
|
||||
[ "name" attr >>name ]
|
||||
[ "type" attr >>c-type ]
|
||||
[ child-type-tag xml>type >>type ]
|
||||
} cleave ;
|
||||
|
||||
: 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 )
|
||||
{
|
||||
[ "name" attr camel>factor >>name ]
|
||||
[ node>type >>type ]
|
||||
[ "type" attr >>c-type ]
|
||||
[ "type-name" attr >>type-name ]
|
||||
[ "name" attr >>name ]
|
||||
[ [ "type" attr ] [ "type-name" attr ] bi or >>c-type ]
|
||||
[ "get-type" attr >>get-type ]
|
||||
} 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 )
|
||||
[ enum-member new ] dip {
|
||||
[ "name" attr underscored>factor >>name ]
|
||||
[ "name" attr >>name ]
|
||||
[ "identifier" attr >>c-identifier ]
|
||||
[ "value" attr string>number >>value ]
|
||||
} cleave ;
|
||||
|
@ -230,78 +80,135 @@ CONSTANT: type-tags {
|
|||
[ "member" tags-named [ xml>member ] map >>members ]
|
||||
} 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 )
|
||||
[ field new ] dip {
|
||||
[ "name" attr >>name ]
|
||||
[ "writable" attr "1" = >>writable? ]
|
||||
[
|
||||
child-type-tag dup name>> main>> "callback" =
|
||||
[ drop "gpointer" ] [ "type" attr ] if
|
||||
>>c-type
|
||||
]
|
||||
[
|
||||
child-type-tag xml>type
|
||||
[ [ >>array-info ] [ >>type ] bi* ] [ 2drop f ] if*
|
||||
]
|
||||
[ "bits" attr string>number >>bits ]
|
||||
[ child-type-tag xml>type >>type ]
|
||||
} cleave ;
|
||||
|
||||
: xml>record ( xml -- record )
|
||||
[ record new ] dip {
|
||||
[ load-type ]
|
||||
[ "disguised" attr "1" = >>disguised? ]
|
||||
[ "field" tags-named [ xml>field ] map >>fields ]
|
||||
[ "constructor" load-functions >>constructors ]
|
||||
[ "method" load-functions >>methods ]
|
||||
[ "function" load-functions >>functions ]
|
||||
[
|
||||
"method" load-functions over type>self-param
|
||||
'[ [ _ prefix ] change-parameters ] map
|
||||
>>methods
|
||||
]
|
||||
[ "disguised" attr "1" = >>disguised? ]
|
||||
} cleave ;
|
||||
|
||||
: xml>union ( xml -- union )
|
||||
[ union new ] dip load-type ;
|
||||
|
||||
: xml>alias ( xml -- alias )
|
||||
[ alias new ] dip {
|
||||
[ node>type >>name ]
|
||||
[ "target" attr full-type-name>type >>target ]
|
||||
[ union new ] dip {
|
||||
[ load-type ]
|
||||
[ "field" tags-named [ xml>field ] map >>fields ]
|
||||
[ "constructor" load-functions >>constructors ]
|
||||
[ "method" load-functions >>methods ]
|
||||
[ "function" load-functions >>functions ]
|
||||
} cleave ;
|
||||
|
||||
: xml>const ( xml -- const )
|
||||
[ const new ] dip {
|
||||
: xml>callback ( xml -- callback )
|
||||
[ callback new ] dip {
|
||||
[ load-type ]
|
||||
[ load-callable ]
|
||||
[ "throws" attr "1" = >>throws? ]
|
||||
} cleave ;
|
||||
|
||||
: xml>signal ( xml -- signal )
|
||||
[ signal new ] dip {
|
||||
[ "name" attr >>name ]
|
||||
[
|
||||
"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 ]
|
||||
[ load-callable ]
|
||||
} 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 )
|
||||
[ namespace new ] dip {
|
||||
[ "name" attr camel>factor >>name ]
|
||||
[ "prefix" attr [ set-prefix ] keep >>prefix ]
|
||||
[ "name" attr >>name ]
|
||||
[ "identifier-prefixes" attr "," split >>identifier-prefixes ]
|
||||
[ "symbol-prefixes" attr "," split >>symbol-prefixes ]
|
||||
[ "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 ]
|
||||
[ "enumeration" tags-named [ xml>enum ] map >>enums ]
|
||||
[ "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 ]
|
||||
} cleave ;
|
||||
|
||||
: xml>repository ( xml -- repository )
|
||||
[ repository new ] dip {
|
||||
[
|
||||
"" "include" f <name> tags-named
|
||||
[ "name" attr camel>factor ] map >>includes
|
||||
]
|
||||
[ "namespace" tag-named xml>namespace >>namespace ]
|
||||
} cleave ;
|
||||
|
||||
[ repository new ] dip
|
||||
"namespace" tag-named xml>namespace >>namespace ;
|
||||
|
|
|
@ -1,64 +1,134 @@
|
|||
! Copyright (C) 2009 Anton Gorenko.
|
||||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: ;
|
||||
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
|
||||
prefix aliases consts classes interfaces records unions callbacks
|
||||
enums bitfields functions ;
|
||||
TUPLE: data-type
|
||||
name ;
|
||||
|
||||
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
|
||||
value c-identifier ffi ;
|
||||
TUPLE: inner-callback-type < data-type ;
|
||||
|
||||
TUPLE: type-node < node
|
||||
type c-type type-name get-type ffi ;
|
||||
TUPLE: varargs-type < data-type ;
|
||||
|
||||
TUPLE: field < typed
|
||||
writable? length? array-info ;
|
||||
TUPLE: alias
|
||||
name
|
||||
c-type
|
||||
type ;
|
||||
|
||||
TUPLE: record < type-node
|
||||
fields constructors methods functions disguised? ;
|
||||
TUPLE: const
|
||||
name
|
||||
value
|
||||
type ;
|
||||
|
||||
TUPLE: union < type-node ;
|
||||
TUPLE: type
|
||||
name
|
||||
c-type
|
||||
get-type ;
|
||||
|
||||
TUPLE: class < record
|
||||
abstract? parent type-struct signals ;
|
||||
TUPLE: enum-member
|
||||
name
|
||||
value
|
||||
c-identifier ;
|
||||
|
||||
TUPLE: interface < type-node
|
||||
methods ;
|
||||
TUPLE: enum < type
|
||||
members ;
|
||||
|
||||
TUPLE: property < type-node
|
||||
readable? writable? construct? construct-only? ;
|
||||
TUPLE: record < type
|
||||
fields
|
||||
constructors
|
||||
methods
|
||||
functions
|
||||
disguised? ;
|
||||
|
||||
TUPLE: callable < type-node
|
||||
return parameters varargs? ;
|
||||
TUPLE: field
|
||||
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
|
||||
direction allow-none? length? transfer-ownership array-info
|
||||
local ;
|
||||
TUPLE: function
|
||||
name
|
||||
identifier
|
||||
return
|
||||
parameters
|
||||
throws? ;
|
||||
|
||||
TUPLE: return < typed
|
||||
transfer-ownership array-info local ;
|
||||
TUPLE: callback < type
|
||||
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.
|
||||
USING: accessors alien alien.c-types assocs
|
||||
combinators.short-circuit gobject-introspection.common
|
||||
gobject-introspection.repository kernel namespaces
|
||||
specialized-arrays ;
|
||||
USING: accessors alien.c-types assocs combinators.short-circuit
|
||||
gobject-introspection.common gobject-introspection.repository kernel
|
||||
locals namespaces parser sequences sets ;
|
||||
IN: gobject-introspection.types
|
||||
|
||||
TUPLE: gwrapper { underlying alien } ;
|
||||
TUPLE: grecord < gwrapper ;
|
||||
TUPLE: gobject < gwrapper ;
|
||||
SYMBOL: type-infos
|
||||
type-infos [ H{ } ] initialize
|
||||
|
||||
SPECIALIZED-ARRAYS:
|
||||
void* bool int uint char uchar short ushort long ulong
|
||||
longlong ulonglong float double ;
|
||||
SYMBOL: standard-types
|
||||
standard-types [ V{ } ] initialize
|
||||
|
||||
CONSTANT: simple-types H{
|
||||
{ "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: type-info c-type ;
|
||||
|
||||
TUPLE: atomic-info < type-info ;
|
||||
TUPLE: enum-info < type-info ;
|
||||
|
||||
TUPLE: bitfield-info < type-info ;
|
||||
|
||||
TUPLE: record-info < type-info ;
|
||||
|
||||
TUPLE: union-info < type-info ;
|
||||
|
||||
TUPLE: boxed-info < type-info ;
|
||||
TUPLE: callback-info < type-info ;
|
||||
|
||||
TUPLE: class-info < type-info ;
|
||||
|
||||
TUPLE: interface-info < type-info ;
|
||||
|
||||
: aliased-type ( alias -- type )
|
||||
aliases get ?at [ aliased-type ] when ;
|
||||
DEFER: find-type-info
|
||||
|
||||
: get-type-info ( type -- info )
|
||||
aliased-type type-infos get at ;
|
||||
PREDICATE: none-type < simple-type
|
||||
name>> "none" = ;
|
||||
|
||||
PREDICATE: none-type < type
|
||||
[ namespace>> not ] [ name>> "none" = ] bi and ;
|
||||
PREDICATE: atomic-type < simple-type
|
||||
find-type-info atomic-info? ;
|
||||
|
||||
PREDICATE: simple-type < type
|
||||
aliased-type
|
||||
[ namespace>> not ] [ name>> simple-types key? ] bi and ;
|
||||
PREDICATE: utf8-type < atomic-type
|
||||
name>> "utf8" = ;
|
||||
|
||||
PREDICATE: utf8-type < type
|
||||
aliased-type
|
||||
[ namespace>> not ] [ name>> "utf8" = ] bi and ;
|
||||
PREDICATE: enum-type < simple-type
|
||||
find-type-info enum-info? ;
|
||||
|
||||
PREDICATE: any-type < type
|
||||
aliased-type
|
||||
[ namespace>> not ] [ name>> "any" = ] bi and ;
|
||||
|
||||
PREDICATE: enum-type < type get-type-info enum-info? ;
|
||||
PREDICATE: bitfield-type < simple-type
|
||||
find-type-info bitfield-info? ;
|
||||
|
||||
PREDICATE: bitfield-type < type get-type-info bitfield-info? ;
|
||||
PREDICATE: record-type < simple-type
|
||||
find-type-info record-info? ;
|
||||
|
||||
PREDICATE: record-type < type get-type-info record-info? ;
|
||||
PREDICATE: union-type < simple-type
|
||||
find-type-info union-info? ;
|
||||
|
||||
PREDICATE: union-type < type get-type-info union-info? ;
|
||||
PREDICATE: boxed-type < simple-type
|
||||
find-type-info boxed-info? ;
|
||||
|
||||
PREDICATE: callback-type < type get-type-info callback-info? ;
|
||||
PREDICATE: callback-type < simple-type
|
||||
find-type-info callback-info? ;
|
||||
|
||||
PREDICATE: class-type < type get-type-info class-info? ;
|
||||
PREDICATE: class-type < simple-type
|
||||
find-type-info class-info? ;
|
||||
|
||||
PREDICATE: interface-type < type get-type-info interface-info? ;
|
||||
PREDICATE: interface-type < simple-type
|
||||
find-type-info interface-info? ;
|
||||
|
||||
: absolute-type ( type -- type' )
|
||||
dup {
|
||||
[ namespace>> ] [ simple-type? ]
|
||||
[ utf8-type? ] [ none-type? ]
|
||||
} 1|| [ current-lib get-global >>namespace ] unless ;
|
||||
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 ;
|
||||
|
||||
: standard-type? ( data-type -- ? )
|
||||
name>> standard-types get-global in? ;
|
||||
|
||||
: 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.
|
||||
USING: alien alien.syntax alien.destructors alien.libraries
|
||||
classes.struct combinators kernel literals math system
|
||||
gobject-introspection glib.ffi ;
|
||||
EXCLUDE: alien.c-types => pointer ;
|
||||
USING: alien alien.destructors alien.libraries alien.syntax
|
||||
combinators gobject-introspection literals math system vocabs.loader ;
|
||||
IN: gobject.ffi
|
||||
|
||||
<<
|
||||
"glib.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gobject
|
||||
|
||||
<<
|
||||
"gobject" {
|
||||
{ [ os winnt? ] [ "libobject-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -14,17 +18,12 @@ IN: gobject.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
TYPEDEF: void* GSignalCMarshaller
|
||||
TYPEDEF: gchar** GStrv
|
||||
TYPEDEF: gchar* gchararray
|
||||
IMPLEMENT-STRUCTS: GValue GParamSpecVariant ;
|
||||
|
||||
GIR: vocab:gobject/GObject-2.0.gir
|
||||
|
||||
IN: gobject.ffi
|
||||
|
||||
FORGET: GValue
|
||||
STRUCT: GValue { g_type GType } { data guint64[2] } ;
|
||||
|
||||
FORGET: GIOCondition
|
||||
FORGET: G_IO_IN
|
||||
FORGET: G_IO_OUT
|
||||
|
@ -33,12 +32,8 @@ FORGET: G_IO_ERR
|
|||
FORGET: G_IO_HUP
|
||||
FORGET: G_IO_NVAL
|
||||
|
||||
FUNCTION: void g_object_unref ( GObject* self ) ;
|
||||
|
||||
DESTRUCTOR: g_object_unref
|
||||
|
||||
TYPEDEF: GParamSpec GParam
|
||||
|
||||
CONSTANT: G_TYPE_INVALID $[ 0 2 shift ]
|
||||
CONSTANT: G_TYPE_NONE $[ 1 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 )
|
||||
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.
|
||||
USING: alien alien.syntax alien.destructors alien.libraries
|
||||
cairo.ffi combinators kernel system
|
||||
gobject-introspection atk.ffi gdk.ffi gdk.pixbuf.ffi gio.ffi
|
||||
glib.ffi gmodule.ffi gobject.ffi pango.ffi ;
|
||||
EXCLUDE: alien.c-types => pointer ;
|
||||
USING: alien alien.c-types alien.destructors alien.libraries
|
||||
alien.syntax combinators gobject-introspection
|
||||
gobject-introspection.standard-types kernel pango.ffi system
|
||||
vocabs.loader ;
|
||||
IN: gtk.ffi
|
||||
|
||||
<<
|
||||
"atk.ffi" require
|
||||
"gdk.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gtk
|
||||
|
||||
<<
|
||||
"gtk" {
|
||||
{ [ os winnt? ] [ "libgtk-win32-2.0-0.dll" cdecl add-library ] }
|
||||
|
@ -15,14 +21,14 @@ IN: gtk.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
TYPEDEF: void GtkAllocation
|
||||
TYPEDEF: void GtkEnumValue
|
||||
TYPEDEF: void GtkFlagValue
|
||||
TYPEDEF: GType GtkType
|
||||
|
||||
IMPLEMENT-STRUCTS: GtkTreeIter ;
|
||||
|
||||
GIR: vocab:gtk/Gtk-2.0.gir
|
||||
GIR: vocab:gtk/Gtk-3.0.gir
|
||||
|
||||
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.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.libraries combinators kernel system
|
||||
gobject-introspection gdk.ffi gdk.pixbuf.ffi gdk.gl.ffi gio.ffi
|
||||
glib.ffi gmodule.ffi gobject.ffi gtk.ffi ;
|
||||
EXCLUDE: alien.c-types => pointer ;
|
||||
USING: alien alien.libraries alien.syntax combinators
|
||||
gobject-introspection kernel system vocabs.loader ;
|
||||
IN: gtk.gl.ffi
|
||||
|
||||
<<
|
||||
"gtk.ffi" require
|
||||
"gdk.gl.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: gtk.gl
|
||||
|
||||
<<
|
||||
"gtk.gl" {
|
||||
{ [ os winnt? ] [ drop ] }
|
||||
|
@ -14,5 +19,4 @@ IN: gtk.gl.ffi
|
|||
} 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!
|
||||
To affect the contents of this file, edit the original C definitions,
|
||||
and/or use gtk-doc annotations. -->
|
||||
<repository version="1.0"
|
||||
<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">
|
||||
|
@ -18,173 +18,361 @@ and/or use gtk-doc annotations. -->
|
|||
<namespace name="PangoCairo"
|
||||
version="1.0"
|
||||
shared-library="libpangocairo-1.0.so.0"
|
||||
c:prefix="PangoCairo">
|
||||
<record name="FcFontMap" c:type="PangoCairoFcFontMap">
|
||||
</record>
|
||||
<record name="Font"
|
||||
c:type="PangoCairoFont"
|
||||
doc="#PangoCairoFont is an interface exported by fonts for
|
||||
c:identifier-prefixes="PangoCairo"
|
||||
c:symbol-prefixes="pango_cairo">
|
||||
<class name="FcFontMap"
|
||||
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"
|
||||
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
|
||||
on the particular font technology Cairo was compiled to use."
|
||||
version="1.18">
|
||||
</record>
|
||||
<record name="FontGlyphExtentsCacheEntry"
|
||||
c:type="PangoCairoFontGlyphExtentsCacheEntry">
|
||||
</record>
|
||||
<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">
|
||||
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">
|
||||
<doc xml:whitespace="preserve">Gets the #cairo_scaled_font_t used by @font.
|
||||
The scaled font can be referenced and kept using
|
||||
cairo_scaled_font_reference().
|
||||
or %NULL if @font is %NULL.</doc>
|
||||
<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>
|
||||
</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"
|
||||
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
|
||||
default fontmap uses for example. The old default font map
|
||||
is unreffed and the new font map referenced.
|
||||
A value of %NULL for @fontmap will cause the current default
|
||||
font map to be released and a new default font
|
||||
map to be created on demand, using pango_cairo_font_map_new()."
|
||||
version="1.22">
|
||||
map to be created on demand, using pango_cairo_font_map_new().</doc>
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="none" c:type="void"/>
|
||||
</return-value>
|
||||
</method>
|
||||
<method name="set_resolution"
|
||||
c:identifier="pango_cairo_font_map_set_resolution"
|
||||
doc="involved; the terminology is conventional.)
|
||||
Sets the resolution for the fontmap. This is a scale factor between
|
||||
version="1.10">
|
||||
<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
|
||||
default value is 96, meaning that a 10 point font will be 13
|
||||
units high. (10 * 96. / 72. = 13.3)."
|
||||
version="1.10">
|
||||
units high. (10 * 96. / 72. = 13.3).</doc>
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="none" c:type="void"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<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>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="get_resolution"
|
||||
c:identifier="pango_cairo_font_map_get_resolution"
|
||||
doc="Gets the resolution for the fontmap. See pango_cairo_font_map_set_resolution()"
|
||||
version="1.10">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="double" c:type="double"/>
|
||||
</return-value>
|
||||
</method>
|
||||
<method name="create_context"
|
||||
c:identifier="pango_cairo_font_map_create_context"
|
||||
doc="Create a #PangoContext for the given fontmap."
|
||||
version="1.10"
|
||||
deprecated="Use pango_font_map_create_context() instead."
|
||||
deprecated-version="1.22">
|
||||
<return-value transfer-ownership="full">
|
||||
<type name="Pango.Context" c:type="PangoContext*"/>
|
||||
</return-value>
|
||||
</method>
|
||||
</record>
|
||||
<record name="FontMapIface" c:type="PangoCairoFontMapIface">
|
||||
</record>
|
||||
<record name="FontPrivate" c:type="PangoCairoFontPrivate">
|
||||
</record>
|
||||
<record name="FontPrivateScaledFontData"
|
||||
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">
|
||||
</interface>
|
||||
<callback name="ShapeRendererFunc" c:type="PangoCairoShapeRendererFunc">
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="double" c:type="double"/>
|
||||
<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="attr" transfer-ownership="none">
|
||||
<type name="Pango.AttrShape" c:type="PangoAttrShape*"/>
|
||||
</parameter>
|
||||
<parameter name="do_path" transfer-ownership="none">
|
||||
<type name="gboolean" c:type="gboolean"/>
|
||||
</parameter>
|
||||
<parameter name="data" transfer-ownership="none">
|
||||
<type name="gpointer" c:type="gpointer"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</callback>
|
||||
<function name="context_get_font_options"
|
||||
c:identifier="pango_cairo_context_get_font_options"
|
||||
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">
|
||||
<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>
|
||||
<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_set_resolution"
|
||||
c:identifier="pango_cairo_context_set_resolution"
|
||||
doc="involved; the terminology is conventional.) A 0 or negative value
|
||||
means to use the resolution from the font map.
|
||||
Sets the resolution for the context. This is a scale factor between
|
||||
points specified in a #PangoFontDescription and Cairo units. The
|
||||
default value is 96, meaning that a 10 point font will be 13
|
||||
units high. (10 * 96. / 72. = 13.3)."
|
||||
<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"
|
||||
c:identifier="pango_cairo_context_set_resolution"
|
||||
version="1.10">
|
||||
<doc xml:whitespace="preserve">Sets the resolution for the context. This is a scale factor between
|
||||
points specified in a #PangoFontDescription and Cairo units. The
|
||||
default value is 96, meaning that a 10 point font will be 13
|
||||
units high. (10 * 96. / 72. = 13.3).</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="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>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="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
|
||||
on the particular font backend Cairo was compiled to use;
|
||||
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
|
||||
change the Cairo font backend that the default fontmap
|
||||
uses for example.
|
||||
object is owned by Pango and must not be freed."
|
||||
version="1.10">
|
||||
<return-value transfer-ownership="full">
|
||||
object is owned by Pango and must not be freed.</doc>
|
||||
<return-value>
|
||||
<doc xml:whitespace="preserve">the default Cairo fontmap for Pango. This</doc>
|
||||
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
|
||||
</return-value>
|
||||
</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>
|
||||
</repository>
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types alien.libraries alien.syntax cairo.ffi
|
||||
combinators kernel system
|
||||
gobject-introspection pango.ffi ;
|
||||
USING: alien alien.libraries alien.syntax cairo.ffi combinators
|
||||
gobject-introspection system vocabs.loader ;
|
||||
IN: pango.cairo.ffi
|
||||
|
||||
<<
|
||||
"pango.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: pango.cairo
|
||||
|
||||
<<
|
||||
"pango.cairo" {
|
||||
{ [ os winnt? ] [ "libpangocairo-1.0-0.dll" cdecl add-library ] }
|
||||
|
@ -13,14 +18,9 @@ IN: pango.cairo.ffi
|
|||
} 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
|
||||
|
||||
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.
|
||||
USING: alien alien.c-types alien.destructors alien.libraries
|
||||
alien.syntax combinators kernel system
|
||||
gobject-introspection glib.ffi ;
|
||||
alien.syntax combinators gobject-introspection
|
||||
gobject-introspection.standard-types system vocabs.loader ;
|
||||
IN: pango.ffi
|
||||
|
||||
<<
|
||||
"gobject.ffi" require
|
||||
>>
|
||||
|
||||
LIBRARY: pango
|
||||
|
||||
<<
|
||||
"pango" {
|
||||
{ [ os winnt? ] [ "libpango-1.0-0.dll" cdecl add-library ] }
|
||||
|
@ -13,9 +19,6 @@ IN: pango.ffi
|
|||
} cond
|
||||
>>
|
||||
|
||||
TYPEDEF: void PangoLayoutRun
|
||||
TYPEDEF: guint32 PangoGlyph
|
||||
|
||||
IMPLEMENT-STRUCTS: PangoRectangle ;
|
||||
|
||||
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_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.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.accessors alien.c-types alien.data
|
||||
alien.strings arrays assocs classes.struct command-line destructors
|
||||
gdk.ffi gdk.gl.ffi glib.ffi gobject.ffi gtk.ffi gtk.gl.ffi io.backend
|
||||
io.backend.unix.multiplexers io.encodings.utf8 io.thread kernel libc
|
||||
literals locals math math.bitwise math.order math.vectors namespaces
|
||||
sequences strings system threads ui ui.backend ui.clipboards
|
||||
ui.event-loop ui.gadgets ui.gadgets.editors ui.gadgets.private
|
||||
ui.gadgets.worlds ui.gestures ui.pixel-formats
|
||||
alien.strings alien.syntax arrays assocs classes.struct command-line
|
||||
destructors gdk.ffi gdk.gl.ffi glib.ffi
|
||||
gobject-introspection.standard-types gobject.ffi gtk.ffi gtk.gl.ffi
|
||||
io.backend io.backend.unix.multiplexers io.encodings.utf8 io.thread
|
||||
kernel libc literals locals math math.bitwise math.order math.vectors
|
||||
namespaces sequences strings system threads ui ui.backend
|
||||
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 ;
|
||||
IN: ui.backend.gtk
|
||||
|
||||
|
@ -144,33 +145,33 @@ CONSTANT: modifiers
|
|||
|
||||
CONSTANT: action-key-codes
|
||||
H{
|
||||
{ $ GDK_BackSpace "BACKSPACE" }
|
||||
{ $ GDK_Tab "TAB" }
|
||||
{ $ GDK_Return "RET" }
|
||||
{ $ GDK_KP_Enter "ENTER" }
|
||||
{ $ GDK_Escape "ESC" }
|
||||
{ $ GDK_Delete "DELETE" }
|
||||
{ $ GDK_Home "HOME" }
|
||||
{ $ GDK_Left "LEFT" }
|
||||
{ $ GDK_Up "UP" }
|
||||
{ $ GDK_Right "RIGHT" }
|
||||
{ $ GDK_Down "DOWN" }
|
||||
{ $ GDK_Page_Up "PAGE_UP" }
|
||||
{ $ GDK_Page_Down "PAGE_DOWN" }
|
||||
{ $ GDK_End "END" }
|
||||
{ $ GDK_Begin "BEGIN" }
|
||||
{ $ GDK_F1 "F1" }
|
||||
{ $ GDK_F2 "F2" }
|
||||
{ $ GDK_F3 "F3" }
|
||||
{ $ GDK_F4 "F4" }
|
||||
{ $ GDK_F5 "F5" }
|
||||
{ $ GDK_F6 "F6" }
|
||||
{ $ GDK_F7 "F7" }
|
||||
{ $ GDK_F8 "F8" }
|
||||
{ $ GDK_F9 "F9" }
|
||||
{ $ GDK_F10 "F10" }
|
||||
{ $ GDK_F11 "F11" }
|
||||
{ $ GDK_F12 "F12" }
|
||||
{ $ GDK_KEY_BackSpace "BACKSPACE" }
|
||||
{ $ GDK_KEY_Tab "TAB" }
|
||||
{ $ GDK_KEY_Return "RET" }
|
||||
{ $ GDK_KEY_KP_Enter "ENTER" }
|
||||
{ $ GDK_KEY_Escape "ESC" }
|
||||
{ $ GDK_KEY_Delete "DELETE" }
|
||||
{ $ GDK_KEY_Home "HOME" }
|
||||
{ $ GDK_KEY_Left "LEFT" }
|
||||
{ $ GDK_KEY_Up "UP" }
|
||||
{ $ GDK_KEY_Right "RIGHT" }
|
||||
{ $ GDK_KEY_Down "DOWN" }
|
||||
{ $ GDK_KEY_Page_Up "PAGE_UP" }
|
||||
{ $ GDK_KEY_Page_Down "PAGE_DOWN" }
|
||||
{ $ GDK_KEY_End "END" }
|
||||
{ $ GDK_KEY_Begin "BEGIN" }
|
||||
{ $ GDK_KEY_F1 "F1" }
|
||||
{ $ GDK_KEY_F2 "F2" }
|
||||
{ $ GDK_KEY_F3 "F3" }
|
||||
{ $ GDK_KEY_F4 "F4" }
|
||||
{ $ GDK_KEY_F5 "F5" }
|
||||
{ $ GDK_KEY_F6 "F6" }
|
||||
{ $ GDK_KEY_F7 "F7" }
|
||||
{ $ GDK_KEY_F8 "F8" }
|
||||
{ $ GDK_KEY_F9 "F9" }
|
||||
{ $ GDK_KEY_F10 "F10" }
|
||||
{ $ GDK_KEY_F11 "F11" }
|
||||
{ $ GDK_KEY_F12 "F12" }
|
||||
}
|
||||
|
||||
: event-modifiers ( event -- seq )
|
||||
|
@ -195,30 +196,24 @@ CONSTANT: action-key-codes
|
|||
|
||||
: on-motion ( win event user-data -- ? )
|
||||
drop swap
|
||||
[ GdkEventMotion memory>struct event-loc ] dip window
|
||||
[ event-loc ] dip window
|
||||
move-hand fire-motion t ;
|
||||
|
||||
: on-enter ( win event user-data -- ? )
|
||||
on-motion ;
|
||||
|
||||
: on-leave ( win event user-data -- ? )
|
||||
3drop forget-rollover t ;
|
||||
|
||||
: on-button-press ( win event user-data -- ? )
|
||||
drop swap [
|
||||
GdkEventButton memory>struct
|
||||
mouse-event>gesture [ <button-down> ] dip
|
||||
] dip window send-button-down t ;
|
||||
|
||||
: on-button-release ( win event user-data -- ? )
|
||||
drop swap [
|
||||
GdkEventButton memory>struct
|
||||
mouse-event>gesture [ <button-up> ] dip
|
||||
] dip window send-button-up t ;
|
||||
|
||||
: on-scroll ( win event user-data -- ? )
|
||||
drop swap [
|
||||
GdkEventScroll memory>struct
|
||||
[ scroll-direction ] [ event-loc ] bi
|
||||
] dip window send-scroll t ;
|
||||
|
||||
|
@ -227,7 +222,6 @@ CONSTANT: action-key-codes
|
|||
[ gdk_keyval_to_unicode [ f ] [ 1string ] if-zero f ] ?if ;
|
||||
|
||||
: key-event>gesture ( event -- mods sym/f action? )
|
||||
GdkEventKey memory>struct
|
||||
[ event-modifiers ] [ key-sym ] bi ;
|
||||
|
||||
: on-key-press ( win event user-data -- ? )
|
||||
|
@ -250,8 +244,6 @@ CONSTANT: action-key-codes
|
|||
GtkWidget:motion-notify-event connect-signal
|
||||
win "leave-notify-event" [ on-leave yield ]
|
||||
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 ]
|
||||
GtkWidget:button-press-event connect-signal
|
||||
win "button-release-event" [ on-button-release yield ]
|
||||
|
@ -274,7 +266,7 @@ CONSTANT: action-key-codes
|
|||
|
||||
: on-configure ( win event user-data -- ? )
|
||||
drop [ window ] [ GdkEventConfigure memory>struct ] bi*
|
||||
[ event-loc >>window-loc ] [ event-dim >>dim ] bi
|
||||
[ event-loc >>window-loc ] [ event-dim >>dim ] bi
|
||||
relayout-1 f ;
|
||||
|
||||
: on-delete ( win event user-data -- ? )
|
||||
|
@ -323,7 +315,7 @@ M: editor get-cursor-loc&dim
|
|||
[ delete-cursor-surrounding t ] [ 3drop f ] if nip ;
|
||||
|
||||
: 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
|
||||
[ [ utf8 alien>string ] [ g_free ] bi ] dip ;
|
||||
|
||||
|
@ -340,7 +332,11 @@ M: editor get-cursor-loc&dim
|
|||
|
||||
: gadget-cursor-location ( gadget -- rectangle )
|
||||
[ 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 -- )
|
||||
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)
|
||||
[ handle>> ] [ >gl-config-attribs ] bi*
|
||||
{ int } [ gdk_gl_config_get_attrib drop ]
|
||||
{ gint } [ gdk_gl_config_get_attrib drop ]
|
||||
with-out-parameters ;
|
||||
|
||||
M: window-handle select-gl-context ( handle -- )
|
||||
|
@ -557,16 +553,20 @@ M: gtk-ui-backend beep
|
|||
gdk_beep ;
|
||||
|
||||
M:: gtk-ui-backend system-alert ( caption text -- )
|
||||
f GTK_DIALOG_MODAL GTK_MESSAGE_WARNING GTK_BUTTONS_OK
|
||||
caption utf8 string>alien f gtk_message_dialog_new
|
||||
[ text utf8 string>alien f gtk_message_dialog_format_secondary_text ]
|
||||
[ gtk_dialog_run drop ]
|
||||
[ gtk_widget_destroy ] tri ;
|
||||
[
|
||||
f GTK_DIALOG_MODAL GTK_MESSAGE_WARNING GTK_BUTTONS_OK
|
||||
caption utf8 string>alien f
|
||||
gtk_message_dialog_new >k_widget_destroy
|
||||
[
|
||||
text utf8 string>alien f
|
||||
gtk_message_dialog_format_secondary_text
|
||||
] [ gtk_dialog_run drop ] bi
|
||||
] with-destructors ;
|
||||
|
||||
M: gtk-ui-backend (with-ui)
|
||||
[
|
||||
f f gtk_init
|
||||
f f gtk_gl_init
|
||||
0 <int> f <void*> gtk_init
|
||||
0 <int> f <void*> gtk_gl_init
|
||||
init-clipboard
|
||||
start-ui
|
||||
stop-io-thread
|
||||
|
@ -577,6 +577,7 @@ M: gtk-ui-backend (with-ui)
|
|||
] with-destructors
|
||||
] ui-running ;
|
||||
|
||||
|
||||
gtk-ui-backend ui-backend set-global
|
||||
|
||||
[ "ui.tools" ] main-vocab-hook set-global
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.c-types alien.strings arrays assocs cache cairo
|
||||
cairo.ffi classes.struct combinators destructors fonts fry
|
||||
init io.encodings.utf8 kernel math math.rectangles math.vectors
|
||||
memoize namespaces sequences ui.text ui.text.private
|
||||
gobject.ffi pango.ffi pango.cairo.ffi ;
|
||||
USING: accessors alien.c-types alien.data alien.strings arrays assocs
|
||||
cache cairo cairo.ffi classes.struct combinators destructors fonts fry
|
||||
gobject.ffi init io.encodings.utf8 kernel math math.rectangles
|
||||
math.vectors memoize namespaces pango.cairo.ffi pango.ffi sequences
|
||||
ui.text ui.text.private ;
|
||||
IN: ui.text.pango
|
||||
|
||||
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
||||
|
@ -69,16 +69,17 @@ SYMBOL: dpi
|
|||
: line-offset>x ( layout n -- x )
|
||||
#! n is an index into the UTF8 encoding of the text
|
||||
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
|
||||
f 0 <int> [ pango_layout_line_index_to_x ] keep
|
||||
*int pango>float ;
|
||||
f { int } [ pango_layout_line_index_to_x ] with-out-parameters
|
||||
pango>float ;
|
||||
|
||||
: x>line-offset ( layout x -- n )
|
||||
#! n is an index into the UTF8 encoding of the text
|
||||
[
|
||||
[ first-line ] dip
|
||||
float>pango 0 <int> 0 <int>
|
||||
[ pango_layout_line_x_to_index drop ] 2keep
|
||||
[ *int ] bi@ swap
|
||||
float>pango
|
||||
{ int int }
|
||||
[ pango_layout_line_x_to_index drop ] with-out-parameters
|
||||
swap
|
||||
] [ drop string>> ] 2bi utf8-index> + ;
|
||||
|
||||
: selection-start/end ( selection -- start end )
|
||||
|
|
Loading…
Reference in New Issue