Solaris/x86 support

cvs
Slava Pestov 2006-01-31 19:31:31 +00:00
parent 85042a83bf
commit 2acb28ae0c
14 changed files with 72 additions and 29 deletions

View File

@ -4,6 +4,14 @@
<head><title>Factor change log</title></head> <head><title>Factor change log</title></head>
<body> <body>
<h1>Factor 0.81:</h1>
<ul>
<li>Solaris/x86 is now supported (Patrick Mauritz)</li>
</ul>
<h1>Factor 0.80:</h1> <h1>Factor 0.80:</h1>
<ul> <ul>

View File

@ -61,6 +61,7 @@ default:
@echo "linux-ppc" @echo "linux-ppc"
@echo "macosx" @echo "macosx"
@echo "macosx-sdl -- if you wish to use the Factor GUI on Mac OS X" @echo "macosx-sdl -- if you wish to use the Factor GUI on Mac OS X"
@echo "solaris"
@echo "windows" @echo "windows"
@echo "" @echo ""
@echo "Also, you might want to set the SITE_CFLAGS environment" @echo "Also, you might want to set the SITE_CFLAGS environment"

View File

@ -368,7 +368,7 @@ SYMBOL: first-arg
! Boolean logic tests ! Boolean logic tests
: logic-0 ( -- seq ) : logic-0 ( -- seq )
{ unix? win32? bootstrapping? f t } ; { bootstrapping? f t } ;
: logic-1 ( -- seq ) : logic-1 ( -- seq )
{ {

View File

@ -33,8 +33,8 @@ M: alien = ( obj obj -- ? )
] bind ; ] bind ;
: add-simple-library ( name file -- ) : add-simple-library ( name file -- )
win32? ".dll" ".so" ? append os "win32" = ".dll" ".so" ? append
win32? "stdcall" "cdecl" ? add-library ; os "win32" = "stdcall" "cdecl" ? add-library ;
: library-abi ( library -- abi ) : library-abi ( library -- abi )
library "abi" swap ?hash [ "cdecl" ] unless* ; library "abi" swap ?hash [ "cdecl" ] unless* ;

View File

