update everything to use os singletons

db4
Doug Coleman 2008-04-02 18:25:33 -05:00
parent 7cb3fdcfec
commit 393f77715c
45 changed files with 186 additions and 239 deletions

View File

@ -76,8 +76,8 @@ $nl
{ $examples "Here is a typical usage of " { $link add-library } ":" { $examples "Here is a typical usage of " { $link add-library } ":"
{ $code { $code
"<< \"freetype\" {" "<< \"freetype\" {"
" { [ macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }" " { [ os macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
" { [ windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }" " { [ os windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
" { [ t ] [ drop ] }" " { [ t ] [ drop ] }"
"} cond >>" "} cond >>"
} }

View File

@ -29,7 +29,7 @@ M: f expired? drop t ;
f <displaced-alien> { simple-c-ptr } declare ; inline f <displaced-alien> { simple-c-ptr } declare ; inline
: alien>native-string ( alien -- string ) : 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 ( dll -- string )
(dll-path) alien>native-string ; (dll-path) alien>native-string ;

View File

@ -13,7 +13,7 @@ IN: bootstrap.image
: my-arch ( -- arch ) : my-arch ( -- arch )
cpu word-name 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-image-name ( arch -- string )
"boot." swap ".image" 3append ; "boot." swap ".image" 3append ;

View File

@ -11,7 +11,7 @@ IN: bootstrap.stage2
SYMBOL: bootstrap-time SYMBOL: bootstrap-time
: default-image-name ( -- string ) : default-image-name ( -- string )
vm file-name windows? [ "." split1 drop ] when vm file-name os windows? [ "." split1 drop ] when
".image" append resource-path ; ".image" append resource-path ;
: do-crossref ( -- ) : do-crossref ( -- )
@ -65,8 +65,8 @@ parse-command-line
"-no-crossref" cli-args member? [ do-crossref ] unless "-no-crossref" cli-args member? [ do-crossref ] unless
! Set dll paths ! Set dll paths
wince? [ "windows.ce" require ] when os wince? [ "windows.ce" require ] when
winnt? [ "windows.nt" require ] when os winnt? [ "windows.nt" require ] when
"deploy-vocab" get [ "deploy-vocab" get [
"stage2: deployment mode" print "stage2: deployment mode" print

View File

@ -47,7 +47,7 @@ SYMBOL: main-vocab-hook
] bind ; ] bind ;
: ignore-cli-args? ( -- ? ) : ignore-cli-args? ( -- ? )
macosx? "run" get "ui" = and ; os macosx? "run" get "ui" = and ;
: script-mode ( -- ) : script-mode ( -- )
t "quiet" set-global t "quiet" set-global

View File

@ -19,14 +19,14 @@ IN: cpu.ppc.architecture
: reserved-area-size : reserved-area-size
os { os {
{ "linux" [ 2 ] } { linux [ 2 ] }
{ "macosx" [ 6 ] } { macosx [ 6 ] }
} case cells ; foldable } case cells ; foldable
: lr-save : lr-save
os { os {
{ "linux" [ 1 ] } { linux [ 1 ] }
{ "macosx" [ 2 ] } { macosx [ 2 ] }
} case cells ; foldable } case cells ; foldable
: param@ ( n -- x ) reserved-area-size + ; inline : 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 return-reg drop 1 ;
M: float-regs param-regs M: float-regs param-regs
drop os H{ drop os H{
{ "macosx" { 1 2 3 4 5 6 7 8 9 10 11 12 13 } } { macosx { 1 2 3 4 5 6 7 8 9 10 11 12 13 } }
{ "linux" { 1 2 3 4 5 6 7 8 } } { linux { 1 2 3 4 5 6 7 8 } }
} at ; } at ;
M: float-regs vregs drop { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; 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? M: ppc value-structs?
#! On Linux/PPC, value structs are passed in the same way #! On Linux/PPC, value structs are passed in the same way
#! as reference structs, we just have to make a copy first. #! 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? ; M: ppc small-enough? ( n -- ? ) -32768 32767 between? ;

View File

@ -2,16 +2,13 @@ USING: cpu.ppc.architecture cpu.ppc.intrinsics cpu.architecture
namespaces alien.c-types kernel system combinators ; namespaces alien.c-types kernel system combinators ;
{ {
{ [ macosx? ] [ { [ os macosx? ] [
4 "longlong" c-type set-c-type-align 4 "longlong" c-type set-c-type-align
4 "ulonglong" 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 "longlong" c-type set-c-type-stack-align?
t "ulonglong" c-type set-c-type-stack-align? t "ulonglong" c-type set-c-type-stack-align?
] } ] }
} cond } cond
macosx? [
4 "double" c-type set-c-type-align
] when

View File

@ -253,12 +253,9 @@ M: x86.32 %cleanup ( alien-node -- )
M: x86.32 %unwind ( n -- ) %epilogue-later RET ; M: x86.32 %unwind ( n -- ) %epilogue-later RET ;
windows? [ os windows? [
cell "longlong" c-type set-c-type-align cell "longlong" c-type set-c-type-align
cell "ulonglong" c-type set-c-type-align cell "ulonglong" c-type set-c-type-align
] unless
windows? [
4 "double" c-type set-c-type-align 4 "double" c-type set-c-type-align
] unless ] unless

View File

@ -154,7 +154,7 @@ M: x86 %unbox-small-struct ( size -- )
M: x86 struct-small-enough? ( size -- ? ) M: x86 struct-small-enough? ( size -- ? )
{ 1 2 4 8 } member? { 1 2 4 8 } member?
os { "linux" "netbsd" "solaris" } member? not and ; os { linux netbsd solaris } member? not and ;
M: x86 %return ( -- ) 0 %unwind ; M: x86 %return ( -- ) 0 %unwind ;

View File

@ -111,7 +111,7 @@ SYMBOL: literal-table
: add-literal ( obj -- n ) literal-table get push-new* ; : add-literal ( obj -- n ) literal-table get push-new* ;
: string>symbol ( str -- alien ) : 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 ; over string? [ call ] [ map ] if ;
: add-dlsym-literals ( symbol dll -- ) : add-dlsym-literals ( symbol dll -- )

View File

@ -43,9 +43,9 @@ HOOK: (file-appender) io-backend ( path -- stream )
>r <file-appender> r> with-stream ; inline >r <file-appender> r> with-stream ; inline
! Pathnames ! 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 ) : right-trim-separators ( str -- newstr )
[ path-separator? ] right-trim ; [ path-separator? ] right-trim ;
@ -112,7 +112,7 @@ PRIVATE>
{ {
{ [ dup empty? ] [ f ] } { [ dup empty? ] [ f ] }
{ [ dup "resource:" head? ] [ t ] } { [ dup "resource:" head? ] [ t ] }
{ [ windows? ] [ windows-absolute-path? ] } { [ os windows? ] [ windows-absolute-path? ] }
{ [ dup first path-separator? ] [ t ] } { [ dup first path-separator? ] [ t ] }
{ [ t ] [ f ] } { [ t ] [ f ] }
} cond nip ; } cond nip ;
@ -322,7 +322,7 @@ M: pathname <=> [ pathname-string ] compare ;
! Home directory ! Home directory
: home ( -- dir ) : home ( -- dir )
{ {
{ [ winnt? ] [ "USERPROFILE" os-env ] } { [ os winnt? ] [ "USERPROFILE" os-env ] }
{ [ wince? ] [ "" resource-path ] } { [ os wince? ] [ "" resource-path ] }
{ [ unix? ] [ "HOME" os-env ] } { [ os unix? ] [ "HOME" os-env ] }
} cond ; } cond ;

View File

@ -5,14 +5,8 @@ IN: system
ARTICLE: "os" "System interface" ARTICLE: "os" "System interface"
"Operating system detection:" "Operating system detection:"
{ $subsection os } { $subsection os }
{ $subsection unix? }
{ $subsection macosx? }
{ $subsection solaris? }
{ $subsection windows? }
{ $subsection winnt? }
{ $subsection win32? } { $subsection win32? }
{ $subsection win64? } { $subsection win64? }
{ $subsection wince? }
"Processor detection:" "Processor detection:"
{ $subsection cpu } { $subsection cpu }
"Reading environment variables:" "Reading environment variables:"
@ -32,23 +26,23 @@ ABOUT: "os"
HELP: cpu HELP: cpu
{ $values { "cpu" string } } { $values { "cpu" string } }
{ $description { $description
"Outputs a string descriptor of the current CPU architecture. Currently, this set of descriptors is:" "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" } { $code x86.32 x86.64 ppc arm }
} ; } ;
HELP: os HELP: os
{ $values { "os" string } } { $values { "os" string } }
{ $description { $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 { $code
"freebsd" freebsd
"linux" linux
"macosx" macosx
"openbsd" openbsd
"netbsd" netbsd
"solaris" solaris
"wince" wince
"winnt" winnt
} }
} ; } ;
@ -56,34 +50,6 @@ HELP: embedded?
{ $values { "?" "a boolean" } } { $values { "?" "a boolean" } }
{ $description "Tests if this Factor instance is embedded in another application." } ; { $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 -- ) HELP: exit ( n -- )
{ $values { "n" "an integer exit code" } } { $values { "n" "an integer exit code" } }
{ $description "Exits the Factor process." } ; { $description "Exits the Factor process." } ;
@ -135,7 +101,3 @@ HELP: image
HELP: vm HELP: vm
{ $values { "path" "a pathname string" } } { $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor VM." } ; { $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." } ;

