2010-05-09 13:21:12 -04:00
|
|
|
! Copyright (C) 2009 Anton Gorenko.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2010-07-17 07:17:03 -04:00
|
|
|
USING: accessors assocs combinators gobject-introspection.common
|
2010-07-25 12:18:32 -04:00
|
|
|
gobject-introspection.ffi gobject-introspection.loader kernel lexer
|
|
|
|
locals math namespaces sequences strings.parser vocabs.parser xml ;
|
2010-07-17 07:17:03 -04:00
|
|
|
IN: gobject-introspection
|
2010-05-09 13:21:12 -04:00
|
|
|
|
|
|
|
: with-child-vocab ( name quot -- )
|
|
|
|
swap current-vocab name>>
|
|
|
|
[ swap "." glue set-current-vocab call ] keep
|
|
|
|
set-current-vocab ; inline
|
|
|
|
|
2010-05-26 14:17:14 -04:00
|
|
|
:: define-gir-vocab ( file-name -- )
|
2010-05-09 13:21:12 -04:00
|
|
|
file-name file>xml xml>repository
|
|
|
|
|
2010-05-26 14:17:14 -04:00
|
|
|
current-vocab name>> dup ffi-vocab tail?
|
|
|
|
[ ffi-vocab length 1 + head* current-lib set-global ]
|
|
|
|
[ drop ] if ! throw the error
|
2010-05-09 13:21:12 -04:00
|
|
|
{
|
2010-05-26 14:17:14 -04:00
|
|
|
[ define-ffi-repository ]
|
2010-05-11 13:31:35 -04:00
|
|
|
} cleave
|
2010-07-25 12:18:32 -04:00
|
|
|
V{ } clone implement-structs set-global
|
|
|
|
H{ } clone replaced-c-types set-global ;
|
2010-05-09 13:21:12 -04:00
|
|
|
|
2010-05-26 14:17:14 -04:00
|
|
|
SYNTAX: GIR: scan define-gir-vocab ;
|
2010-05-11 13:31:35 -04:00
|
|
|
|
|
|
|
SYNTAX: IMPLEMENT-STRUCTS:
|
2010-07-25 12:18:32 -04:00
|
|
|
";" parse-tokens
|
|
|
|
implement-structs [ swap append! ] change-global ;
|
|
|
|
|
|
|
|
SYNTAX: REPLACE-C-TYPE:
|
|
|
|
scan unescape-string scan swap
|
|
|
|
replaced-c-types get-global set-at ;
|