]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs.platforms: Add some more experimental USE: style words.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Feb 2022 06:14:54 +0000 (00:14 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Feb 2022 06:20:34 +0000 (00:20 -0600)
examples:

USE-IF: roman [ os macosx? ]

USE-UNIX: io.unix

USE-WINDOWS: windows

  old:
{
    { [ os windows? ] [ "alien.libraries.windows" ] }
    { [ os unix? ] [ "alien.libraries.unix" ] }
} cond require

  new:
USE-WINDOWS: alien.libraries.windows
USE-UNIX: alien.libraries.unix

basis/vocabs/platforms/platforms.factor

index 9289ec3cd755f84026c9b3a50e64e3616e3cded7..4f91ab1c72c4ec4114707d73f2ef9bb9a20c699e 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2018 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors compiler.units kernel multiline parser
+USING: accessors compiler.units kernel lexer multiline parser
 sequences splitting system vocabs.parser ;
 IN: vocabs.platforms
 
@@ -50,3 +50,16 @@ SYNTAX: <!LINUX
 SYNTAX: <!WINDOWS
     "!WINDOWS>" parse-multiline-string
     os windows? [ drop ] [ ".windows" parse-platform-section ] if ;
+
+SYNTAX: USE-UNIX: scan-token os unix? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-FREEBSD: scan-token os freebsd? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-LINUX: scan-token os linux? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-MACOSX: scan-token os macosx? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-WINDOWS: scan-token os windows? [ use-vocab ] [ drop ] if ;
+
+SYNTAX: USE-X86-32: scan-token os x86.32? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-X86-64: scan-token os x86.64? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-ARM-32: scan-token os arm.32? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-ARM-64: scan-token os arm.64? [ use-vocab ] [ drop ] if ;
+
+SYNTAX: USE-IF: scan-token scan-object call( -- ? ) [ use-vocab ] [ drop ] if ;