1 ! Copyright (C) 2005, 2010 Slava Pestov, Alex Chapman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.enums alien.libraries
4 alien.parser fry kernel lexer namespaces parser sequences
5 strings.parser vocabs words ;
6 << "alien.arrays" require >> ! needed for bootstrap
9 SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ;
11 SYNTAX: ALIEN: 16 scan-base <alien> suffix! ;
13 SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
15 SYNTAX: LIBRARY: scan-token current-library set ;
18 (FUNCTION:) make-function define-inline ;
20 SYNTAX: FUNCTION-ALIAS:
21 scan-token create-function
22 (FUNCTION:) (make-function) define-inline ;
25 (CALLBACK:) define-inline ;
28 scan-c-type CREATE-C-TYPE dup save-location typedef ;
31 parse-enum (define-enum) ;
34 void CREATE-C-TYPE typedef ;
37 scan-token current-library get '[ _ _ address-of ] append! ;
39 SYNTAX: C-GLOBAL: scan-c-type scan-new-word define-global ;
42 scan-c-type <pointer> suffix! ;