[ string>u16-alien ] "ushort*" c-type set-c-type-prep
- win64? "longlong" "long" ? "ptrdiff_t" typedef
+ os winnt? cpu x86.64? and "longlong" "long" ? "ptrdiff_t" typedef
] with-compilation-unit
ARTICLE: "os" "System interface"
"Operating system detection:"
{ $subsection os }
-{ $subsection win32? }
-{ $subsection win64? }
"Processor detection:"
{ $subsection cpu }
"Reading environment variables:"
{ os-env os-envs set-os-envs } related-words
-HELP: win32?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on 32-bit Windows." } ;
-
-HELP: win64?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on 64-bit Windows." } ;
-
HELP: image
{ $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor image." } ;
: vm ( -- path ) 14 getenv ;
-: win32? ( -- ? )
- os winnt?
- cell 4 = and ; foldable
-
-: win64? ( -- ? )
- os winnt?
- cell 8 = and ; foldable
-
: embedded? ( -- ? ) 15 getenv ;
: os-envs ( -- assoc )
! - most of the matrix stuff
! - most of the query functions
-
USING: alien alien.syntax combinators system ;
-
IN: cairo.ffi
<< "cairo" {
- { [ os win32? ] [ "libcairo-2.dll" ] }
+ { [ os winnt? ] [ "libcairo-2.dll" ] }
! { [ os macosx? ] [ "libcairo.dylib" ] }
{ [ os macosx? ] [ "/opt/local/lib/libcairo.dylib" ] }
{ [ os unix? ] [ "libcairo.so.2" ] }
IN: db.mysql.ffi
<< "mysql" {
- { [ os win32? ] [ "libmySQL.dll" "stdcall" ] }
+ { [ os winnt? ] [ "libmySQL.dll" "stdcall" ] }
{ [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
{ [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
} cond add-library >>
IN: db.postgresql.ffi
<< "postgresql" {
- { [ os win32? ] [ "libpq.dll" ] }
+ { [ os winnt? ] [ "libpq.dll" ] }
{ [ os macosx? ] [ "/opt/local/lib/postgresql82/libpq.dylib" ] }
{ [ os unix? ] [ "libpq.so" ] }
} cond "cdecl" add-library >>
<<
"ogg" {
- { [ os win32? ] [ "ogg.dll" ] }
+ { [ os winnt? ] [ "ogg.dll" ] }
{ [ os macosx? ] [ "libogg.0.dylib" ] }
{ [ os unix? ] [ "libogg.so" ] }
} cond "cdecl" add-library
<<
"theora" {
- { [ os win32? ] [ "theora.dll" ] }
+ { [ os winnt? ] [ "theora.dll" ] }
{ [ os macosx? ] [ "libtheora.0.dylib" ] }
{ [ os unix? ] [ "libtheora.so" ] }
} cond "cdecl" add-library
<<
"vorbis" {
- { [ os win32? ] [ "vorbis.dll" ] }
+ { [ os winnt? ] [ "vorbis.dll" ] }
{ [ os macosx? ] [ "libvorbis.0.dylib" ] }
{ [ os unix? ] [ "libvorbis.so" ] }
} cond "cdecl" add-library
-USING: namespaces ;
+USING: namespaces system ;
IN: openal.backend
-SYMBOL: openal-backend
-HOOK: load-wav-file openal-backend ( filename -- format data size frequency )
-
-TUPLE: other-openal-backend ;
-T{ other-openal-backend } openal-backend set-global
+HOOK: load-wav-file os ( filename -- format data size frequency )
-! Copyright (C) 2007 Chris Double.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-!\r
-IN: openal.macosx\r
-USING: alien.c-types kernel alien alien.syntax shuffle\r
-combinators.lib openal.backend namespaces ;\r
-\r
-TUPLE: macosx-openal-backend ;\r
-LIBRARY: alut\r
-\r
-T{ macosx-openal-backend } openal-backend set-global\r
-\r
-FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;\r
-\r
-M: macosx-openal-backend load-wav-file ( path -- format data size frequency )\r
- 0 <int> f <void*> 0 <int> 0 <int>\r
- [ alutLoadWAVFile ] 4keep\r
- >r >r >r *int r> *void* r> *int r> *int ;\r
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types kernel alien alien.syntax shuffle
+combinators.lib openal.backend namespaces ;
+IN: openal.macosx
+
+LIBRARY: alut
+
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;
+
+M: macosx load-wav-file ( path -- format data size frequency )
+ 0 <int> f <void*> 0 <int> 0 <int>
+ [ alutLoadWAVFile ] 4keep
+ >r >r >r *int r> *void* r> *int r> *int ;
! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-!
-IN: openal
USING: kernel alien system combinators alien.syntax namespaces
alien.c-types sequences vocabs.loader shuffle combinators.lib
openal.backend ;
+IN: openal
<< "alut" {
- { [ os win32? ] [ "alut.dll" ] }
- { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+ { [ os windows? ] [ "alut.dll" ] }
+ { [ os macosx? ] [
+ "/System/Library/Frameworks/OpenAL.framework/OpenAL"
+ ] }
{ [ os unix? ] [ "libalut.so" ] }
} cond "cdecl" add-library >>
<< "openal" {
- { [ os win32? ] [ "OpenAL32.dll" ] }
- { [ os macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+ { [ os windows? ] [ "OpenAL32.dll" ] }
+ { [ os macosx? ] [
+ "/System/Library/Frameworks/OpenAL.framework/OpenAL"
+ ] }
{ [ os unix? ] [ "libopenal.so" ] }
} cond "cdecl" add-library >>
: source-playing? ( source -- bool )
AL_SOURCE_STATE get-source-param AL_PLAYING = ;
-
-! Copyright (C) 2007 Chris Double.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-!\r
-IN: openal.other\r
-USING: openal.backend alien.c-types kernel alien alien.syntax shuffle combinators.lib ;\r
-\r
-LIBRARY: alut\r
-\r
-FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ;\r
-\r
-M: other-openal-backend load-wav-file ( filename -- format data size frequency )\r
- 0 <int> f <void*> 0 <int> 0 <int>\r
- [ 0 <char> alutLoadWAVFile ] 4keep\r
- >r >r >r *int r> *void* r> *int r> *int ;\r
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: openal.backend alien.c-types kernel alien alien.syntax
+shuffle combinators.lib ;
+IN: openal.other
+
+LIBRARY: alut
+
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ;
+
+M: object load-wav-file ( filename -- format data size frequency )
+ 0 <int> f <void*> 0 <int> 0 <int>
+ [ 0 <char> alutLoadWAVFile ] 4keep
+ >r >r >r *int r> *void* r> *int r> *int ;
<<
"libcrypto" {
- { [ os win32? ] [ "libeay32.dll" "cdecl" ] }
+ { [ os winnt? ] [ "libeay32.dll" "cdecl" ] }
{ [ os macosx? ] [ "libcrypto.dylib" "cdecl" ] }
{ [ os unix? ] [ "libcrypto.so" "cdecl" ] }
} cond add-library
IN: openssl.libssl
<< "libssl" {
- { [ os win32? ] [ "ssleay32.dll" "cdecl" ] }
+ { [ os winnt? ] [ "ssleay32.dll" "cdecl" ] }
{ [ os macosx? ] [ "libssl.dylib" "cdecl" ] }
{ [ os unix? ] [ "libssl.so" "cdecl" ] }
} cond add-library >>
IN: oracle.liboci
"oci" {
- { [ os win32? ] [ "oci.dll" "stdcall" ] }
+ { [ os winnt? ] [ "oci.dll" "stdcall" ] }
{ [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
{ [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
} cond add-library