View File

@ -1,11 +1,11 @@
USING: math tools.test system prettyprint namespaces kernel ; USING: math tools.test system prettyprint namespaces kernel ;
IN: system.tests IN: system.tests
wince? [ os wince? [
[ ] [ os-envs . ] unit-test [ ] [ os-envs . ] unit-test
] unless ] unless
unix? [ os unix? [
[ ] [ os-envs "envs" set ] unit-test [ ] [ os-envs "envs" set ] unit-test
[ ] [ { { "A" "B" } } set-os-envs ] unit-test [ ] [ { { "A" "B" } } set-os-envs ] unit-test
[ "B" ] [ "A" os-env ] unit-test [ "B" ] [ "A" os-env ] unit-test

View File

@ -4,10 +4,6 @@ IN: system
USING: kernel kernel.private sequences math namespaces USING: kernel kernel.private sequences math namespaces
init splitting assocs system.private layouts words ; init splitting assocs system.private layouts words ;
! : cpu ( -- cpu ) 8 getenv ; foldable
: os ( -- os ) 9 getenv ; foldable
SINGLETON: x86.32 SINGLETON: x86.32
SINGLETON: x86.64 SINGLETON: x86.64
SINGLETON: arm SINGLETON: arm
@ -17,17 +13,23 @@ UNION: x86 x86.32 x86.64 ;
: cpu ( -- class ) \ cpu get ; : cpu ( -- class ) \ cpu get ;
! SINGLETON: winnt SINGLETON: winnt
! SINGLETON: wince SINGLETON: wince
! UNION: windows winnt wince ; UNION: windows winnt wince ;
! SINGLETON: freebsd SINGLETON: freebsd
! SINGLETON: netbsd SINGLETON: netbsd
! SINGLETON: openbsd SINGLETON: openbsd
! SINGLETON: solaris SINGLETON: solaris
! SINGLETON: macosx SINGLETON: macosx
! SINGLETON: linux SINGLETON: linux
UNION: bsd freebsd netbsd openbsd macosx ;
UNION: unix bsd solaris linux ;
: os ( -- class ) \ os get ;
<PRIVATE <PRIVATE
@ -39,52 +41,39 @@ UNION: x86 x86.32 x86.64 ;
{ "ppc" ppc } { "ppc" ppc }
} at ; } 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 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 ] "system" add-init-hook
: image ( -- path ) 13 getenv ; : image ( -- path ) 13 getenv ;
: vm ( -- path ) 14 getenv ; : vm ( -- path ) 14 getenv ;
: wince? ( -- ? )
os "wince" = ; foldable
: winnt? ( -- ? )
os "winnt" = ; foldable
: windows? ( -- ? )
wince? winnt? or ; foldable
: win32? ( -- ? ) : win32? ( -- ? )
winnt? cell 4 = and ; foldable os winnt?
cell 4 = and ; foldable
: win64? ( -- ? ) : win64? ( -- ? )
winnt? cell 8 = and ; foldable os winnt?
cell 8 = and ; foldable
: macosx? ( -- ? ) os "macosx" = ; foldable
: embedded? ( -- ? ) 15 getenv ; : 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 ( -- assoc )
(os-envs) [ "=" split1 ] H{ } map>assoc ; (os-envs) [ "=" split1 ] H{ } map>assoc ;

