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>
<body>
<h1>Factor 0.81:</h1>
<ul>
<li>Solaris/x86 is now supported (Patrick Mauritz)</li>
</ul>
<h1>Factor 0.80:</h1>
<ul>

View File

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

View File

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

View File

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

View File

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

View File

@ -135,7 +135,3 @@ M: object <=>
: with-datastack ( stack word -- stack )
datastack >r >r set-datastack r> execute
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" } }
{ $description
"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 -- )"

View File

@ -1,18 +1,7 @@
USING: io kernel parser sequences ;
"/library/unix/types.factor" 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-" os ".factor" append3 run-resource
[
"/library/unix/syscalls.factor"

View File

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

View File

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

View File

@ -35,3 +35,7 @@ END-STRUCT
: EINTR HEX: 4 ;
: EAGAIN HEX: 23 ;
: 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 )
"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 setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ;
FUNCTION: int connect ( int s, sockaddr-in* name, socklen_t namelen ) ;

View File

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