first commit (move from factor-gir); basis/pango is gir-based now (very draft version); add gstreamer and gtkglext modules and samples

db4
Anton Gorenko 2010-05-09 23:21:12 +06:00
parent d215d691b5
commit da25daeb51
49 changed files with 233742 additions and 0 deletions

8681
basis/atk/Atk-1.0.gir Normal file

File diff suppressed because it is too large Load Diff

12
basis/atk/atk.factor Normal file
View File

@ -0,0 +1,12 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax
gir glib gobject glib.ffi ;
IN: atk.ffi
TYPEDEF: guint64 AtkState
TYPEDEF: GSList AtkAttributeSet
IN-GIR: atk vocab:atk/Atk-1.0.gir

1
basis/atk/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

22284
basis/gdk/Gdk-2.0.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/gdk/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

12
basis/gdk/gdk.factor Normal file
View File

@ -0,0 +1,12 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax cairo.ffi
gir glib gobject gio gmodule gdk.pixbuf glib.ffi ;
IN: gdk.ffi
TYPEDEF: guint32 GdkNativeWindow
TYPEDEF: guint32 GdkWChar
IN-GIR: gdk vocab:gdk/Gdk-2.0.gir

30343
basis/gdk/gl/GdkGL-1.0.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/gdk/gl/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

19
basis/gdk/gl/gl.factor Normal file
View File

@ -0,0 +1,19 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.libraries alien.syntax combinators kernel system vocabs.parser words
gir glib gobject gio gmodule gdk gdk.ffi gdk.pixbuf ;
<<
"gdk.gl" {
{ [ os winnt? ] [ "" "cdecl" add-library ] }
{ [ os macosx? ] [ drop ] }
{ [ os unix? ] [ "libgdkglext-x11-1.0.so" "cdecl" add-library ] }
} cond
>>
IN: gdk.gl.ffi
<< ulong "unsigned long" current-vocab create typedef >>
IN-GIR: gdk.gl vocab:gdk/gl/GdkGL-1.0.gir

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,6 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: gir glib gobject gio gmodule ;
IN-GIR: gdk.pixbuf vocab:gdk/pixbuf/GdkPixbuf-2.0.gir

23740
basis/gio/Gio-2.0.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/gio/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

6
basis/gio/gio.factor Normal file
View File

@ -0,0 +1,6 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: gir glib gobject ;
IN-GIR: gio vocab:gio/Gio-2.0.gir

1
basis/gir/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,20 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs kernel namespaces ;
IN: gir.common
CONSTANT: ffi-vocab "ffi"
SYMBOL: current-lib
SYMBOL: lib-aliases
lib-aliases [ H{ } ] initialize
SYMBOL: type-infos
type-infos [ H{ } ] initialize
SYMBOL: aliases
aliases [ H{ } ] initialize
: get-lib-alias ( lib -- alias )
lib-aliases get-global at ;

211
basis/gir/ffi/ffi.factor Normal file
View File

