]> gitweb.factorcode.org Git - factor.git/blob - basis/vocabs/platforms/platforms.factor
9289ec3cd755f84026c9b3a50e64e3616e3cded7
[factor.git] / basis / vocabs / platforms / platforms.factor
1 ! Copyright (C) 2018 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors compiler.units kernel multiline parser
4 sequences splitting system vocabs.parser ;
5 IN: vocabs.platforms
6
7 : with-vocabulary ( quot suffix -- )
8     [
9         [ [ current-vocab name>> ] dip ?tail drop ]
10         [ append ] bi set-current-vocab
11         call
12     ] [
13         [ current-vocab name>> ] dip ?tail drop set-current-vocab
14     ] bi ; inline
15
16 : parse-platform-section ( string suffix -- )
17     [
18         [ [ split-lines parse-lines ] curry with-nested-compilation-unit ]
19         curry
20     ] dip with-vocabulary drop ; inline
21
22 SYNTAX: <UNIX
23     "UNIX>" parse-multiline-string
24     os unix? [ ".unix" parse-platform-section ] [ drop ] if ;
25
26 SYNTAX: <MACOSX
27     "MACOSX>" parse-multiline-string
28     os macosx? [ ".macosx" parse-platform-section ] [ drop ] if ;
29
30 SYNTAX: <LINUX
31     "LINUX>" parse-multiline-string
32     os linux? [ ".linux" parse-platform-section ] [ drop ] if ;
33
34 SYNTAX: <WINDOWS
35     "WINDOWS>" parse-multiline-string
36     os windows? [ ".windows" parse-platform-section ] [ drop ] if ;
37
38 SYNTAX: <!UNIX
39     "!UNIX>" parse-multiline-string
40     os unix? [ drop ] [ ".unix" parse-platform-section ] if ;
41
42 SYNTAX: <!MACOSX
43     "!MACOSX>" parse-multiline-string
44     os macosx? [ drop ] [ ".macosx" parse-platform-section ] if ;
45
46 SYNTAX: <!LINUX
47     "!LINUX>" parse-multiline-string
48     os linux? [ drop ] [ ".linux" parse-platform-section ] if ;
49
50 SYNTAX: <!WINDOWS
51     "!WINDOWS>" parse-multiline-string
52     os windows? [ drop ] [ ".windows" parse-platform-section ] if ;