View File

@ -5,8 +5,8 @@ IN: bootstrap.io
"bootstrap.compiler" vocab [ "bootstrap.compiler" vocab [
"io." { "io." {
{ [ "io-backend" get ] [ "io-backend" get ] } { [ "io-backend" get ] [ "io-backend" get ] }
{ [ unix? ] [ "unix" ] } { [ os unix? ] [ "unix" ] }
{ [ winnt? ] [ "windows.nt" ] } { [ os winnt? ] [ "windows.nt" ] }
{ [ wince? ] [ "windows.ce" ] } { [ os wince? ] [ "windows.ce" ] }
} cond append require } cond append require
] when ] when

View File

@ -5,8 +5,8 @@ namespaces random ;
"random.mersenne-twister" require "random.mersenne-twister" require
{ {
{ [ windows? ] [ "random.windows" require ] } { [ os windows? ] [ "random.windows" require ] }
{ [ unix? ] [ "random.unix" require ] } { [ os unix? ] [ "random.unix" require ] }
} cond } cond
! [ [ 32 random-bits ] with-secure-random <mersenne-twister> random-generator set-global ] ! [ [ 32 random-bits ] with-secure-random <mersenne-twister> random-generator set-global ]

View File

@ -4,9 +4,9 @@ vocabs vocabs.loader ;
"bootstrap.compiler" vocab [ "bootstrap.compiler" vocab [
"ui-backend" get [ "ui-backend" get [
{ {
{ [ macosx? ] [ "cocoa" ] } { [ os macosx? ] [ "cocoa" ] }
{ [ windows? ] [ "windows" ] } { [ os windows? ] [ "windows" ] }
{ [ unix? ] [ "x11" ] } { [ os unix? ] [ "x11" ] }
} cond } cond
] unless* "ui." prepend require ] unless* "ui." prepend require

View File

@ -245,4 +245,4 @@ USE: bootstrap.image.download
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MAIN: build-loop MAIN: build-loop

View File

@ -13,10 +13,10 @@ USING: alien alien.syntax combinators system ;
IN: cairo.ffi IN: cairo.ffi
<< "cairo" { << "cairo" {
{ [ win32? ] [ "libcairo-2.dll" ] } { [ os win32? ] [ "libcairo-2.dll" ] }
! { [ macosx? ] [ "libcairo.dylib" ] } ! { [ os macosx? ] [ "libcairo.dylib" ] }
{ [ macosx? ] [ "/opt/local/lib/libcairo.dylib" ] } { [ os macosx? ] [ "/opt/local/lib/libcairo.dylib" ] }
{ [ unix? ] [ "libcairo.so.2" ] } { [ os unix? ] [ "libcairo.so.2" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>
LIBRARY: cairo LIBRARY: cairo

View File

@ -377,6 +377,6 @@ M: timestamp sleep-until timestamp>millis sleep-until ;
M: duration sleep from-now sleep-until ; M: duration sleep from-now sleep-until ;
{ {
{ [ unix? ] [ "calendar.unix" ] } { [ os unix? ] [ "calendar.unix" ] }
{ [ windows? ] [ "calendar.windows" ] } { [ os windows? ] [ "calendar.windows" ] }
} cond require } cond require

View File

@ -1,33 +1,33 @@
IN: concurrency.distributed.tests IN: concurrency.distributed.tests
USING: tools.test concurrency.distributed kernel io.files USING: tools.test concurrency.distributed kernel io.files
arrays io.sockets system combinators threads math sequences arrays io.sockets system combinators threads math sequences
concurrency.messaging continuations ; concurrency.messaging continuations ;
: test-node : test-node
{ {
{ [ unix? ] [ "distributed-concurrency-test" temp-file <local> ] } { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
{ [ windows? ] [ "127.0.0.1" 1238 <inet4> ] } { [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] }
} cond ; } cond ;
[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test [ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
[ ] [ test-node dup 1array swap (start-node) ] unit-test [ ] [ test-node dup 1array swap (start-node) ] unit-test
[ ] [ yield ] unit-test [ ] [ yield ] unit-test
[ ] [ [ ] [
[ [
receive first2 >r 3 + r> send receive first2 >r 3 + r> send
"thread-a" unregister-process "thread-a" unregister-process
] "Thread A" spawn ] "Thread A" spawn
"thread-a" swap register-process "thread-a" swap register-process
] unit-test ] unit-test
[ 8 ] [ [ 8 ] [
5 self 2array 5 self 2array
"thread-a" test-node <remote-process> send "thread-a" test-node <remote-process> send
receive receive
] unit-test ] unit-test
[ ] [ test-node stop-node ] unit-test [ ] [ test-node stop-node ] unit-test

View File

@ -6,9 +6,9 @@ USING: alien alien.syntax combinators kernel system ;
IN: db.mysql.ffi IN: db.mysql.ffi
<< "mysql" { << "mysql" {
{ [ win32? ] [ "libmySQL.dll" "stdcall" ] } { [ os win32? ] [ "libmySQL.dll" "stdcall" ] }
{ [ macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] } { [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
{ [ unix? ] [ "libmysqlclient.so.14" "cdecl" ] } { [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
} cond add-library >> } cond add-library >>
LIBRARY: mysql LIBRARY: mysql

View File

@ -5,9 +5,9 @@ USING: alien alien.syntax combinators system ;
IN: db.postgresql.ffi IN: db.postgresql.ffi
<< "postgresql" { << "postgresql" {
{ [ win32? ] [ "libpq.dll" ] } { [ os win32? ] [ "libpq.dll" ] }
{ [ macosx? ] [ "/opt/local/lib/postgresql82/libpq.dylib" ] } { [ os macosx? ] [ "/opt/local/lib/postgresql82/libpq.dylib" ] }
{ [ unix? ] [ "libpq.so" ] } { [ os unix? ] [ "libpq.so" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>
! ConnSatusType ! ConnSatusType

View File

@ -7,9 +7,9 @@ USING: alien compiler kernel math namespaces sequences strings alien.syntax
IN: db.sqlite.ffi IN: db.sqlite.ffi
<< "sqlite" { << "sqlite" {
{ [ winnt? ] [ "sqlite3.dll" ] } { [ os winnt? ] [ "sqlite3.dll" ] }
{ [ macosx? ] [ "/usr/lib/libsqlite3.dylib" ] } { [ os macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
{ [ unix? ] [ "libsqlite3.so" ] } { [ os unix? ] [ "libsqlite3.so" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>
! Return values from sqlite functions ! Return values from sqlite functions

View File

@ -13,6 +13,6 @@ t vim-detach set-global ! don't block the ui
T{ gvim } vim-editor set-global T{ gvim } vim-editor set-global
{ {
{ [ unix? ] [ "editors.gvim.unix" ] } { [ os unix? ] [ "editors.gvim.unix" ] }
{ [ windows? ] [ "editors.gvim.windows" ] } { [ os windows? ] [ "editors.gvim.windows" ] }
} cond require } cond require

View File

@ -4,8 +4,8 @@ USING: alien alien.syntax kernel system combinators ;
IN: freetype IN: freetype
<< "freetype" { << "freetype" {
{ [ macosx? ] [ "@executable_path/../Frameworks/libfreetype.6.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "@executable_path/../Frameworks/libfreetype.6.dylib" "cdecl" add-library ] }
{ [ windows? ] [ "freetype6.dll" "cdecl" add-library ] } { [ os windows? ] [ "freetype6.dll" "cdecl" add-library ] }
{ [ t ] [ drop ] } { [ t ] [ drop ] }
} cond >> } cond >>

View File

@ -8,9 +8,9 @@ IN: hardware-info
<< <<
{ {
{ [ windows? ] [ "hardware-info.windows" ] } { [ os windows? ] [ "hardware-info.windows" ] }
{ [ linux? ] [ "hardware-info.linux" ] } { [ os linux? ] [ "hardware-info.linux" ] }
{ [ macosx? ] [ "hardware-info.macosx" ] } { [ os macosx? ] [ "hardware-info.macosx" ] }
{ [ t ] [ f ] } { [ t ] [ f ] }
} cond [ require ] when* >> } cond [ require ] when* >>

View File

@ -42,6 +42,6 @@ PRIVATE>
[ with-directory ] curry keep delete-tree ; inline [ with-directory ] curry keep delete-tree ; inline
{ {
{ [ unix? ] [ "io.unix.files.unique" ] } { [ os unix? ] [ "io.unix.files.unique" ] }
{ [ windows? ] [ "io.windows.files.unique" ] } { [ os windows? ] [ "io.windows.files.unique" ] }
} cond require } cond require

View File

@ -6,8 +6,8 @@ alien.c-types combinators namespaces alien parser ;
IN: io.sockets.impl IN: io.sockets.impl
<< { << {
{ [ windows? ] [ "windows.winsock" ] } { [ os windows? ] [ "windows.winsock" ] }
{ [ unix? ] [ "unix" ] } { [ os unix? ] [ "unix" ] }
} cond use+ >> } cond use+ >>
GENERIC: protocol-family ( addrspec -- af ) GENERIC: protocol-family ( addrspec -- af )

View File

@ -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 io.unix.launcher io.unix.mmap io.backend combinators namespaces
system vocabs.loader sequences ; system vocabs.loader sequences ;
"io.unix." os append require "io.unix." os word-name append require

View File

@ -37,7 +37,7 @@ M: windows-ce-io (init-stdio) ( -- )
#! We support Windows NT too, to make this I/O backend #! We support Windows NT too, to make this I/O backend
#! easier to debug. #! easier to debug.
512 default-buffer-size [ 512 default-buffer-size [
winnt? [ os winnt? [
STD_INPUT_HANDLE GetStdHandle STD_INPUT_HANDLE GetStdHandle
STD_OUTPUT_HANDLE GetStdHandle STD_OUTPUT_HANDLE GetStdHandle
STD_ERROR_HANDLE GetStdHandle STD_ERROR_HANDLE GetStdHandle

View File

@ -82,7 +82,7 @@ TUPLE: CreateProcess-args
: fill-dwCreateFlags ( process args -- process args ) : fill-dwCreateFlags ( process args -- process args )
0 0
pick pass-environment? [ CREATE_UNICODE_ENVIRONMENT bitor ] when 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* pick lookup-priority [ bitor ] when*
>>dwCreateFlags ; >>dwCreateFlags ;
@ -105,7 +105,7 @@ M: windows-ce-io fill-redirection 2drop ;
: make-CreateProcess-args ( process -- args ) : make-CreateProcess-args ( process -- args )
default-CreateProcess-args default-CreateProcess-args
wince? [ fill-lpApplicationName ] [ fill-lpCommandLine ] if os wince? [ fill-lpApplicationName ] [ fill-lpCommandLine ] if
fill-dwCreateFlags fill-dwCreateFlags
fill-lpEnvironment fill-lpEnvironment
fill-startup-info fill-startup-info

View File

@ -6,9 +6,9 @@ IN: ogg
<< <<
"ogg" { "ogg" {
{ [ win32? ] [ "ogg.dll" ] } { [ os win32? ] [ "ogg.dll" ] }
{ [ macosx? ] [ "libogg.0.dylib" ] } { [ os macosx? ] [ "libogg.0.dylib" ] }
{ [ unix? ] [ "libogg.so" ] } { [ os unix? ] [ "libogg.so" ] }
} cond "cdecl" add-library } cond "cdecl" add-library
>> >>

View File

@ -6,9 +6,9 @@ IN: ogg.theora
<< <<
"theora" { "theora" {
{ [ win32? ] [ "theora.dll" ] } { [ os win32? ] [ "theora.dll" ] }
{ [ macosx? ] [ "libtheora.0.dylib" ] } { [ os macosx? ] [ "libtheora.0.dylib" ] }
{ [ unix? ] [ "libtheora.so" ] } { [ os unix? ] [ "libtheora.so" ] }
} cond "cdecl" add-library } cond "cdecl" add-library
>> >>

View File

@ -6,9 +6,9 @@ IN: ogg.vorbis
<< <<
"vorbis" { "vorbis" {
{ [ win32? ] [ "vorbis.dll" ] } { [ os win32? ] [ "vorbis.dll" ] }
{ [ macosx? ] [ "libvorbis.0.dylib" ] } { [ os macosx? ] [ "libvorbis.0.dylib" ] }
{ [ unix? ] [ "libvorbis.so" ] } { [ os unix? ] [ "libvorbis.so" ] }
} cond "cdecl" add-library } cond "cdecl" add-library
>> >>

View File

@ -7,15 +7,15 @@ USING: kernel alien system combinators alien.syntax namespaces
openal.backend ; openal.backend ;
<< "alut" { << "alut" {
{ [ win32? ] [ "alut.dll" ] } { [ os win32? ] [ "alut.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] } { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libalut.so" ] } { [ os unix? ] [ "libalut.so" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>
<< "openal" { << "openal" {
{ [ win32? ] [ "OpenAL32.dll" ] } { [ os win32? ] [ "OpenAL32.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] } { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libopenal.so" ] } { [ os unix? ] [ "libopenal.so" ] }
} cond "cdecl" add-library >> } cond "cdecl" add-library >>
LIBRARY: openal LIBRARY: openal
@ -257,7 +257,7 @@ SYMBOL: init
"create-buffer-from-file failed" throw "create-buffer-from-file failed" throw
] when ; ] when ;
macosx? "openal.macosx" "openal.other" ? require os macosx? "openal.macosx" "openal.other" ? require
: create-buffer-from-wav ( filename -- buffer ) : create-buffer-from-wav ( filename -- buffer )
gen-buffer dup rot load-wav-file gen-buffer dup rot load-wav-file

View File

@ -1,11 +1,13 @@
USING: alien alien.syntax combinators kernel parser sequences USING: alien alien.syntax combinators kernel parser sequences
system words namespaces hashtables init math arrays assocs system words namespaces hashtables init math arrays assocs
sequences.lib continuations ; sequences.lib continuations ;
ERROR: unknown-gl-platform ;
<< { << {
{ [ windows? ] [ "opengl.gl.windows" ] } { [ os windows? ] [ "opengl.gl.windows" ] }
{ [ macosx? ] [ "opengl.gl.macosx" ] } { [ os macosx? ] [ "opengl.gl.macosx" ] }
{ [ unix? ] [ "opengl.gl.unix" ] } { [ os unix? ] [ "opengl.gl.unix" ] }
{ [ t ] [ "Unknown OpenGL platform" throw ] } { [ t ] [ unknown-gl-platform ] }
} cond use+ >> } cond use+ >>
IN: opengl.gl.extensions IN: opengl.gl.extensions

View File

@ -11,9 +11,9 @@ IN: openssl.libcrypto
<< <<
"libcrypto" { "libcrypto" {
{ [ win32? ] [ "libeay32.dll" "cdecl" ] } { [ os win32? ] [ "libeay32.dll" "cdecl" ] }
{ [ macosx? ] [ "libcrypto.dylib" "cdecl" ] } { [ os macosx? ] [ "libcrypto.dylib" "cdecl" ] }
{ [ unix? ] [ "libcrypto.so" "cdecl" ] } { [ os unix? ] [ "libcrypto.so" "cdecl" ] }
} cond add-library } cond add-library
>> >>

View File

@ -10,9 +10,9 @@ USING: alien alien.syntax combinators kernel system ;
IN: openssl.libssl IN: openssl.libssl
<< "libssl" { << "libssl" {
{ [ win32? ] [ "ssleay32.dll" "cdecl" ] } { [ os win32? ] [ "ssleay32.dll" "cdecl" ] }
{ [ macosx? ] [ "libssl.dylib" "cdecl" ] } { [ os macosx? ] [ "libssl.dylib" "cdecl" ] }
{ [ unix? ] [ "libssl.so" "cdecl" ] } { [ os unix? ] [ "libssl.so" "cdecl" ] }
} cond add-library >> } cond add-library >>
: X509_FILETYPE_PEM 1 ; inline : X509_FILETYPE_PEM 1 ; inline

View File

@ -12,9 +12,9 @@ USING: alien alien.syntax combinators kernel system ;
IN: oracle.liboci IN: oracle.liboci
"oci" { "oci" {
{ [ win32? ] [ "oci.dll" "stdcall" ] } { [ os win32? ] [ "oci.dll" "stdcall" ] }
{ [ macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] } { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
{ [ unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] } { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
} cond add-library } cond add-library
! =============================================== ! ===============================================

View File

@ -5,5 +5,5 @@ IN: tools.deploy
: deploy ( vocab -- ) deploy* ; : deploy ( vocab -- ) deploy* ;
macosx? [ "tools.deploy.macosx" require ] when os macosx? [ "tools.deploy.macosx" require ] when
winnt? [ "tools.deploy.windows" require ] when os winnt? [ "tools.deploy.windows" require ] when

View File

@ -27,7 +27,7 @@ M: method-spec make-disassemble-cmd
first2 method make-disassemble-cmd ; first2 method make-disassemble-cmd ;
: gdb-binary ( -- string ) : gdb-binary ( -- string )
os "freebsd" = "gdb66" "gdb" ? ; os freebsd? "gdb66" "gdb" ? ;
: run-gdb ( -- lines ) : run-gdb ( -- lines )
<process> <process>

View File

@ -49,7 +49,7 @@ TUPLE: deploy-gadget vocab settings ;
[ [
bundle-name bundle-name
deploy-ui deploy-ui
macosx? [ exit-when-windows-closed ] when os macosx? [ exit-when-windows-closed ] when
io-settings io-settings
reflection-settings reflection-settings
advanced-settings advanced-settings

View File

@ -3,7 +3,7 @@
USING: alien.syntax system sequences vocabs.loader ; USING: alien.syntax system sequences vocabs.loader ;
IN: unix.kqueue IN: unix.kqueue
<< "unix.kqueue." os append require >> << "unix.kqueue." os word-name append require >>
FUNCTION: int kqueue ( ) ; FUNCTION: int kqueue ( ) ;

View File

@ -60,11 +60,11 @@ FUNCTION: int mkdir ( char* path, mode_t mode ) ;
<< <<
os os
{ {
{ "linux" [ "unix.stat.linux" require ] } { linux [ "unix.stat.linux" require ] }
{ "macosx" [ "unix.stat.macosx" require ] } { macosx [ "unix.stat.macosx" require ] }
{ "freebsd" [ "unix.stat.freebsd" require ] } { freebsd [ "unix.stat.freebsd" require ] }
{ "netbsd" [ "unix.stat.netbsd" require ] } { netbsd [ "unix.stat.netbsd" require ] }
{ "openbsd" [ "unix.stat.openbsd" require ] } { openbsd [ "unix.stat.openbsd" require ] }
} }
case case
>> >>