2019-10-18 09:05:08 -04:00
|
|
|
! Copyright (C) 2005, 2007 Slava Pestov, Alex Chapman.
|
2006-01-10 23:56:00 -05:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2005-12-13 17:33:58 -05:00
|
|
|
IN: !syntax
|
2006-05-15 01:01:47 -04:00
|
|
|
USING: alien compiler kernel math namespaces parser
|
2019-10-18 09:05:08 -04:00
|
|
|
sequences syntax words quotations ;
|
2005-06-12 03:38:57 -04:00
|
|
|
|
2006-06-19 03:41:42 -04:00
|
|
|
: !DLL" skip-blank parse-string dlopen parsed ; parsing
|
2006-01-19 23:28:45 -05:00
|
|
|
|
2019-10-18 09:05:08 -04:00
|
|
|
: !ALIEN: scan string>number <alien> parsed ; parsing
|
2006-01-19 23:28:45 -05:00
|
|
|
|
2006-06-19 03:41:42 -04:00
|
|
|
: !LIBRARY: scan "c-library" set ; parsing
|
2005-06-12 03:38:57 -04:00
|
|
|
|
2006-06-19 03:41:42 -04:00
|
|
|
: !FUNCTION:
|
2019-10-18 09:05:08 -04:00
|
|
|
scan "c-library" get scan ";" parse-tokens
|
|
|
|
|
[ "()" subseq? not ] subset
|
|
|
|
|
define-function ; parsing
|
2005-06-12 03:38:57 -04:00
|
|
|
|
2019-10-18 09:05:08 -04:00
|
|
|
: !TYPEDEF:
|
|
|
|
|
scan scan [ typedef ] curry curry in-target ; parsing
|
2005-06-12 03:38:57 -04:00
|
|
|
|
2019-10-18 09:05:08 -04:00
|
|
|
: !C-STRUCT:
|
|
|
|
|
scan in get
|
|
|
|
|
parse-definition
|
|
|
|
|
>r 2dup r> define-struct-early
|
|
|
|
|
[ define-struct ] curry curry curry
|
|
|
|
|
in-target ; parsing
|
2005-08-24 10:19:09 -04:00
|
|
|
|
2006-06-19 03:41:42 -04:00
|
|
|
: !C-UNION:
|
2019-10-18 09:05:08 -04:00
|
|
|
scan in get
|
|
|
|
|
";" parse-tokens
|
|
|
|
|
[ define-union ] curry curry curry
|
|
|
|
|
in-target ; parsing
|
2006-03-26 19:47:51 -05:00
|
|
|
|
2006-06-19 03:41:42 -04:00
|
|
|
: !C-ENUM:
|
2019-10-18 09:05:08 -04:00
|
|
|
";" parse-tokens
|
|
|
|
|
dup length
|
|
|
|
|
[ >r create-in r> 1quotation define-compound ] 2each ;
|
|
|
|
|
parsing
|