@ -1,12 +1,12 @@
! Copyright (C) 2004, 2005 Slava Pestov. ! Copyright (C) 2004, 2006 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: compiler compiler-backend io io-internals kernel USING: compiler compiler-backend io io-internals kernel
kernel-internals lists math memory namespaces optimizer parser kernel-internals lists math memory namespaces optimizer parser
sequences sequences-internals words ; sequences sequences-internals words ;
"compile" get [ "compile" get [
"native-io" get [ "native-io" get [
unix? [ os { "freebsd" "linux" "macosx" "solaris" } member? [
"/library/unix/load.factor" run-resource "/library/unix/load.factor" run-resource
] when ] when

View File

@ -135,7 +135,3 @@ M: object <=>
: with-datastack ( stack word -- stack ) : with-datastack ( stack word -- stack )
datastack >r >r set-datastack r> execute datastack >r >r set-datastack r> execute
datastack r> [ push ] keep set-datastack 2nip ; datastack r> [ push ] keep set-datastack 2nip ;
: win32? ( -- ? ) os "win32" = ;
: unix? ( -- ? ) os { "freebsd" "linux" "macosx" } member? ;

View File

@ -141,7 +141,7 @@ HELP: os "( -- os )"
{ $values { "os" "a string" } } { $values { "os" "a string" } }
{ $description { $description
"Outputs a string descriptor of the current operating system family. Currently, this set of descriptors is:" "Outputs a string descriptor of the current operating system family. Currently, this set of descriptors is:"
{ $code "freebsd" "linux" "macosx" "win32" "unix" } { $code "freebsd" "linux" "macosx" "solaris" "win32" "unix" }
} ; } ;
HELP: call "( quot -- )" HELP: call "( quot -- )"

View File

@ -1,18 +1,7 @@
USING: io kernel parser sequences ; USING: io kernel parser sequences ;
"/library/unix/types.factor" run-resource "/library/unix/types.factor" run-resource
"/library/unix/syscalls-" os ".factor" append3 run-resource
os "freebsd" = [
"/library/unix/syscalls-freebsd.factor" run-resource
] when
os "linux" = [
"/library/unix/syscalls-linux.factor" run-resource
] when
os "macosx" = [
"/library/unix/syscalls-macosx.factor" run-resource
] when
[ [
"/library/unix/syscalls.factor" "/library/unix/syscalls.factor"

View File

@ -1,5 +1,5 @@
! Copyright (C) 2005 Slava Pestov. ! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
IN: unix-internals IN: unix-internals
USING: alien ; USING: alien ;
@ -35,3 +35,7 @@ END-STRUCT
: EINTR HEX: 4 ; : EINTR HEX: 4 ;
: EAGAIN HEX: 23 ; : EAGAIN HEX: 23 ;
: EINPROGRESS HEX: 24 ; : EINPROGRESS HEX: 24 ;
: AF_INET 2 ;
: PF_INET AF_INET ;
: SOCK_STREAM 1 ;

View File

@ -35,3 +35,7 @@ END-STRUCT
: EINTR HEX: 4 ; : EINTR HEX: 4 ;
: EAGAIN HEX: b ; : EAGAIN HEX: b ;
: EINPROGRESS HEX: 73 ; : EINPROGRESS HEX: 73 ;
: AF_INET 2 ;
: PF_INET AF_INET ;
: SOCK_STREAM 1 ;

View File

@ -35,3 +35,7 @@ END-STRUCT
: EINTR HEX: 4 ; : EINTR HEX: 4 ;
: EAGAIN HEX: 23 ; : EAGAIN HEX: 23 ;
: EINPROGRESS HEX: 24 ; : EINPROGRESS HEX: 24 ;
: AF_INET 2 ;
: PF_INET AF_INET ;
: SOCK_STREAM 1 ;

View File

@ -0,0 +1,39 @@
! Copyright (C) 2006 Patrick Mauritz.
! See http://factorcode.org/license.txt for BSD license.
IN: unix-internals
USING: alien kernel kernel-internals ;
! Solaris.
: SOCK_STREAM 2 ;
: O_RDONLY HEX: 0000 ;
: O_WRONLY HEX: 0001 ;
: O_RDWR HEX: 0002 ;
: O_CREAT HEX: 0100 ;
: O_TRUNC HEX: 0200 ;
: SOL_SOCKET HEX: ffff ;
: FD_SETSIZE cell 4 = 1024 65536 ? ;
: SO_REUSEADDR 4 ;
: SO_OOBINLINE HEX: 0100 ;
: SO_SNDTIMEO HEX: 1005 ;
: SO_RCVTIMEO HEX: 1006 ;
: INADDR_ANY 0 ;
: F_SETFL 4 ; ! set file status flags
: O_NONBLOCK HEX: 80 ; ! no delay
BEGIN-STRUCT: sockaddr-in
FIELD: ushort family
FIELD: ushort port
FIELD: in_addr_t addr
FIELD: longlong unused
END-STRUCT
: EINTR HEX: 4 ;
: EAGAIN 11 ;
: EINPROGRESS 150 ;

View File

@ -46,10 +46,6 @@ END-STRUCT
: gethostbyname ( name -- hostent ) : gethostbyname ( name -- hostent )
"hostent*" "libc" "gethostbyname" [ "char*" ] alien-invoke ; "hostent*" "libc" "gethostbyname" [ "char*" ] alien-invoke ;
: AF_INET 2 ;
: PF_INET AF_INET ;
: SOCK_STREAM 1 ;
FUNCTION: int socket ( int domain, int type, int protocol ) ; FUNCTION: int socket ( int domain, int type, int protocol ) ;
FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ; FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ;
FUNCTION: int connect ( int s, sockaddr-in* name, socklen_t namelen ) ; FUNCTION: int connect ( int s, sockaddr-in* name, socklen_t namelen ) ;

View File

@ -31,6 +31,8 @@
#define FACTOR_OS_STRING "linux" #define FACTOR_OS_STRING "linux"
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define FACTOR_OS_STRING "macosx" #define FACTOR_OS_STRING "macosx"
#elif defined(__sun)
#define FACTOR_OS_STRING "solaris"
#else #else
#define FACTOR_OS_STRING "unix" #define FACTOR_OS_STRING "unix"
#endif #endif