@ -0,0 +1,211 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.parser assocs combinators
combinators.short-circuit effects fry generalizations
gir.common gir.types kernel locals math math.parser namespaces
parser prettyprint quotations sequences vocabs.parser words
words.constant ;
IN: gir.ffi
: string>c-type ( str -- c-type )
parse-c-type ;
: define-each ( nodes quot -- )
'[ dup @ >>ffi drop ] each ; inline
: ffi-invoker ( func -- quot )
{
[ return>> c-type>> string>c-type ]
[ drop current-lib get ]
[ identifier>> ]
[ parameters>> [ c-type>> string>c-type ] map ]
[ varargs?>> [ void* suffix ] when ]
} cleave \ alien-invoke 5 narray >quotation ;
: ffi-effect ( func -- effect )
[ parameters>> [ name>> ] map ]
[ varargs?>> [ "varargs" suffix ] when ]
[ return>> type>> none-type? { } { "result" } ? ] tri
<effect> ;
: define-ffi-function ( func -- word )
[ identifier>> create-in dup ]
[ ffi-invoker ] [ ffi-effect ] tri define-declared ;
: define-ffi-functions ( functions -- )
[ define-ffi-function ] define-each ;
: signal-param-c-type ( param -- c-type )
[ c-type>> ] [ type>> ] bi
{
[ none-type? ]
[ simple-type? ]
[ enum-type? ]
[ bitfield-type? ]
} 1|| [ dup "*" tail? [ CHAR: * suffix ] unless ] unless ;
: signal-ffi-invoker ( signal -- quot )
[ return>> signal-param-c-type string>c-type ]
[ parameters>> [ signal-param-c-type string>c-type ] map ] bi
"cdecl" [ [ ] 3curry dip alien-callback ] 3curry ;
: signal-ffi-effect ( signal -- effect )
[ parameters>> [ name>> ] map ]
[ return>> type>> none-type? { } { "result" } ? ] bi
<effect> dup . ;
:: define-ffi-signal ( signal class -- word ) ! сделать попонятнее
signal dup .
[
name>> class c-type>> swap ":" glue create-in
[ void* swap typedef ] keep dup
] keep
[ signal-ffi-effect "callback-effect" set-word-prop ]
[ drop current-lib get "callback-library" set-word-prop ]
[ signal-ffi-invoker (( quot -- alien )) define-inline ] 2tri ;
: define-ffi-signals ( signals class -- )
'[ _ define-ffi-signal ] define-each ;
: const-value ( const -- value )
[ value>> ] [ type>> name>> ] bi {
{ "int" [ string>number ] }
{ "double" [ string>number ] }
{ "utf8" [ ] }
} case ;
: define-ffi-enum ( enum -- word )
[
members>> [
[ c-identifier>> create-in ]
[ value>> ] bi define-constant
] each
] [ c-type>> create-in [ int swap typedef ] keep ] bi ;
: define-ffi-enums ( enums -- )
[ define-ffi-enum ] define-each ;
: define-ffi-bitfields ( bitfields -- )
[ define-ffi-enum ] define-each ;
: define-ffi-record ( record -- word )
[ disguised?>> void* void ? ]
[ c-type>> create-in ] bi [ typedef ] keep ;
: define-ffi-records ( records -- )
[ define-ffi-record ] define-each ;
: define-ffi-record-content ( record -- )
{
[ constructors>> define-ffi-functions ]
[ functions>> define-ffi-functions ]
[ methods>> define-ffi-functions ]
} cleave ;
: define-ffi-records-content ( records -- )
[ define-ffi-record-content ] each ;
: define-ffi-union ( union -- word )
c-type>> create-in [ void* swap typedef ] keep ;
: define-ffi-unions ( unions -- )
[ define-ffi-union ] define-each ;
: define-ffi-callback ( callback -- word )
c-type>> create-in [ void* swap typedef ] keep ;
: define-ffi-callbacks ( callbacks -- )
[ define-ffi-callback ] define-each ;
: define-ffi-interface ( interface -- word )
c-type>> create-in [ void swap typedef ] keep ;
: define-ffi-interfaces ( interfaces -- )
[ define-ffi-interface ] define-each ;
! Доделать
: define-ffi-interface-content ( interface -- )
{
[ methods>> define-ffi-functions ]
} cleave ;
: define-ffi-interfaces-content ( interfaces -- )
[ define-ffi-interface-content ] each ;
: get-type-invoker ( name -- quot )
[ "GType" current-lib get ] dip
{ } \ alien-invoke 5 narray >quotation ;
: define-ffi-class ( class -- word )
c-type>> create-in [ void swap typedef ] keep ;
: define-ffi-classes ( class -- )
[ define-ffi-class ] define-each ;
: define-ffi-class-content ( class -- )
{
[ constructors>> define-ffi-functions ]
[ functions>> define-ffi-functions ]
[ methods>> define-ffi-functions ]
[ [ signals>> ] keep define-ffi-signals ]
} cleave ;
: define-ffi-classes-content ( class -- )
[ define-ffi-class-content ] each ;
: define-get-type ( node -- word )
get-type>> dup { "intern" f } member? [ drop f ]
[
[ create-in dup ] [ get-type-invoker ] bi
{ } { "type" } <effect> define-declared
] if ;
: define-get-types ( namespace -- )
{
[ 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 ]
} cleave ;
: define-ffi-const ( const -- word )
[ name>> create-in dup ] [ const-value ] bi define-constant ;
: define-ffi-consts ( consts -- )
[ define-ffi-const ] define-each ;
: define-ffi-alias ( alias -- )
drop ;
: define-ffi-aliases ( aliases -- )
[ define-ffi-alias ] each ;
: prepare-vocab ( repository -- )
includes>> lib-aliases get '[ _ at ] map sift
[ ffi-vocab "." glue ] map
{ "alien.c-types" } append
[ dup using-vocab? [ drop ] [ use-vocab ] if ] each ;
: define-ffi-namespace ( namespace -- )
{
[ aliases>> define-ffi-aliases ]
[ consts>> define-ffi-consts ]
[ enums>> define-ffi-enums ]
[ bitfields>> define-ffi-bitfields ]
[ records>> define-ffi-records ]
[ unions>> define-ffi-unions ]
[ interfaces>> define-ffi-interfaces ]
[ classes>> define-ffi-classes ]
[ callbacks>> define-ffi-callbacks ]
[ records>> define-ffi-records-content ]
[ classes>> define-ffi-classes-content ]
[ interfaces>> define-ffi-interfaces-content ]
[ functions>> define-ffi-functions ]
} cleave ;
: define-ffi-repository ( repository -- )
[ prepare-vocab ]
[ namespace>> define-ffi-namespace ] bi ;

