1 ! Copyright (C) 2005, 2009 Slava Pestov, Alex Chapman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays alien alien.c-types alien.structs
4 alien.arrays alien.strings kernel math namespaces parser
5 sequences words quotations math.parser splitting grouping
6 effects assocs combinators lexer strings.parser alien.parser
7 fry vocabs.parser words.constant alien.libraries ;
10 SYNTAX: DLL" lexer get skip-blank parse-string dlopen parsed ;
12 SYNTAX: ALIEN: scan string>number <alien> parsed ;
14 SYNTAX: BAD-ALIEN <bad-alien> parsed ;
16 SYNTAX: LIBRARY: scan "c-library" set ;
19 (FUNCTION:) define-declared ;
25 scan current-vocab parse-definition define-struct ;
28 scan parse-definition define-union ;
32 [ [ create-in ] dip define-constant ] each-index ;
34 : address-of ( name library -- value )
35 load-library dlsym [ "No such symbol" throw ] unless* ;
38 scan "c-library" get '[ _ _ address-of ] over push-all ;