freebsd? linux? unix? words
parent
4e8da1f829
commit
d9150c3613
|
@ -96,6 +96,8 @@
|
|||
|
||||
+ i/o:
|
||||
|
||||
- merge unix and win32 io where appropriate
|
||||
- unix io: handle \n\r and \n\0
|
||||
- reader syntax for arrays, byte arrays, displaced aliens
|
||||
- separate words for writing characters and strings
|
||||
- perhaps:
|
||||
|
|
|
@ -5,14 +5,14 @@ lists namespaces parser sequences stdio unparser words ;
|
|||
|
||||
"Bootstrap stage 3..." print
|
||||
|
||||
os "unix" = [
|
||||
unix? [
|
||||
"libc" "libc.so" "cdecl" add-library
|
||||
"sdl" "libSDL.so" "cdecl" add-library
|
||||
"sdl-gfx" "libSDL_gfx.so" "cdecl" add-library
|
||||
"sdl-ttf" "libSDL_ttf.so" "cdecl" add-library
|
||||
] when
|
||||
|
||||
os "win32" = [
|
||||
win32? [
|
||||
"kernel32" "kernel32.dll" "stdcall" add-library
|
||||
"user32" "user32.dll" "stdcall" add-library
|
||||
"gdi32" "gdi32.dll" "stdcall" add-library
|
||||
|
@ -131,7 +131,14 @@ t [
|
|||
] pull-in
|
||||
|
||||
compile? [
|
||||
os "win32" = [
|
||||
unix? [
|
||||
"/library/unix/syscalls.factor"
|
||||
"/library/unix/io.factor"
|
||||
"/library/unix/sockets.factor"
|
||||
"/library/unix/files.factor"
|
||||
] pull-in
|
||||
|
||||
win32? [
|
||||
"/library/win32/win32-io.factor"
|
||||
"/library/win32/win32-errors.factor"
|
||||
"/library/win32/winsock.factor"
|
||||
|
@ -140,13 +147,6 @@ compile? [
|
|||
"/library/win32/win32-server.factor"
|
||||
"/library/bootstrap/win32-io.factor"
|
||||
] pull-in
|
||||
|
||||
os "unix" = [
|
||||
"/library/unix/syscalls.factor"
|
||||
"/library/unix/io.factor"
|
||||
"/library/unix/sockets.factor"
|
||||
"/library/unix/files.factor"
|
||||
] pull-in
|
||||
] when
|
||||
|
||||
compile? [
|
||||
|
|
|
@ -14,15 +14,6 @@ M: object = eq? ;
|
|||
|
||||
GENERIC: clone ( obj -- obj )
|
||||
M: object clone ;
|
||||
|
||||
: cpu ( -- arch )
|
||||
#! Returns one of "x86", "ppc", or "unknown".
|
||||
7 getenv ;
|
||||
|
||||
: os ( -- arch )
|
||||
#! Returns one of "unix" or "win32".
|
||||
11 getenv ;
|
||||
|
||||
: set-boot ( quot -- )
|
||||
#! Set the boot quotation.
|
||||
8 setenv ;
|
||||
|
@ -42,3 +33,10 @@ M: object clone ;
|
|||
: or ( a b -- a|b ) t swap ? ; inline
|
||||
: xor ( a b -- a^b ) dup not swap ? ; inline
|
||||
: implies ( a b -- a->b ) t ? ; inline
|
||||
|
||||
: cpu ( -- arch ) 7 getenv ;
|
||||
: os ( -- os ) 11 getenv ;
|
||||
: win32? ( -- ? ) os "win32" = ;
|
||||
: freebsd? ( -- ? ) os "freebsd" = ;
|
||||
: linux? ( -- ? ) os "linux" = ;
|
||||
: unix? ( -- ? ) freebsd? linux? or ;
|
||||
|
|
|
@ -22,6 +22,10 @@ void init_factor(char* image, CELL ds_size, CELL cs_size,
|
|||
|
||||
#ifdef WIN32
|
||||
userenv[OS_ENV] = tag_object(from_c_string("win32"));
|
||||
#elif defined(__FreeBSD__)
|
||||
userenv[OS_ENV] = tag_object(from_c_string("freebsd"));
|
||||
#elif defined(linux)
|
||||
userenv[OS_ENV] = tag_object(from_c_string("linux"));
|
||||
#else
|
||||
userenv[OS_ENV] = tag_object(from_c_string("unix"));
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue