1 ! Copyright (C) 2009 Anton Gorenko.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs combinators gobject-introspection.common
4 gobject-introspection.ffi gobject-introspection.loader kernel lexer
5 locals math namespaces sequences strings.parser vocabs.parser xml ;
6 IN: gobject-introspection
8 : with-child-vocab ( name quot -- )
9 swap current-vocab name>>
10 [ swap "." glue set-current-vocab call ] keep
11 set-current-vocab ; inline
13 :: define-gir-vocab ( file-name -- )
14 file-name file>xml xml>repository
16 current-vocab name>> dup ffi-vocab tail?
17 [ ffi-vocab length 1 + head* current-lib set-global ]
18 [ drop ] if ! throw the error
20 [ define-ffi-repository ]
22 V{ } clone implement-structs set-global
23 H{ } clone replaced-c-types set-global ;
25 SYNTAX: GIR: scan define-gir-vocab ;
27 SYNTAX: IMPLEMENT-STRUCTS:
29 implement-structs [ swap append! ] change-global ;
31 SYNTAX: REPLACE-C-TYPE:
32 scan unescape-string scan swap
33 replaced-c-types get-global set-at ;