24
basis/gir/gir.factor Executable file
View File

@ -0,0 +1,24 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators gir.common gir.ffi gir.loader
kernel lexer locals namespaces sequences vocabs.parser xml ;
IN: gir
: with-child-vocab ( name quot -- )
swap current-vocab name>>
[ swap "." glue set-current-vocab call ] keep
set-current-vocab ; inline
:: define-gir-vocab ( vocab-name file-name -- )
file-name file>xml xml>repository
vocab-name [ set-current-vocab ] [ current-lib set ] bi
{
[
namespace>> name>> vocab-name swap
lib-aliases get set-at
]
[ ffi-vocab [ define-ffi-repository ] with-child-vocab ]
} cleave ;
SYNTAX: IN-GIR: scan scan define-gir-vocab ;

View File

@ -0,0 +1,245 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors ascii combinators fry gir.common gir.repository
gir.types kernel math math.parser sequences splitting xml.data
xml.traversal ;
FROM: namespaces => set get ;
IN: gir.loader
: word-started? ( word letter -- ? )
[ last letter? ] [ LETTER? ] bi* and ;
: 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
[ get-lib-alias >>namespace ] [ >>name ] bi* absolute-type ;
: node>type ( xml -- type )
"name" attr full-type-name>type ;
: xml>array-info ( xml -- array-info )
[ array-info new ] dip {
[ "zero-terminated" attr [ "1" = ] [ t ] if* >>zero-terminated? ]
[ "length" attr [ string>number ] [ f ] if* >>length ]
[ "fixed-size" attr [ string>number ] [ f ] if* >>fixed-size ]
} cleave ;
: xml>type ( xml -- array-info type )
dup name>> main>> {
{ "array"
[
[ xml>array-info ]
[ first-child-tag node>type ] bi
]
}
{ "type" [ node>type f swap ] }
{ "varargs" [ drop f f ] }
} case ;
: load-parameter ( param xml -- param )
[ "transfer-ownership" attr >>transfer-ownership ]
[ first-child-tag "type" attr >>c-type ]
[
first-child-tag xml>type
[ [ >>array-info ] [ >>type ] bi* ] [ 2drop f ] if*
] tri ;
: load-type ( type xml -- type )
{
[ "name" attr camel>factor >>name ]
[ node>type >>type ]
[ "type" attr >>c-type ]
[ "type-name" attr >>type-name ]
[ "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 ;
: load-parameters ( xml callable -- callable )
[
"parameters" tag-named "parameter" tags-named
[ xml>parameter ] map
dup { f } tail? [ but-last [ t >>varargs? ] dip ] when
>>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? ]
[ first-child-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
>>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 ]
[ "identifier" attr >>c-identifier ]
[ "value" attr string>number >>value ]
} cleave ;
: xml>enum ( xml -- enum )
[ enum new ] dip {
[ load-type ]
[ "member" tags-named [ xml>member ] map >>members ]
} cleave ;
: xml>record ( xml -- record )
[ record new ] dip {
[ load-type ]
[ "disguised" attr "1" = >>disguised? ]
[ "constructor" load-functions >>constructors ]
[ "function" load-functions >>functions ]
[
"method" load-functions over type>self-param
'[ [ _ prefix ] change-parameters ] map
>>methods
]
} 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 ]
} cleave ;
: xml>const ( xml -- const )
[ const new ] dip {
[ "name" attr >>name ]
[ "value" attr >>value ]
[ first-child-tag "type" attr >>c-type ]
[ first-child-tag xml>type nip >>type ]
} cleave ;
: xml>namespace ( xml -- namespace )
[ namespace new ] dip {
[ "name" attr camel>factor dup current-lib set >>name ]
[ "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 ]
[ "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 ;

View File

@ -0,0 +1,60 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: ;
IN: gir.repository
TUPLE: node name ;
TUPLE: repository includes namespace ;
TUPLE: namespace < node
aliases consts classes interfaces records unions callbacks
enums bitfields functions ;
TUPLE: alias < node target ;
TUPLE: typed < node type c-type ;
TUPLE: const < typed value ffi ;
TUPLE: type-node < node
type c-type type-name get-type ffi ;
TUPLE: record < type-node
constructors methods functions disguised? ;
TUPLE: union < type-node ;
TUPLE: class < record
abstract? parent type-struct signals ;
TUPLE: interface < type-node
methods ;
TUPLE: property < type-node
readable? writable? construct? construct-only? ;
TUPLE: callable < type-node
return parameters varargs? ;
TUPLE: function < callable identifier ;
TUPLE: callback < type-node return parameters varargs? ;
TUPLE: signal < callback ;
TUPLE: parameter < typed
direction allow-none? length? transfer-ownership array-info
local ;
TUPLE: return < typed
transfer-ownership array-info local ;
TUPLE: type name namespace ;
TUPLE: array-info zero-terminated? fixed-size length ;
TUPLE: enum-member < node value c-identifier ;
TUPLE: enum < type-node members ;

View File

@ -0,0 +1,135 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types assocs combinators.short-circuit
gir.common gir.repository kernel namespaces specialized-arrays ;
IN: gir.types
TUPLE: gwrapper { underlying alien } ;
TUPLE: grecord < gwrapper ;
TUPLE: gobject < gwrapper ;
SPECIALIZED-ARRAYS:
void* bool int uint char uchar short ushort long ulong
longlong ulonglong float double ;
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: enum-info < type-info ;
TUPLE: bitfield-info < type-info ;
TUPLE: record-info < type-info ;
TUPLE: union-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 ;
: get-type-info ( type -- info )
aliased-type type-infos get at ;
PREDICATE: none-type < type
[ namespace>> not ] [ name>> "none" = ] bi and ;
PREDICATE: simple-type < type
aliased-type
[ namespace>> not ] [ name>> simple-types key? ] bi and ;
PREDICATE: utf8-type < type
aliased-type
[ namespace>> not ] [ name>> "utf8" = ] bi and ;
PREDICATE: any-type < type
aliased-type
[ namespace>> not ] [ name>> "any" = ] bi and ;
PREDICATE: enum-type < type get-type-info enum-info? ;
PREDICATE: bitfield-type < type get-type-info bitfield-info? ;
PREDICATE: record-type < type get-type-info record-info? ;
PREDICATE: union-type < type get-type-info union-info? ;
PREDICATE: callback-type < type get-type-info callback-info? ;
PREDICATE: class-type < type get-type-info class-info? ;
PREDICATE: interface-type < type get-type-info interface-info? ;
: absolute-type ( type -- type' )
dup {
[ namespace>> ] [ simple-type? ]
[ utf8-type? ] [ none-type? ]
} 1|| [ current-lib get >>namespace ] unless ;

20295
basis/glib/GLib-2.0.gir Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
<?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="GLib" version="2.0"/>
<package name="gmodule-2.0"/>
<c:include name="gmodule.h"/>
<namespace name="GModule"
version="2.0"
shared-library="libgmodule-2.0.so.0"
c:prefix="g">
<record name="Module" c:type="GModule">
<method name="close" c:identifier="g_module_close">
<return-value transfer-ownership="none">
<type name="boolean" c:type="gboolean"/>
</return-value>
</method>
<method name="make_resident" c:identifier="g_module_make_resident">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
</method>
<method name="symbol" c:identifier="g_module_symbol">
<return-value transfer-ownership="none">
<type name="boolean" 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*"/>
</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">
<type name="utf8" c:type="gchar*"/>
</return-value>
<parameters>
<parameter name="module" transfer-ownership="none">
<type name="Module" c:type="GModule*"/>
</parameter>
</parameters>
</callback>
<bitfield name="ModuleFlags" c:type="GModuleFlags">
<member name="lazy" value="1" c:identifier="G_MODULE_BIND_LAZY"/>
<member name="local" value="2" c:identifier="G_MODULE_BIND_LOCAL"/>
<member name="mask" value="3" c:identifier="G_MODULE_BIND_MASK"/>
</bitfield>
<callback name="ModuleUnload" c:type="GModuleUnload">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="module" transfer-ownership="none">
<type name="Module" c:type="GModule*"/>
</parameter>
</parameters>
</callback>
<function name="build_path" c:identifier="g_module_build_path">
<return-value transfer-ownership="full">
<type name="utf8" c:type="gchar*"/>
</return-value>
<parameters>
<parameter name="directory" transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</parameter>
<parameter name="module_name" transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</parameter>
</parameters>
</function>
<function name="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">
<type name="Module" c:type="GModule*"/>
</return-value>
<parameters>
<parameter name="file_name" transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</parameter>
<parameter name="flags" transfer-ownership="none">
<type name="ModuleFlags" c:type="GModuleFlags"/>
</parameter>
</parameters>
</function>
<function name="supported" c:identifier="g_module_supported">
<return-value transfer-ownership="none">
<type name="boolean" c:type="gboolean"/>
</return-value>
</function>
</namespace>
</repository>

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,6 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: gir glib ;
IN-GIR: gmodule vocab:gmodule/GModule-2.0.gir

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,50 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.c-types alien.destructors
alien.libraries combinators kernel literals math system
gir glib glib.ffi ;
IN: gobject.ffi
TYPEDEF: void* GSignalCMarshaller
TYPEDEF: void GStrv
! есть alias
TYPEDEF: gchar* gchararray
IN-GIR: gobject vocab:gobject/GObject-2.0.gir
IN: gobject.ffi
FORGET: GIOCondition
FUNCTION: void g_object_unref ( GObject* self ) ;
DESTRUCTOR: g_object_unref
! Исправление неправильного типа параметра для GtkWidget-child-notify
! (разобраться)
TYPEDEF: GParamSpec GParam
<< CONSTANT: G_TYPE_FUNDAMENTAL_SHIFT 2 >>
CONSTANT: G_TYPE_INVALID $[ 0 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_NONE $[ 1 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_INTERFACE $[ 2 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_CHAR $[ 3 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_UCHAR $[ 4 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_BOOLEAN $[ 5 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_INT $[ 6 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_UINT $[ 7 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_LONG $[ 8 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_ULONG $[ 9 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_INT64 $[ 10 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_UINT64 $[ 11 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_ENUM $[ 12 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_FLAGS $[ 13 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_FLOAT $[ 14 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_DOUBLE $[ 15 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_STRING $[ 16 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_POINTER $[ 17 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_BOXED $[ 18 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_PARAM $[ 19 G_TYPE_FUNDAMENTAL_SHIFT shift ]
CONSTANT: G_TYPE_OBJECT $[ 20 G_TYPE_FUNDAMENTAL_SHIFT shift ]

22063
basis/gst/Gst-0.10.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/gst/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

27
basis/gst/gst.factor Normal file
View File

@ -0,0 +1,27 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.libraries combinators
kernel system
gir glib glib.ffi gobject gmodule ;
<<
"gst" {
{ [ os winnt? ] [ "" "cdecl" add-library ] }
{ [ os macosx? ] [ "" "cdecl" add-library ] }
{ [ os unix? ] [ "libgstreamer-0.10.so" "cdecl" add-library ] }
} cond
>>
IN: gst.ffi
TYPEDEF: gpointer GstClockID
TYPEDEF: guint64 GstClockTime
TYPEDEF: gint64 GstClockTimeDiff
! Временное исправление отсутвующих типов libxml2
TYPEDEF: void* xmlNodePtr
TYPEDEF: void* xmlDocPtr
TYPEDEF: void* xmlNsPtr
IN-GIR: gst vocab:gst/Gst-0.10.gir

88485
basis/gtk/Gtk-2.0.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/gtk/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

173
basis/gtk/gl/GtkGL-1.0.gir Normal file
View File

@ -0,0 +1,173 @@
<?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="&lt;unknown&gt;">
<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>

1
basis/gtk/gl/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

15
basis/gtk/gl/gl.factor Normal file
View File

@ -0,0 +1,15 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.libraries combinators kernel system
gir glib gobject gio gmodule gdk.pixbuf gdk gdk.gl gtk gtk.ffi ;
<<
"gtk.gl" {
{ [ os winnt? ] [ "" "cdecl" add-library ] }
{ [ os macosx? ] [ drop ] }
{ [ os unix? ] [ "libgtkglext-x11-1.0.so" "cdecl" add-library ] }
} cond
>>
IN-GIR: gtk.gl vocab:gtk/gl/GtkGL-1.0.gir

23
basis/gtk/gtk.factor Normal file
View File

@ -0,0 +1,23 @@
! Copyright (C) 2009 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.libraries cairo.ffi combinators
kernel system
gir glib glib.ffi gobject gio gmodule gdk.pixbuf gdk atk ;
<<
"gtk" {
{ [ os winnt? ] [ "libgtk-win32-2.0-0.dll" "cdecl" add-library ] }
{ [ os macosx? ] [ drop ] }
{ [ os unix? ] [ "libgtk-x11-2.0.so" "cdecl" add-library ] }
} cond
>>
IN: gtk.ffi
TYPEDEF: void GtkAllocation
TYPEDEF: void GtkEnumValue
TYPEDEF: void GtkFlagValue
TYPEDEF: GType GtkType
IN-GIR: gtk vocab:gtk/Gtk-2.0.gir

7445
basis/pango/Pango-1.0.gir Normal file

File diff suppressed because it is too large Load Diff

1
basis/pango/authors.txt Normal file
View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,203 @@
<?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="GLib" version="2.0"/>
<include name="GObject" version="2.0"/>
<include name="Pango" version="1.0"/>
<include name="PangoFT2" version="1.0"/>
<include name="cairo" version="1.0"/>
<include name="fontconfig" version="2.0"/>
<include name="freetype2" version="2.0"/>
<package name="cairo"/>
<package name="gobject-2.0"/>
<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
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">
<return-value transfer-ownership="full">
<type name="FontMap" c:type="PangoFontMap*"/>
</return-value>
</constructor>
<method name="set_default"
c:identifier="pango_cairo_font_map_set_default"
doc="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">
<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
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">
<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"/>
</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">
<return-value transfer-ownership="none">
<type name="double" c:type="double"/>
</return-value>
<parameters>
<parameter name="context" transfer-ownership="none">
<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)."
version="1.10">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="context" transfer-ownership="none">
<type name="Pango.Context" c:type="PangoContext*"/>
</parameter>
<parameter name="dpi" transfer-ownership="none">
<type name="double" 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.
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.
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">
<type name="Pango.FontMap" c:type="PangoFontMap*"/>
</return-value>
</function>
</namespace>
</repository>

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,63 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.strings fry byte-arrays
io.encodings.utf8 kernel locals math prettyprint
gst gst.ffi glib.ffi gobject.ffi gtk gtk.ffi ;
IN: gir.samples.lowlevel.gstreamer
! CONSTANT: uri "http://www.xiph.org/vorbis/listen/compilation-ogg-q4.ogg"
CONSTANT: uri "http://tinyvid.tv/file/3gocxnjott7wr.ogg"
:: gstreamer-win ( -- window )
f f gst_init
"playbin" "player" [ utf8 string>alien ] bi@ gst_element_factory_make :> pipeline
GType gint64 [ heap-size ] bi@ 2 * + <byte-array> :> value
value G_TYPE_STRING g_value_init drop
value uri utf8 string>alien g_value_set_string
pipeline "uri" utf8 string>alien value g_object_set_property
! pipeline GST_STATE_PLAYING gst_element_set_state drop
GTK_WINDOW_TOPLEVEL gtk_window_new :> window
window
[ "GStreamer" utf8 string>alien gtk_window_set_title ]
[ 300 200 gtk_window_set_default_size ]
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
gtk_fixed_new :> frame
window frame gtk_container_add
"Start" utf8 string>alien gtk_button_new_with_label :> button
button 140 30 gtk_widget_set_size_request
frame button 80 60 gtk_fixed_put
button "clicked" utf8 string>alien
[ nip GST_STATE_PLAYING gst_element_set_state drop ] GtkButton:clicked
pipeline f 0 g_signal_connect_data drop
window "destroy" utf8 string>alien
[
nip [ GST_STATE_NULL gst_element_set_state drop ]
[ gst_object_unref ] bi
] GtkObject:destroy
pipeline f 0 g_signal_connect_data drop
window ;
:: gstreamer-main ( -- )
f f gtk_init
gstreamer-win :> window
window "destroy" utf8 string>alien
[ 2drop gtk_main_quit ] GtkObject:destroy
f f 0 g_signal_connect_data drop
window gtk_widget_show_all
gtk_main ;
MAIN: gstreamer-main

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,44 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings gtk gobject.ffi gtk.ffi io.encodings.utf8
kernel locals ;
IN: gir.samples.lowlevel.hello-world
:: hello-world-win ( -- window )
GTK_WINDOW_TOPLEVEL gtk_window_new :> window
window
[ "Hello world!" utf8 string>alien gtk_window_set_title ]
[ 300 200 gtk_window_set_default_size ]
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
gtk_fixed_new :> frame
window frame gtk_container_add
"Say 'Hello!'" utf8 string>alien gtk_button_new_with_label :> button
button 140 30 gtk_widget_set_size_request
frame button 80 60 gtk_fixed_put
"" utf8 string>alien gtk_label_new :> label
frame label 120 110 gtk_fixed_put
button "clicked" utf8 string>alien
[ nip "Hello! :)" utf8 string>alien gtk_label_set_text 1 ] GtkButton:clicked
label f 0 g_signal_connect_data drop
window ;
:: hello-world-main ( -- )
f f gtk_init
hello-world-win :> window
window "destroy" utf8 string>alien
[ 2drop gtk_main_quit ] GtkObject:destroy
f f 0 g_signal_connect_data drop
window gtk_widget_show_all
gtk_main ;
MAIN: hello-world-main

View File

@ -0,0 +1,81 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.strings byte-arrays
gtk glib.ffi gobject.ffi gtk.ffi io.encodings.utf8 kernel
literals locals make math prettyprint sequences specialized-arrays
gir.samples.lowlevel.hello-world
gir.samples.lowlevel.opengl
gir.samples.lowlevel.gstreamer ;
IN: gir.samples.lowlevel
SPECIALIZED-ARRAY: ulong
CONSTANT: samples {
{ "hello-world" "Simple 'Hello world!' program" [ hello-world-win ] }
{ "opengl" "GtkGLExt sample program" [ opengl-win ] }
{ "gstreamer" "Small GStreamer-based multimedia player " [ gstreamer-win ] }
}
:: list-on-row-activited ( sender path column user_data -- )
path gtk_tree_path_get_indices *int samples nth last
call( -- win ) gtk_widget_show_all ;
:: main ( -- )
f f gtk_init
GTK_WINDOW_TOPLEVEL gtk_window_new :> window
window
[ "Low-level Gtk samples" utf8 string>alien gtk_window_set_title ]
[ 300 400 gtk_window_set_default_size ]
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
gtk_tree_view_new :> list
list 0 gtk_tree_view_set_headers_visible
gtk_cell_renderer_text_new :> renderer
gtk_tree_view_column_new :> column
column "Sample" utf8 string>alien gtk_tree_view_column_set_title
column renderer 1 gtk_tree_view_column_pack_start
column renderer "markup" utf8 string>alien 0 gtk_tree_view_column_add_attribute
list column gtk_tree_view_append_column drop
ulong-array{ $ G_TYPE_STRING }
[ length ] keep gtk_list_store_newv :> store
list store gtk_tree_view_set_model
store g_object_unref
! Временный фикс, нужно придумать что-то другое, так как нет
! конструктора для создания GtkTreeIter
gint gpointer [ heap-size ] bi@ 3 * + <byte-array> :> iter
GType gint64 [ heap-size ] bi@ 2 * + <byte-array> :> value
value G_TYPE_STRING g_value_init drop
samples [
first2 swap [ "<big><b>" % % "</b></big>\n" % % ] "" make
value swap utf8 string>alien g_value_set_string
store iter gtk_list_store_append
store iter 0 value gtk_list_store_set_value
] each
list 300 300 gtk_widget_set_size_request
window list gtk_container_add
list "row-activated"
utf8 string>alien
[ list-on-row-activited ] GtkTreeView:row-activated dup .
f f 0 g_signal_connect_data .
window "destroy" utf8 string>alien
[ 2drop gtk_main_quit ] GtkObject:destroy
f f 0 g_signal_connect_data drop
window gtk_widget_show_all
gtk_main ;
MAIN: main

View File

@ -0,0 +1 @@
Anton Gorenko

View File

@ -0,0 +1,93 @@
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings gtk gobject.ffi gtk.ffi gdk.gl gtk.gl gdk.gl.ffi
gtk.gl.ffi io.encodings.utf8 kernel locals math opengl.gl prettyprint ;
IN: gir.samples.lowlevel.opengl
! Sample based on
! http://code.valaide.org/content/simple-opengl-sample-using-gtkglext
:: on-configure ( sender event user-data -- result )
sender gtk_widget_get_gl_context :> gl-context
sender gtk_widget_get_gl_window :> gl-drawable
gl-drawable gl-context gdk_gl_drawable_gl_begin 1 =
[
0 0 200 200 glViewport
gl-drawable gdk_gl_drawable_gl_end
1
]
[ 0 ] if ;
:: on-expose ( sender event user-data -- result )
sender gtk_widget_get_gl_context :> gl-context
sender gtk_widget_get_gl_window :> gl-drawable
gl-drawable gl-context gdk_gl_drawable_gl_begin 1 =
[
GL_COLOR_BUFFER_BIT glClear
GL_TRIANGLES glBegin
1.0 0.0 0.0 glColor3f
0 1 glVertex2i
0.0 1.0 0.0 glColor3f
-1 -1 glVertex2i
0.0 0.0 1.0 glColor3f
1 -1 glVertex2i
glEnd
gl-drawable gdk_gl_drawable_is_double_buffered 1 =
[ gl-drawable gdk_gl_drawable_swap_buffers ]
[ glFlush ] if
gl-drawable gdk_gl_drawable_gl_end
1
]
[ 0 ] if ;
:: opengl-win ( -- window )
GTK_WINDOW_TOPLEVEL gtk_window_new :> window
window
[ "OpenGL" utf8 string>alien gtk_window_set_title ]
[ 200 200 gtk_window_set_default_size ]
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
window 1 gtk_container_set_reallocate_redraws
GDK_GL_MODE_RGBA GDK_GL_MODE_DOUBLE bitor
gdk_gl_config_new_by_mode :> gl-config
gtk_drawing_area_new :> drawing-area
drawing-area 200 200 gtk_widget_set_size_request
drawing-area gl-config f 1 GDK_GL_RGBA_TYPE
gtk_widget_set_gl_capability .
drawing-area "configure-event" utf8 string>alien
[ on-configure ] GtkWidget:configure-event
f f 0 g_signal_connect_data drop
drawing-area "expose-event" utf8 string>alien
[ on-expose ] GtkWidget:expose-event
f f 0 g_signal_connect_data drop
window drawing-area gtk_container_add
window ;
:: opengl-main ( -- )
f f gtk_init
f f gtk_gl_init
opengl-win :> window
window "destroy" utf8 string>alien
[ 2drop gtk_main_quit ] GtkObject:destroy
f f 0 g_signal_connect_data drop
window gtk_widget_show_all
gtk_main ;
MAIN: opengl-main