]> gitweb.factorcode.org Git - factor.git/commitdiff
update everything to use os singletons
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 2 Apr 2008 23:25:33 +0000 (18:25 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 2 Apr 2008 23:25:33 +0000 (18:25 -0500)
45 files changed:
core/alien/alien-docs.factor
core/alien/alien.factor
core/bootstrap/image/image.factor
core/bootstrap/stage2.factor
core/command-line/command-line.factor
core/cpu/ppc/architecture/architecture.factor
core/cpu/ppc/ppc.factor
core/cpu/x86/32/32.factor
core/cpu/x86/architecture/architecture.factor
core/generator/fixup/fixup.factor
core/io/files/files.factor
core/system/system-docs.factor
core/system/system-tests.factor
core/system/system.factor
extra/bootstrap/io/io.factor
extra/bootstrap/random/random.factor
extra/bootstrap/ui/ui.factor
extra/builder/builder.factor
extra/cairo/ffi/ffi.factor
extra/calendar/calendar.factor
extra/concurrency/distributed/distributed-tests.factor
extra/db/mysql/ffi/ffi.factor
extra/db/postgresql/ffi/ffi.factor
extra/db/sqlite/ffi/ffi.factor
extra/editors/gvim/gvim.factor
extra/freetype/freetype.factor
extra/hardware-info/hardware-info.factor
extra/io/files/unique/unique.factor
extra/io/sockets/impl/impl.factor
extra/io/unix/unix.factor
extra/io/windows/ce/backend/backend.factor
extra/io/windows/launcher/launcher.factor
extra/ogg/ogg.factor
extra/ogg/theora/theora.factor
extra/ogg/vorbis/vorbis.factor
extra/openal/openal.factor
extra/opengl/gl/extensions/extensions.factor
extra/openssl/libcrypto/libcrypto.factor
extra/openssl/libssl/libssl.factor
extra/oracle/liboci/liboci.factor
extra/tools/deploy/deploy.factor
extra/tools/disassembler/disassembler.factor
extra/ui/tools/deploy/deploy.factor
extra/unix/kqueue/kqueue.factor
extra/unix/stat/stat.factor

index 7bba9d7332d7a3a9c91f8ce7f7b3d7f0eb813062..fcafe3441c36b81e90e346b6584a2c5520e7d979 100755 (executable)
@@ -76,8 +76,8 @@ $nl
 { $examples "Here is a typical usage of " { $link add-library } ":"
 { $code
     "<< \"freetype\" {"
-    "    { [ macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
-    "    { [ windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
+    "    { [ os macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
+    "    { [ os windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
     "    { [ t ] [ drop ] }"
     "} cond >>"
 }
index cfa9fb2e1626c506f1c87e0de3d6336a1b01d66e..56be3e66a5ec32a6ef6c2c3466c68c2ddd37a600 100755 (executable)
@@ -29,7 +29,7 @@ M: f expired? drop t ;
     f <displaced-alien> { simple-c-ptr } declare ; inline
 
 : alien>native-string ( alien -- string )
-    windows? [ alien>u16-string ] [ alien>char-string ] if ;
+    os windows? [ alien>u16-string ] [ alien>char-string ] if ;
 
 : dll-path ( dll -- string )
     (dll-path) alien>native-string ;
index e2fa5833eb9062d6069066579d90fd9601fe5a76..6e0f8e2970625b7dc57f25af61017f965c7a5583 100755 (executable)
@@ -13,7 +13,7 @@ IN: bootstrap.image
 
 : my-arch ( -- arch )
     cpu word-name
-    dup "ppc" = [ >r os "-" r> 3append ] when ;
+    dup "ppc" = [ >r os word-name "-" r> 3append ] when ;
 
 : boot-image-name ( arch -- string )
     "boot." swap ".image" 3append ;
index bbb2e44843164525f58aa8f1e18a1754cc3e3868..c82ebbe9f87f068fbdd2dc655ea775053f982e3a 100755 (executable)
@@ -11,7 +11,7 @@ IN: bootstrap.stage2
 SYMBOL: bootstrap-time
 
 : default-image-name ( -- string )
-    vm file-name windows? [ "." split1 drop ] when
+    vm file-name os windows? [ "." split1 drop ] when
     ".image" append resource-path ;
 
 : do-crossref ( -- )
@@ -65,8 +65,8 @@ parse-command-line
 "-no-crossref" cli-args member? [ do-crossref ] unless
 
 ! Set dll paths
-wince? [ "windows.ce" require ] when
-winnt? [ "windows.nt" require ] when
+os wince? [ "windows.ce" require ] when
+os winnt? [ "windows.nt" require ] when
 
 "deploy-vocab" get [
     "stage2: deployment mode" print
index 72c1e063e0c7f30a8946dbd04d2f24ce7412bc55..246bf2dabe35faba177dfe66cf684b1dc4ab8a26 100644 (file)
@@ -47,7 +47,7 @@ SYMBOL: main-vocab-hook
     ] bind ;
 
 : ignore-cli-args? ( -- ? )
-    macosx? "run" get "ui" = and ;
+    os macosx? "run" get "ui" = and ;
 
 : script-mode ( -- )
     t "quiet" set-global
index 8055e4ff6e141ceda3eff739e11d955da1d4fccd..a1a4bd380925e46b6a3636b227d302de1be3c1a5 100755 (executable)
@@ -19,14 +19,14 @@ IN: cpu.ppc.architecture
 
 : reserved-area-size
     os {
-        { "linux" [ 2 ] }
-        { "macosx" [ 6 ] }
+        { linux [ 2 ] }
+        { macosx [ 6 ] }
     } case cells ; foldable
 
 : lr-save
     os {
-        { "linux" [ 1 ] }
-        { "macosx" [ 2 ] }
+        { linux [ 1 ] }
+        { macosx [ 2 ] }
     } case cells ; foldable
 
 : param@ ( n -- x ) reserved-area-size + ; inline
@@ -58,8 +58,8 @@ M: int-regs vregs
 M: float-regs return-reg drop 1 ;
 M: float-regs param-regs 
     drop os H{
-        { "macosx" { 1 2 3 4 5 6 7 8 9 10 11 12 13 } }
-        { "linux" { 1 2 3 4 5 6 7 8 } }
+        { macosx { 1 2 3 4 5 6 7 8 9 10 11 12 13 } }
+        { linux { 1 2 3 4 5 6 7 8 } }
     } at ;
 M: float-regs vregs drop { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
 
@@ -273,9 +273,9 @@ M: ppc %cleanup ( alien-node -- ) drop ;
 M: ppc value-structs?
     #! On Linux/PPC, value structs are passed in the same way
     #! as reference structs, we just have to make a copy first.
-    linux? not ;
+    os linux? not ;
 
-M: ppc fp-shadows-int? ( -- ? ) macosx? ;
+M: ppc fp-shadows-int? ( -- ? ) os macosx? ;
 
 M: ppc small-enough? ( n -- ? ) -32768 32767 between? ;
 
index da17da9185df6faa51ff35054ca9d220175cdde7..eede86085b112f44246f3eb6dc1898d7c55f309c 100755 (executable)
@@ -2,16 +2,13 @@ USING: cpu.ppc.architecture cpu.ppc.intrinsics cpu.architecture
 namespaces alien.c-types kernel system combinators ;
 
 {
-    { [ macosx? ] [
+    { [ os macosx? ] [
         4 "longlong" c-type set-c-type-align
         4 "ulonglong" c-type set-c-type-align
+        4 "double" c-type set-c-type-align
     ] }
-    { [ linux? ] [
+    { [ os linux? ] [
         t "longlong" c-type set-c-type-stack-align?
         t "ulonglong" c-type set-c-type-stack-align?
     ] }
 } cond
-
-macosx? [
-    4 "double" c-type set-c-type-align
-] when
index 3ebee73cbf256082a200c377a2fa00134b156c90..4d447b38fcd939bf32093a0992062e0b7446e505 100755 (executable)
@@ -253,12 +253,9 @@ M: x86.32 %cleanup ( alien-node -- )
 
 M: x86.32 %unwind ( n -- ) %epilogue-later RET ;
 
-windows? [
+os windows? [
     cell "longlong" c-type set-c-type-align
     cell "ulonglong" c-type set-c-type-align
-] unless
-
-windows? [
     4 "double" c-type set-c-type-align
 ] unless
 
index 76c4f1691adb606c4ff8b0beb6533e3fb06cc9ae..6c9a4dc05fe490ef1441227de455e957150b3887 100755 (executable)
@@ -154,7 +154,7 @@ M: x86 %unbox-small-struct ( size -- )
 
 M: x86 struct-small-enough? ( size -- ? )
     { 1 2 4 8 } member?
-    os { "linux" "netbsd" "solaris" } member? not and ;
+    os { linux netbsd solaris } member? not and ;
 
 M: x86 %return ( -- ) 0 %unwind ;
 
index 7581377a6a2e6b37b452f1bc79235fd11661fcf1..5cc044246405306f7c39c8441d833f92ad5473ca 100755 (executable)
@@ -111,7 +111,7 @@ SYMBOL: literal-table
 : add-literal ( obj -- n ) literal-table get push-new* ;
 
 : string>symbol ( str -- alien )
-    [ wince? [ string>u16-alien ] [ string>char-alien ] if ]
+    [ os wince? [ string>u16-alien ] [ string>char-alien ] if ]
     over string? [ call ] [ map ] if ;
 
 : add-dlsym-literals ( symbol dll -- )
index 720894d4891c72aa0ae582bafb35454e70867618..45bf0602f2100915fb43e3e5f903c3b67b0d518f 100755 (executable)
@@ -43,9 +43,9 @@ HOOK: (file-appender) io-backend ( path -- stream )
     >r <file-appender> r> with-stream ; inline
 
 ! Pathnames
-: path-separator? ( ch -- ? ) windows? "/\\" "/" ? member? ;
+: path-separator? ( ch -- ? ) os windows? "/\\" "/" ? member? ;
 
-: path-separator ( -- string ) windows? "\\" "/" ? ;
+: path-separator ( -- string ) os windows? "\\" "/" ? ;
 
 : right-trim-separators ( str -- newstr )
     [ path-separator? ] right-trim ;
@@ -112,7 +112,7 @@ PRIVATE>
     {
         { [ dup empty? ] [ f ] }
         { [ dup "resource:" head? ] [ t ] }
-        { [ windows? ] [ windows-absolute-path? ] }
+        { [ os windows? ] [ windows-absolute-path? ] }
         { [ dup first path-separator? ] [ t ] }
         { [ t ] [ f ] }
     } cond nip ;
@@ -322,7 +322,7 @@ M: pathname <=> [ pathname-string ] compare ;
 ! Home directory
 : home ( -- dir )
     {
-        { [ winnt? ] [ "USERPROFILE" os-env ] }
-        { [ wince? ] [ "" resource-path ] }
-        { [ unix? ] [ "HOME" os-env ] }
+        { [ os winnt? ] [ "USERPROFILE" os-env ] }
+        { [ os wince? ] [ "" resource-path ] }
+        { [ os unix? ] [ "HOME" os-env ] }
     } cond ;
index 7e7a5ff215fa604b80bb41dabff584a3fc8bc9be..9124efcb8c098315c3c4013e1c312208a01ea412 100755 (executable)
@@ -5,14 +5,8 @@ IN: system
 ARTICLE: "os" "System interface"
 "Operating system detection:"
 { $subsection os }
-{ $subsection unix? }
-{ $subsection macosx? }
-{ $subsection solaris? }
-{ $subsection windows? }
-{ $subsection winnt? }
 { $subsection win32? }
 { $subsection win64? }
-{ $subsection wince? }
 "Processor detection:"
 { $subsection cpu }
 "Reading environment variables:"
@@ -32,23 +26,23 @@ ABOUT: "os"
 HELP: cpu
 { $values { "cpu" string } }
 { $description
-    "Outputs a string descriptor of the current CPU architecture. Currently, this set of descriptors is:"
-    { $code "x86.32" "x86.64" "ppc" "arm" }
+    "Outputs a singleton class with the name of the current CPU architecture. Currently, this set of descriptors is:"
+    { $code x86.32 x86.64 ppc arm }
 } ;
 
 HELP: os
 { $values { "os" string } }
 { $description
-    "Outputs a string descriptor of the current operating system family. Currently, this set of descriptors is:"
+    "Outputs a singleton class with the name of the current operating system family. Currently, this set of descriptors is:"
     { $code
-        "freebsd"
-        "linux"
-        "macosx"
-        "openbsd"
-        "netbsd"
-        "solaris"
-        "wince"
-        "winnt"
+        freebsd
+        linux
+        macosx
+        openbsd
+        netbsd
+        solaris
+        wince
+        winnt
     }
 } ;
 
@@ -56,34 +50,6 @@ HELP: embedded?
 { $values { "?" "a boolean" } }
 { $description "Tests if this Factor instance is embedded in another application." } ;
 
-HELP: windows?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Windows." } ;
-
-HELP: winnt?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Windows XP or Vista." } ;
-
-HELP: wince?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Windows CE." } ;
-
-HELP: macosx?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Mac OS X." } ;
-
-HELP: linux?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Linux." } ;
-
-HELP: solaris?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Solaris." } ;
-
-HELP: bsd?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on FreeBSD/OpenBSD/NetBSD." } ;
-
 HELP: exit ( n -- )
 { $values { "n" "an integer exit code" } }
 { $description "Exits the Factor process." } ;
@@ -135,7 +101,3 @@ HELP: image
 HELP: vm
 { $values { "path" "a pathname string" } }
 { $description "Outputs the pathname of the currently running Factor VM." } ;
-
-HELP: unix?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on a Unix-like system. While this is a rather vague notion, one can use it to make certain assumptions about system calls and file structure which are not valid on Windows." } ;
index 4b074ed7aad9fc275a4ae451b7639b23884e29ee..14e34ccb1787c9c9c0cb805355af449582eca3cb 100755 (executable)
@@ -1,11 +1,11 @@
 USING: math tools.test system prettyprint namespaces kernel ;
 IN: system.tests
 
-wince? [
+os wince? [
     [ ] [ os-envs . ] unit-test
 ] unless
 
-unix? [
+os unix? [
     [ ] [ os-envs "envs" set ] unit-test
     [ ] [ { { "A" "B" } } set-os-envs ] unit-test
     [ "B" ] [ "A" os-env ] unit-test
index 459af28537637133a7889377333adf54d6822387..00b3f87e9853e49125af4c3ffa8a1471c2df4804 100755 (executable)
@@ -4,10 +4,6 @@ IN: system
 USING: kernel kernel.private sequences math namespaces
 init splitting assocs system.private layouts words ;
 
-! : cpu ( -- cpu ) 8 getenv ; foldable
-
-: os ( -- os ) 9 getenv ; foldable
-
 SINGLETON: x86.32
 SINGLETON: x86.64
 SINGLETON: arm
@@ -17,17 +13,23 @@ UNION: x86 x86.32 x86.64 ;
 
 : cpu ( -- class ) \ cpu get ;
 
-! SINGLETON: winnt
-! SINGLETON: wince
+SINGLETON: winnt
+SINGLETON: wince
+
+UNION: windows winnt wince ;
+
+SINGLETON: freebsd
+SINGLETON: netbsd
+SINGLETON: openbsd
+SINGLETON: solaris
+SINGLETON: macosx
+SINGLETON: linux
+
+UNION: bsd freebsd netbsd openbsd macosx ;
 
-! UNION: windows winnt wince ;
+UNION: unix bsd solaris linux ;
 
-! SINGLETON: freebsd
-! SINGLETON: netbsd
-! SINGLETON: openbsd
-! SINGLETON: solaris
-! SINGLETON: macosx
-! SINGLETON: linux
+: os ( -- class ) \ os get ;
 
 <PRIVATE
 
@@ -39,52 +41,39 @@ UNION: x86 x86.32 x86.64 ;
         { "ppc" ppc }
     } at ;
 
-PRIVATE>
+: string>os ( str -- class )
+    H{
+        { "winnt" winnt }
+        { "wince" wince }
+        { "freebsd" freebsd }
+        { "netbsd" netbsd }
+        { "openbsd" openbsd }
+        { "solaris" solaris }
+        { "macosx" macosx }
+        { "linux" linux }
+    } at ;
 
-! : os ( -- class ) \ os get ;
+PRIVATE>
 
 [
     8 getenv string>cpu \ cpu set-global
-    9 getenv string>os \ os set-global
+    9 getenv string>os \ os set-global
 ] "system" add-init-hook
 
 : image ( -- path ) 13 getenv ;
 
 : vm ( -- path ) 14 getenv ;
 
-: wince? ( -- ? )
-    os "wince" = ; foldable
-
-: winnt? ( -- ? )
-    os "winnt" = ; foldable
-
-: windows? ( -- ? )
-    wince? winnt? or ; foldable
-
 : win32? ( -- ? )
-    winnt? cell 4 = and ; foldable
+    os winnt?
+    cell 4 = and ; foldable
 
 : win64? ( -- ? )
-    winnt? cell 8 = and ; foldable
-
-: macosx? ( -- ? ) os "macosx" = ; foldable
+    os winnt?
+    cell 8 = and ; foldable
 
 : embedded? ( -- ? ) 15 getenv ;
 
-: unix? ( -- ? )
-    os {
-        "freebsd" "openbsd" "netbsd" "linux" "macosx" "solaris"
-    } member? ;
-
-: bsd? ( -- ? )
-    os { "freebsd" "openbsd" "netbsd" "macosx" } member? ;
-
-: linux? ( -- ? )
-    os "linux" = ;
-
-: solaris? ( -- ? )
-    os "solaris" = ;
-
 : os-envs ( -- assoc )
     (os-envs) [ "=" split1 ] H{ } map>assoc ;
 
index 065f7dd5c4a765c6b5e8f2d7303f929e828508e4..a38107fbabcd0ab749af06928b4adc91a752c0ac 100755 (executable)
@@ -5,8 +5,8 @@ IN: bootstrap.io
 "bootstrap.compiler" vocab [
     "io." {
         { [ "io-backend" get ] [ "io-backend" get ] }
-        { [ unix? ] [ "unix" ] }
-        { [ winnt? ] [ "windows.nt" ] }
-        { [ wince? ] [ "windows.ce" ] }
+        { [ os unix? ] [ "unix" ] }
+        { [ os winnt? ] [ "windows.nt" ] }
+        { [ os wince? ] [ "windows.ce" ] }
     } cond append require
 ] when
index daf35b9c03babc4bc7f44359afa6cebd5f6bdac5..fa0c54d0c62809eea5dedc408994f76b2c205a10 100755 (executable)
@@ -5,8 +5,8 @@ namespaces random ;
 "random.mersenne-twister" require
 
 {
-    { [ windows? ] [ "random.windows" require ] }
-    { [ unix? ] [ "random.unix" require ] }
+    { [ os windows? ] [ "random.windows" require ] }
+    { [ os unix? ] [ "random.unix" require ] }
 } cond
 
 ! [ [ 32 random-bits ] with-secure-random <mersenne-twister> random-generator set-global ]
index f8db831dbc1fff1fcfc2b0044711dd58d1fd8123..5aa7683efc39f54c8742aa38d1184221f84181cc 100644 (file)
@@ -4,9 +4,9 @@ vocabs vocabs.loader ;
 "bootstrap.compiler" vocab [
     "ui-backend" get [
         {
-            { [ macosx? ] [ "cocoa" ] }
-            { [ windows? ] [ "windows" ] }
-            { [ unix? ] [ "x11" ] }
+            { [ os macosx? ] [ "cocoa" ] }
+            { [ os windows? ] [ "windows" ] }
+            { [ os unix? ] [ "x11" ] }
         } cond
     ] unless* "ui." prepend require
 
index 75664ce5e522f993a6abe0d7c66013c2644f331c..ece6d64ed9c141f8b935f7ec96ad9590fc6f7eeb 100644 (file)
@@ -245,4 +245,4 @@ USE: bootstrap.image.download
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-MAIN: build-loop
\ No newline at end of file
+MAIN: build-loop
index c319ade93bd13073a9315900f7a89ec8eb6ef12c..dd4faf9f96f15858975caae42ce776eb26c941a6 100644 (file)
@@ -13,10 +13,10 @@ USING: alien alien.syntax combinators system ;
 IN: cairo.ffi
 
 << "cairo" {
-        { [ win32? ] [ "libcairo-2.dll" ] }
-        ! { [ macosx? ] [ "libcairo.dylib" ] }
-        { [ macosx? ] [ "/opt/local/lib/libcairo.dylib" ] }
-        { [ unix? ] [ "libcairo.so.2" ] }
+        { [ os win32? ] [ "libcairo-2.dll" ] }
+        ! { [ os macosx? ] [ "libcairo.dylib" ] }
+        { [ os macosx? ] [ "/opt/local/lib/libcairo.dylib" ] }
+        { [ os unix? ] [ "libcairo.so.2" ] }
   } cond "cdecl" add-library >>
 
 LIBRARY: cairo
index 6c29c0d1aca74fb6b82e1a9acc661ddfed4de7ca..8dcb4af7f1f520f59c39a85e100511f8c93d3b47 100755 (executable)
@@ -377,6 +377,6 @@ M: timestamp sleep-until timestamp>millis sleep-until ;
 M: duration sleep from-now sleep-until ;
 
 {
-    { [ unix? ] [ "calendar.unix" ] }
-    { [ windows? ] [ "calendar.windows" ] }
+    { [ os unix? ] [ "calendar.unix" ] }
+    { [ os windows? ] [ "calendar.windows" ] }
 } cond require
index 856c37a6bc84ddd1b84130335c676d1485c4eee1..e2abd6deb92ed2b6d884f52f1b6df87fd20aad8d 100755 (executable)
@@ -1,33 +1,33 @@
-IN: concurrency.distributed.tests\r
-USING: tools.test concurrency.distributed kernel io.files\r
-arrays io.sockets system combinators threads math sequences\r
-concurrency.messaging continuations ;\r
-\r
-: test-node\r
-    {\r
-        { [ unix? ] [ "distributed-concurrency-test" temp-file <local> ] }\r
-        { [ windows? ] [ "127.0.0.1" 1238 <inet4> ] }\r
-    } cond ;\r
-\r
-[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test\r
-\r
-[ ] [ test-node dup 1array swap (start-node) ] unit-test\r
-\r
-[ ] [ yield ] unit-test\r
-\r
-[ ] [\r
-    [\r
-        receive first2 >r 3 + r> send\r
-        "thread-a" unregister-process\r
-    ] "Thread A" spawn\r
-    "thread-a" swap register-process\r
-] unit-test\r
-\r
-[ 8 ] [\r
-    5 self 2array\r
-    "thread-a" test-node <remote-process> send\r
-\r
-    receive\r
-] unit-test\r
-\r
-[ ] [ test-node stop-node ] unit-test\r
+IN: concurrency.distributed.tests
+USING: tools.test concurrency.distributed kernel io.files
+arrays io.sockets system combinators threads math sequences
+concurrency.messaging continuations ;
+
+: test-node
+    {
+        { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
+        { [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] }
+    } cond ;
+
+[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
+
+[ ] [ test-node dup 1array swap (start-node) ] unit-test
+
+[ ] [ yield ] unit-test
+
+[ ] [
+    [
+        receive first2 >r 3 + r> send
+        "thread-a" unregister-process
+    ] "Thread A" spawn
+    "thread-a" swap register-process
+] unit-test
+
+[ 8 ] [
+    5 self 2array
+    "thread-a" test-node <remote-process> send
+
+    receive
+] unit-test
+
+[ ] [ test-node stop-node ] unit-test
index 845381a23c135f85d74384ac7b7f096a234d9401..424cc7c754cc3798fe72edffea7a47b4f95a69c4 100644 (file)
@@ -6,9 +6,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: db.mysql.ffi
 
 << "mysql" {
-    { [ win32? ] [ "libmySQL.dll" "stdcall" ] }
-    { [ macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
-    { [ unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
+    { [ os win32? ] [ "libmySQL.dll" "stdcall" ] }
+    { [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
+    { [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
 } cond add-library >>
 
 LIBRARY: mysql
index be491b8c85d3021d71bd1953afada1cb8267c143..b6aee3dcce703b2c3b063f0fc2bac3f5b8426c83 100755 (executable)
@@ -5,9 +5,9 @@ USING: alien alien.syntax combinators system ;
 IN: db.postgresql.ffi
 
 << "postgresql" {
-    { [ win32? ]  [ "libpq.dll" ] }
-    { [ macosx? ] [ "/opt/local/lib/postgresql82/libpq.dylib" ] }
-    { [ unix?  ]  [ "libpq.so" ] }
+    { [ os win32? ]  [ "libpq.dll" ] }
+    { [ os macosx? ] [ "/opt/local/lib/postgresql82/libpq.dylib" ] }
+    { [ os unix?  ]  [ "libpq.so" ] }
 } cond "cdecl" add-library >>
 
 ! ConnSatusType
index 1d356b15921a4f6f0ca8daeb592156d1326b858e..c724025874f5d79be4f10f852eaba0ecf05834ff 100755 (executable)
@@ -7,9 +7,9 @@ USING: alien compiler kernel math namespaces sequences strings alien.syntax
 IN: db.sqlite.ffi
 
 << "sqlite" {
-        { [ winnt? ]  [ "sqlite3.dll" ] }
-        { [ macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
-        { [ unix? ]  [ "libsqlite3.so" ] }
+        { [ os winnt? ]  [ "sqlite3.dll" ] }
+        { [ os macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
+        { [ os unix? ]  [ "libsqlite3.so" ] }
     } cond "cdecl" add-library >>
 
 ! Return values from sqlite functions
index 775d008963e16bb871b73a3c15c78749c68b730e..62150bdf49e1c90d3bb3d526d9db663b1f9301a7 100755 (executable)
@@ -13,6 +13,6 @@ t vim-detach set-global ! don't block the ui
 T{ gvim } vim-editor set-global
 
 {
-    { [ unix? ] [ "editors.gvim.unix" ] }
-    { [ windows? ] [ "editors.gvim.windows" ] }
+    { [ os unix? ] [ "editors.gvim.unix" ] }
+    { [ os windows? ] [ "editors.gvim.windows" ] }
 } cond require
index 00f7de1370e6a5b11802943dd8def744379f148b..f34bdc9920b6febe169f80685f23a077d72262e1 100755 (executable)
@@ -4,8 +4,8 @@ USING: alien alien.syntax kernel system combinators ;
 IN: freetype
 
 << "freetype" {
-    { [ macosx? ] [ "@executable_path/../Frameworks/libfreetype.6.dylib" "cdecl" add-library ] }
-    { [ windows? ] [ "freetype6.dll" "cdecl" add-library ] }
+    { [ os macosx? ] [ "@executable_path/../Frameworks/libfreetype.6.dylib" "cdecl" add-library ] }
+    { [ os windows? ] [ "freetype6.dll" "cdecl" add-library ] }
     { [ t ] [ drop ] }
 } cond >>
 
index 69b86787499bc1fc6b9df10731677287441f71dd..83e59b312318000d5fd5a3083189bd6ca21ebb23 100755 (executable)
@@ -8,9 +8,9 @@ IN: hardware-info
 
 <<
 {
-    { [ windows? ] [ "hardware-info.windows" ] }
-    { [ linux? ] [ "hardware-info.linux" ] }
-    { [ macosx? ] [ "hardware-info.macosx" ] }
+    { [ os windows? ] [ "hardware-info.windows" ] }
+    { [ os linux? ] [ "hardware-info.linux" ] }
+    { [ os macosx? ] [ "hardware-info.macosx" ] }
     { [ t ] [ f ] }
 } cond [ require ] when* >>
 
index a180a28f23f8b246a8bf48eebf84d2e7e4071215..06a3ec8dd2fe22161e91090dbae65c78fddc1dd7 100644 (file)
@@ -42,6 +42,6 @@ PRIVATE>
     [ with-directory ] curry keep delete-tree ; inline
 
 {
-    { [ unix? ] [ "io.unix.files.unique" ] }
-    { [ windows? ] [ "io.windows.files.unique" ] }
+    { [ os unix? ] [ "io.unix.files.unique" ] }
+    { [ os windows? ] [ "io.windows.files.unique" ] }
 } cond require
index 8480fcd85642baac9e7e734f178a92c715a20419..45130c0ab6cd57a39af9e029c49678ca376885fc 100755 (executable)
@@ -6,8 +6,8 @@ alien.c-types combinators namespaces alien parser ;
 IN: io.sockets.impl
 
 << {
-    { [ windows? ] [ "windows.winsock" ] }
-    { [ unix? ] [ "unix" ] }
+    { [ os windows? ] [ "windows.winsock" ] }
+    { [ os unix? ] [ "unix" ] }
 } cond use+ >>
 
 GENERIC: protocol-family ( addrspec -- af )
index 0a7fc72662cc7ee9580595bf655d8ed4acfd3398..f6607d98f99da1f5cfac07ee987380d88b1556ec 100755 (executable)
@@ -2,4 +2,4 @@ USING: io.unix.backend io.unix.files io.unix.sockets io.timeouts
 io.unix.launcher io.unix.mmap io.backend combinators namespaces
 system vocabs.loader sequences ;
 
-"io.unix." os append require
+"io.unix." os word-name append require
index 152e76a6c7d31530f1aa32c1356e897a3fb6c64e..b8b024d7102b25dd457acc52802c8a03e35bd9fd 100755 (executable)
@@ -37,7 +37,7 @@ M: windows-ce-io (init-stdio) ( -- )
     #! We support Windows NT too, to make this I/O backend
     #! easier to debug.
     512 default-buffer-size [
-        winnt? [
+        os winnt? [
             STD_INPUT_HANDLE GetStdHandle
             STD_OUTPUT_HANDLE GetStdHandle
             STD_ERROR_HANDLE GetStdHandle
index 579745710eea0730e818d5de2dc444b0e9db5ddc..3f230a4ac05ebaf32384463bfa79fba7de33e6a8 100755 (executable)
@@ -82,7 +82,7 @@ TUPLE: CreateProcess-args
 : fill-dwCreateFlags ( process args -- process args )
     0
     pick pass-environment? [ CREATE_UNICODE_ENVIRONMENT bitor ] when
-    pick detached>> winnt? and [ DETACHED_PROCESS bitor ] when
+    pick detached>> os winnt? and [ DETACHED_PROCESS bitor ] when
     pick lookup-priority [ bitor ] when*
     >>dwCreateFlags ;
 
@@ -105,7 +105,7 @@ M: windows-ce-io fill-redirection 2drop ;
 
 : make-CreateProcess-args ( process -- args )
     default-CreateProcess-args
-    wince? [ fill-lpApplicationName ] [ fill-lpCommandLine ] if
+    os wince? [ fill-lpApplicationName ] [ fill-lpCommandLine ] if
     fill-dwCreateFlags
     fill-lpEnvironment
     fill-startup-info
index 830249a3df79ae29df2d79787039455a623f6d7a..9a6997ce298019d6ec29a048f3516054ec392610 100644 (file)
@@ -6,9 +6,9 @@ IN: ogg
 
 <<
 "ogg" {
-    { [ win32? ]  [ "ogg.dll" ] }
-    { [ macosx? ] [ "libogg.0.dylib" ] }
-    { [ unix? ]   [ "libogg.so" ] }
+    { [ os win32? ]  [ "ogg.dll" ] }
+    { [ os macosx? ] [ "libogg.0.dylib" ] }
+    { [ os unix? ]   [ "libogg.so" ] }
 } cond "cdecl" add-library
 >>
 
index 48b61b41a32679c3917b738483ece12669473909..12d2aa4efbde59092fc7f097a365f24bd2f7c7f5 100644 (file)
@@ -6,9 +6,9 @@ IN: ogg.theora
 
 <<
 "theora" {
-    { [ win32? ]  [ "theora.dll" ] }
-    { [ macosx? ] [ "libtheora.0.dylib" ] }
-    { [ unix? ]   [ "libtheora.so" ] }
+    { [ os win32? ]  [ "theora.dll" ] }
+    { [ os macosx? ] [ "libtheora.0.dylib" ] }
+    { [ os unix? ]   [ "libtheora.so" ] }
 } cond "cdecl" add-library
 >>
 
index 170d0ea6ef8510aa6cc23df2f747464932f3cadc..6dbea7869aa7118a33a6c0f3ce91a50fd8cf1e1b 100644 (file)
@@ -6,9 +6,9 @@ IN: ogg.vorbis
 
 <<
 "vorbis" {
-    { [ win32? ]  [ "vorbis.dll" ] }
-    { [ macosx? ] [ "libvorbis.0.dylib" ] }
-    { [ unix? ]   [ "libvorbis.so" ] }
+    { [ os win32? ]  [ "vorbis.dll" ] }
+    { [ os macosx? ] [ "libvorbis.0.dylib" ] }
+    { [ os unix? ]   [ "libvorbis.so" ] }
 } cond "cdecl" add-library 
 >>
 
index f7b97d2bf5fa685044e8386580bb5d768c753629..e37988a8ce3918607c4fc22e7e3f9e9e9f615c3f 100644 (file)
@@ -7,15 +7,15 @@ USING: kernel alien system combinators alien.syntax namespaces
        openal.backend ;
 
 << "alut" {
-        { [ win32? ]  [ "alut.dll" ] }
-        { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
-        { [ unix?  ]  [ "libalut.so" ] }
+        { [ os win32? ]  [ "alut.dll" ] }
+        { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+        { [ os unix?  ]  [ "libalut.so" ] }
     } cond "cdecl" add-library >>
 
 << "openal" {
-        { [ win32? ]  [ "OpenAL32.dll" ] }
-        { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
-        { [ unix?  ]  [ "libopenal.so" ] }
+        { [ os win32? ]  [ "OpenAL32.dll" ] }
+        { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+        { [ os unix?  ]  [ "libopenal.so" ] }
     } cond "cdecl" add-library >>
 
 LIBRARY: openal
@@ -257,7 +257,7 @@ SYMBOL: init
     "create-buffer-from-file failed" throw
   ] when ;
 
-macosx? "openal.macosx" "openal.other" ? require
+os macosx? "openal.macosx" "openal.other" ? require
 
 : create-buffer-from-wav ( filename -- buffer )
   gen-buffer dup rot load-wav-file
index fd9be4eb1291d90d1bd667f6d2279b4de7bdebf6..b0a683dac64abba6597c6fce51273c2b70d23456 100644 (file)
@@ -1,11 +1,13 @@
 USING: alien alien.syntax combinators kernel parser sequences
 system words namespaces hashtables init math arrays assocs 
 sequences.lib continuations ;
+
+ERROR: unknown-gl-platform ;
 << {
-    { [ windows? ] [ "opengl.gl.windows" ] }
-    { [ macosx? ]  [ "opengl.gl.macosx" ] }
-    { [ unix? ] [ "opengl.gl.unix" ] }
-    { [ t ] [ "Unknown OpenGL platform" throw ] }
+    { [ os windows? ] [ "opengl.gl.windows" ] }
+    { [ os macosx? ]  [ "opengl.gl.macosx" ] }
+    { [ os unix? ] [ "opengl.gl.unix" ] }
+    { [ t ] [ unknown-gl-platform ] }
 } cond use+ >>
 IN: opengl.gl.extensions
 
index d06afdc5ea808031aade8927b19d419b5e62f69b..a68cda34ea005ac9a777ff8716f706b2569d41e8 100755 (executable)
@@ -11,9 +11,9 @@ IN: openssl.libcrypto
 
 <<
 "libcrypto" {
-    { [ win32? ]  [ "libeay32.dll" "cdecl" ] }
-    { [ macosx? ] [ "libcrypto.dylib" "cdecl" ] }
-    { [ unix? ]   [ "libcrypto.so" "cdecl" ] }
+    { [ os win32? ]  [ "libeay32.dll" "cdecl" ] }
+    { [ os macosx? ] [ "libcrypto.dylib" "cdecl" ] }
+    { [ os unix? ]   [ "libcrypto.so" "cdecl" ] }
 } cond add-library
 >>
 
index 11dcee31f6b7c2439d2a6dcbd9daa83eb7ae6b7b..098e1f93829d6af2e02d02039e9a23e550b03b5e 100755 (executable)
@@ -10,9 +10,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: openssl.libssl
 
 << "libssl" {
-    { [ win32? ]  [ "ssleay32.dll" "cdecl" ] }
-    { [ macosx? ] [ "libssl.dylib" "cdecl" ] }
-    { [ unix? ]   [ "libssl.so" "cdecl" ] }
+    { [ os win32? ]  [ "ssleay32.dll" "cdecl" ] }
+    { [ os macosx? ] [ "libssl.dylib" "cdecl" ] }
+    { [ os unix? ]   [ "libssl.so" "cdecl" ] }
 } cond add-library >>
 
 : X509_FILETYPE_PEM       1 ; inline
index e5313d5b77b57f2b62e30b6c70d20a0408c7371e..6a482b9f56d6a3a11f97598504f8a4e64c738c22 100644 (file)
@@ -12,9 +12,9 @@ USING: alien alien.syntax combinators kernel system ;
 IN: oracle.liboci
 
 "oci" {
-    { [ win32? ] [ "oci.dll" "stdcall" ] }
-    { [ macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
-    { [ unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
+    { [ os win32? ] [ "oci.dll" "stdcall" ] }
+    { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
+    { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
 } cond add-library
 
 ! ===============================================
index f12512f51084cb62a497d2b193dc18705c142434..893b43844a1ec0fa1e9cd6191b8c8e1a750bedcc 100755 (executable)
@@ -5,5 +5,5 @@ IN: tools.deploy
 
 : deploy ( vocab -- ) deploy* ;
 
-macosx? [ "tools.deploy.macosx" require ] when
-winnt? [ "tools.deploy.windows" require ] when
+os macosx? [ "tools.deploy.macosx" require ] when
+os winnt? [ "tools.deploy.windows" require ] when
index 927f7111fa8fe4708dd1c0501160124a4add25c9..5b835cd52f2c97add83df607ad96c9ee6a81b607 100755 (executable)
@@ -27,7 +27,7 @@ M: method-spec make-disassemble-cmd
     first2 method make-disassemble-cmd ;
 
 : gdb-binary ( -- string )
-    os "freebsd" = "gdb66" "gdb" ? ;
+    os freebsd? "gdb66" "gdb" ? ;
 
 : run-gdb ( -- lines )
     <process>
index eca5740bbc2f43a166f9f01bf6a18afa31ba9475..522c26e92eb579fcc6ac62643eac343bd32ca3d8 100755 (executable)
@@ -49,7 +49,7 @@ TUPLE: deploy-gadget vocab settings ;
         [
             bundle-name
             deploy-ui
-            macosx? [ exit-when-windows-closed ] when
+            os macosx? [ exit-when-windows-closed ] when
             io-settings
             reflection-settings
             advanced-settings
index 55b53bd6d0105411d0335b677607369c6df02a9a..50020072c52ffb2a69fef4510321413b09e2f978 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien.syntax system sequences vocabs.loader ;
 IN: unix.kqueue
 
-<< "unix.kqueue." os append require >>
+<< "unix.kqueue." os word-name append require >>
 
 FUNCTION: int kqueue ( ) ;
 
index f7432332b913cbed2ed1da79201775b7e28d99fd..342047d9aff7defe329b00e649e230729362e0cb 100644 (file)
@@ -60,11 +60,11 @@ FUNCTION: int mkdir ( char* path, mode_t mode ) ;
 <<
   os
   {
-    { "linux"   [ "unix.stat.linux"   require ] }
-    { "macosx"  [ "unix.stat.macosx"  require ] }
-    { "freebsd" [ "unix.stat.freebsd" require ] }
-    { "netbsd"  [ "unix.stat.netbsd" require ] }
-    { "openbsd" [ "unix.stat.openbsd" require ] }
+    { linux   [ "unix.stat.linux"   require ] }
+    { macosx  [ "unix.stat.macosx"  require ] }
+    { freebsd [ "unix.stat.freebsd" require ] }
+    { netbsd  [ "unix.stat.netbsd"  require ] }
+    { openbsd [ "unix.stat.openbsd" require ] }
   }
   case
 >>