add USING:s and rearrange definitions so macosx can compile without parsing c-type strings

db4
Joe Groff 2009-09-26 23:14:57 -05:00
parent dce02fcdfb
commit 5054c954be
39 changed files with 115 additions and 90 deletions

View File

@ -60,6 +60,8 @@ GENERIC: c-type ( name -- type ) foldable
GENERIC: resolve-pointer-type ( name -- c-type ) GENERIC: resolve-pointer-type ( name -- c-type )
<< \ void \ void* "pointer-c-type" set-word-prop >>
M: word resolve-pointer-type M: word resolve-pointer-type
dup "pointer-c-type" word-prop dup "pointer-c-type" word-prop
[ ] [ drop void* ] ?if ; [ ] [ drop void* ] ?if ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2006, 2007 Slava Pestov ! Copyright (C) 2006, 2007 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax classes.struct ; USING: alien.c-types alien.syntax classes.struct ;
IN: cocoa.runtime IN: cocoa.runtime
TYPEDEF: void* SEL TYPEDEF: void* SEL

View File

@ -1,7 +1,7 @@
! Copyright (C) 2006, 2009 Slava Pestov ! Copyright (C) 2006, 2009 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax combinators kernel layouts USING: alien.c-types alien.syntax combinators kernel layouts
classes.struct core-graphics.types ; classes.struct cocoa.runtime core-graphics.types ;
IN: cocoa.types IN: cocoa.types
TYPEDEF: long NSInteger TYPEDEF: long NSInteger

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel sequences fry ; USING: alien.c-types alien.syntax core-foundation kernel
sequences fry ;
IN: core-foundation.arrays IN: core-foundation.arrays
TYPEDEF: void* CFArrayRef TYPEDEF: void* CFArrayRef

View File

@ -1,6 +1,8 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel destructors core-foundation USING: alien.c-types alien.syntax kernel destructors
core-foundation core-foundation.dictionaries
core-foundation.strings
core-foundation.utilities ; core-foundation.utilities ;
IN: core-foundation.attributed-strings IN: core-foundation.attributed-strings

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel sequences core-foundation USING: alien.c-types alien.syntax kernel sequences
core-foundation.urls ; core-foundation core-foundation.urls ;
IN: core-foundation.bundles IN: core-foundation.bundles
TYPEDEF: void* CFBundleRef TYPEDEF: void* CFBundleRef

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008 Joe Groff. ! Copyright (C) 2008 Joe Groff.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax kernel math sequences ; USING: alien.c-types alien.syntax core-foundation kernel math
sequences ;
IN: core-foundation.data IN: core-foundation.data
TYPEDEF: void* CFDataRef TYPEDEF: void* CFDataRef

View File

@ -1,6 +1,6 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax core-foundation kernel assocs USING: alien.c-types alien.syntax core-foundation kernel assocs
specialized-arrays math sequences accessors ; specialized-arrays math sequences accessors ;
IN: core-foundation.dictionaries IN: core-foundation.dictionaries

View File

@ -1,11 +1,12 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel math.bitwise core-foundation ; USING: alien.c-types alien.syntax kernel math.bitwise core-foundation ;
IN: core-foundation.file-descriptors IN: core-foundation.file-descriptors
TYPEDEF: void* CFFileDescriptorRef TYPEDEF: void* CFFileDescriptorRef
TYPEDEF: int CFFileDescriptorNativeDescriptor TYPEDEF: int CFFileDescriptorNativeDescriptor
TYPEDEF: void* CFFileDescriptorCallBack TYPEDEF: void* CFFileDescriptorCallBack
TYPEDEF: void* CFFileDescriptorContext*
FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate ( FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate (
CFAllocatorRef allocator, CFAllocatorRef allocator,

View File

@ -4,8 +4,8 @@ USING: alien alien.c-types alien.strings alien.syntax kernel
math sequences namespaces make assocs init accessors math sequences namespaces make assocs init accessors
continuations combinators io.encodings.utf8 destructors locals continuations combinators io.encodings.utf8 destructors locals
arrays specialized-arrays classes.struct core-foundation arrays specialized-arrays classes.struct core-foundation
core-foundation.run-loop core-foundation.strings core-foundation.arrays core-foundation.run-loop
core-foundation.time ; core-foundation.strings core-foundation.time unix.types ;
IN: core-foundation.fsevents IN: core-foundation.fsevents
SPECIALIZED-ARRAY: void* SPECIALIZED-ARRAY: void*

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008 Slava Pestov ! Copyright (C) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.syntax kernel math namespaces USING: accessors alien alien.c-types alien.syntax kernel math
sequences destructors combinators threads heaps deques calendar namespaces sequences destructors combinators threads heaps
core-foundation core-foundation.strings deques calendar core-foundation core-foundation.strings
core-foundation.file-descriptors core-foundation.timers core-foundation.file-descriptors core-foundation.timers
core-foundation.time ; core-foundation.time ;
IN: core-foundation.run-loop IN: core-foundation.run-loop

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax alien.strings io.encodings.string kernel USING: alien.c-types alien.syntax alien.strings io.encodings.string
sequences byte-arrays io.encodings.utf8 math core-foundation kernel sequences byte-arrays io.encodings.utf8 math core-foundation
core-foundation.arrays destructors parser fry alien words ; core-foundation.arrays destructors parser fry alien words ;
IN: core-foundation.strings IN: core-foundation.strings

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: calendar alien.syntax ; USING: calendar alien.c-types alien.syntax ;
IN: core-foundation.time IN: core-foundation.time
TYPEDEF: double CFTimeInterval TYPEDEF: double CFTimeInterval

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax system math kernel calendar core-foundation USING: alien.c-types alien.syntax system math kernel calendar
core-foundation.time ; core-foundation core-foundation.time ;
IN: core-foundation.timers IN: core-foundation.timers
TYPEDEF: void* CFRunLoopTimerRef TYPEDEF: void* CFRunLoopTimerRef

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel core-foundation.strings USING: alien.c-types alien.syntax kernel core-foundation.strings
core-foundation ; core-foundation core-foundation.urls ;
IN: core-foundation.urls IN: core-foundation.urls
CONSTANT: kCFURLPOSIXPathStyle 0 CONSTANT: kCFURLPOSIXPathStyle 0

View File

@ -2,7 +2,8 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.destructors alien.syntax accessors USING: alien alien.c-types alien.destructors alien.syntax accessors
destructors fry kernel math math.bitwise sequences libc colors destructors fry kernel math math.bitwise sequences libc colors
images images.memory core-graphics.types core-foundation.utilities ; images images.memory core-graphics.types core-foundation.utilities
opengl.gl ;
IN: core-graphics IN: core-graphics
! CGImageAlphaInfo ! CGImageAlphaInfo

View File

@ -1,10 +1,12 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.syntax classes.struct kernel layouts USING: accessors alien.c-types alien.syntax classes.struct kernel layouts
math math.rectangles arrays ; math math.rectangles arrays literals ;
FROM: alien.c-types => float ;
IN: core-graphics.types IN: core-graphics.types
<< cell 4 = "float" "double" ? "CGFloat" typedef >> SYMBOL: CGFloat
<< cell 4 = float double ? \ CGFloat typedef >>
: <CGFloat> ( x -- alien ) : <CGFloat> ( x -- alien )
cell 4 = [ <float> ] [ <double> ] if ; inline cell 4 = [ <float> ] [ <double> ] if ; inline

View File

@ -1,8 +1,9 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.syntax assocs core-foundation USING: accessors alien.c-types alien.syntax assocs core-foundation
core-foundation.strings core-text.utilities destructors init core-foundation.dictionaries core-foundation.strings
kernel math memoize fonts combinators ; core-graphics.types core-text.utilities destructors init
kernel math memoize fonts combinators unix.types ;
IN: core-text.fonts IN: core-text.fonts
TYPEDEF: void* CTFontRef TYPEDEF: void* CTFontRef

View File

@ -68,7 +68,6 @@ TYPEDEF: void* PQconninfoOption*
TYPEDEF: void* PGnotify* TYPEDEF: void* PGnotify*
TYPEDEF: void* PQArgBlock* TYPEDEF: void* PQArgBlock*
TYPEDEF: void* PQprintOpt* TYPEDEF: void* PQprintOpt*
TYPEDEF: void* FILE*
TYPEDEF: void* SSL* TYPEDEF: void* SSL*
LIBRARY: postgresql LIBRARY: postgresql

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax system environment.unix ; USING: alien.c-types alien.syntax system environment.unix ;
IN: environment.unix.macosx IN: environment.unix.macosx
FUNCTION: void* _NSGetEnviron ( ) ; FUNCTION: void* _NSGetEnviron ( ) ;

View File

@ -7,6 +7,7 @@ io.encodings.string io.encodings.utf8 io.files kernel math
math.bitwise math.order math.parser pack prettyprint sequences math.bitwise math.order math.parser pack prettyprint sequences
strings math.vectors specialized-arrays locals strings math.vectors specialized-arrays locals
images.loader ; images.loader ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: images.tiff IN: images.tiff

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: system kernel unix math sequences USING: alien.c-types system kernel unix math sequences
io.backend.unix io.ports specialized-arrays accessors ; io.backend.unix io.ports specialized-arrays accessors ;
QUALIFIED: io.pipes QUALIFIED: io.pipes
SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: int

View File

@ -3,9 +3,9 @@
! This file is based on the gl.h that comes with xorg-x11 6.8.2 ! This file is based on the gl.h that comes with xorg-x11 6.8.2
USING: alien alien.syntax combinators kernel parser sequences USING: alien alien.c-types alien.syntax combinators kernel parser
system words opengl.gl.extensions ; sequences system words opengl.gl.extensions ;
FROM: alien.c-types => short ;
IN: opengl.gl IN: opengl.gl
TYPEDEF: uint GLenum TYPEDEF: uint GLenum

View File

@ -5,6 +5,7 @@ kernel opengl opengl.gl opengl.capabilities combinators images
images.tesselation grouping sequences math math.vectors images.tesselation grouping sequences math math.vectors
math.matrices generalizations fry arrays namespaces system math.matrices generalizations fry arrays namespaces system
locals literals specialized-arrays ; locals literals specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: opengl.textures IN: opengl.textures

View File

@ -103,15 +103,15 @@ FUNCTION: void* BIO_f_buffer ( ) ;
CONSTANT: EVP_MAX_MD_SIZE 64 CONSTANT: EVP_MAX_MD_SIZE 64
TYPEDEF: void* EVP_MD*
TYPEDEF: void* ENGINE*
STRUCT: EVP_MD_CTX STRUCT: EVP_MD_CTX
{ digest EVP_MD* } { digest EVP_MD* }
{ engine ENGINE* } { engine ENGINE* }
{ flags ulong } { flags ulong }
{ md_data void* } ; { md_data void* } ;
TYPEDEF: void* EVP_MD*
TYPEDEF: void* ENGINE*
! Initialize ciphers and digest tables ! Initialize ciphers and digest tables
FUNCTION: void OpenSSL_add_all_ciphers ( ) ; FUNCTION: void OpenSSL_add_all_ciphers ( ) ;

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007 Elie CHAFTARI ! Copyright (C) 2007 Elie CHAFTARI
! Portions copyright (C) 2008 Slava Pestov ! Portions copyright (C) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax combinators kernel system namespaces USING: alien alien.c-types alien.syntax combinators kernel
assocs parser lexer sequences words quotations math.bitwise system namespaces assocs parser lexer sequences words
alien.libraries ; quotations math.bitwise alien.libraries ;
IN: openssl.libssl IN: openssl.libssl
@ -95,6 +95,17 @@ TYPEDEF: void* SSL*
LIBRARY: libssl LIBRARY: libssl
! ===============================================
! x509.h
! ===============================================
TYPEDEF: void* X509_NAME*
TYPEDEF: void* X509*
FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ;
FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
! =============================================== ! ===============================================
! ssl.h ! ssl.h
! =============================================== ! ===============================================
@ -258,17 +269,6 @@ CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE HEX: 0200
: SSL_SESS_CACHE_NO_INTERNAL ( -- n ) : SSL_SESS_CACHE_NO_INTERNAL ( -- n )
{ SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE } flags ; inline { SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE } flags ; inline
! ===============================================
! x509.h
! ===============================================
TYPEDEF: void* X509_NAME*
TYPEDEF: void* X509*
FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ;
FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
! =============================================== ! ===============================================
! x509_vfy.h ! x509_vfy.h
! =============================================== ! ===============================================

View File

@ -2,9 +2,9 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
! mersenne twister based on ! mersenne twister based on
! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c ! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
USING: kernel math namespaces sequences sequences.private system USING: alien.c-types kernel math namespaces sequences
init accessors math.ranges random math.bitwise combinators sequences.private system init accessors math.ranges random
specialized-arrays fry ; math.bitwise combinators specialized-arrays fry ;
SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint
IN: random.mersenne-twister IN: random.mersenne-twister

View File

@ -31,7 +31,7 @@ STRUCT: ud
{ inp_hook void* } { inp_hook void* }
{ inp_curr uchar } { inp_curr uchar }
{ inp_fill uchar } { inp_fill uchar }
{ inp_file FILE* } { inp_file void* }
{ inp_ctr uchar } { inp_ctr uchar }
{ inp_buff uchar* } { inp_buff uchar* }
{ inp_buff_end uchar* } { inp_buff_end uchar* }
@ -68,7 +68,7 @@ STRUCT: ud
{ c3 uchar } { c3 uchar }
{ inp_cache uchar[256] } { inp_cache uchar[256] }
{ inp_sess uchar[64] } { inp_sess uchar[64] }
{ itab_entry ud_itab_entry* } ; { itab_entry void* } ;
FUNCTION: void ud_translate_intel ( ud* u ) ; FUNCTION: void ud_translate_intel ( ud* u ) ;
FUNCTION: void ud_translate_att ( ud* u ) ; FUNCTION: void ud_translate_att ( ud* u ) ;

View File

@ -1,6 +1,6 @@
USING: accessors assocs classes destructors functors kernel USING: alien.c-types accessors assocs classes destructors
lexer math parser sequences specialized-arrays ui.backend functors kernel lexer math parser sequences specialized-arrays
words ; ui.backend words ;
SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: int
IN: ui.pixel-formats IN: ui.pixel-formats

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2006 Slava Pestov. ! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax classes.struct combinators system USING: alien.c-types alien.syntax classes.struct combinators
vocabs.loader ; system unix.types vocabs.loader ;
IN: unix IN: unix
CONSTANT: MAXPATHLEN 1024 CONSTANT: MAXPATHLEN 1024

View File

@ -1,9 +1,9 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax ; USING: alien.c-types alien.syntax unix.statfs.macosx ;
IN: unix.getfsstat.macosx IN: unix.getfsstat.macosx
CONSTANT: MNT_WAIT 1 ! synchronously wait for I/O to complete CONSTANT: MNT_WAIT 1 ! synchronously wait for I/O to complete
CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it
FUNCTION: int getfsstat64 ( statfs* buf, int bufsize, int flags ) ; FUNCTION: int getfsstat64 ( statfs64* buf, int bufsize, int flags ) ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax system sequences vocabs.loader words USING: alien.c-types alien.syntax system sequences vocabs.loader words
accessors ; accessors ;
IN: unix.kqueue IN: unix.kqueue

View File

@ -1,4 +1,4 @@
USING: alien.syntax classes.struct ; USING: alien.c-types alien.syntax classes.struct unix.time ;
IN: unix.kqueue IN: unix.kqueue
STRUCT: kevent STRUCT: kevent

View File

@ -1,6 +1,6 @@
USING: kernel alien.c-types alien.data alien.strings sequences USING: kernel alien.c-types alien.data alien.strings sequences
math alien.syntax unix namespaces continuations threads assocs math alien.syntax unix namespaces continuations threads assocs
io.backend.unix io.encodings.utf8 unix.utilities fry ; io.backend.unix io.encodings.utf8 unix.types unix.utilities fry ;
IN: unix.process IN: unix.process
! Low-level Unix process launching utilities. These are used ! Low-level Unix process launching utilities. These are used

View File

@ -1,8 +1,8 @@
USING: alien.c-types arrays accessors combinators classes.struct USING: alien.c-types arrays accessors combinators classes.struct
alien.syntax ; alien.syntax unix.time unix.types ;
IN: unix.stat IN: unix.stat
! Mac OS X ppc ! Mac OS X
! stat64 structure ! stat64 structure
STRUCT: stat STRUCT: stat

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax classes.struct ; USING: alien.c-types alien.syntax classes.struct unix.types ;
IN: unix.statvfs.macosx IN: unix.statvfs.macosx
STRUCT: statvfs STRUCT: statvfs

View File

@ -1,4 +1,4 @@
USING: kernel system alien.syntax combinators vocabs.loader ; USING: kernel system alien.c-types alien.syntax combinators vocabs.loader ;
IN: unix.types IN: unix.types
TYPEDEF: char int8_t TYPEDEF: char int8_t
@ -37,6 +37,12 @@ TYPEDEF: fsfilcnt_t __fsfilcnt_t
TYPEDEF: __uint64_t rlim_t TYPEDEF: __uint64_t rlim_t
TYPEDEF: uint32_t id_t TYPEDEF: uint32_t id_t
TYPEDEF: void* DIR*
TYPEDEF: void* FILE*
TYPEDEF: void* rlimit*
TYPEDEF: void* rusage*
TYPEDEF: void* sockaddr*
os { os {
{ linux [ "unix.types.linux" require ] } { linux [ "unix.types.linux" require ] }
{ macosx [ "unix.types.macosx" require ] } { macosx [ "unix.types.macosx" require ] }
@ -45,3 +51,4 @@ os {
{ netbsd [ "unix.types.netbsd" require ] } { netbsd [ "unix.types.netbsd" require ] }
{ winnt [ ] } { winnt [ ] }
} case } case

View File

@ -5,7 +5,7 @@ USING: alien alien.c-types alien.syntax kernel libc
sequences continuations byte-arrays strings math namespaces sequences continuations byte-arrays strings math namespaces
system combinators vocabs.loader accessors system combinators vocabs.loader accessors
stack-checker macros locals generalizations unix.types stack-checker macros locals generalizations unix.types
io vocabs classes.struct ; io vocabs classes.struct unix.time ;
IN: unix IN: unix
CONSTANT: PROT_NONE 0 CONSTANT: PROT_NONE 0
@ -35,12 +35,6 @@ CONSTANT: DT_LNK 10
CONSTANT: DT_SOCK 12 CONSTANT: DT_SOCK 12
CONSTANT: DT_WHT 14 CONSTANT: DT_WHT 14
STRUCT: group
{ gr_name char* }
{ gr_passwd char* }
{ gr_gid int }
{ gr_mem char** } ;
LIBRARY: libc LIBRARY: libc
FUNCTION: char* strerror ( int errno ) ; FUNCTION: char* strerror ( int errno ) ;
@ -68,6 +62,26 @@ MACRO:: unix-system-call ( quot -- )
] ]
] ; ] ;
<<
{
{ [ os linux? ] [ "unix.linux" require ] }
{ [ os bsd? ] [ "unix.bsd" require ] }
{ [ os solaris? ] [ "unix.solaris" require ] }
} cond
"debugger" vocab [
"unix.debugger" require
] when
>>
STRUCT: group
{ gr_name char* }
{ gr_passwd char* }
{ gr_gid int }
{ gr_mem char** } ;
FUNCTION: int accept ( int s, void* sockaddr, socklen_t* socklen ) ; FUNCTION: int accept ( int s, void* sockaddr, socklen_t* socklen ) ;
FUNCTION: int bind ( int s, void* name, socklen_t namelen ) ; FUNCTION: int bind ( int s, void* name, socklen_t namelen ) ;
FUNCTION: int chdir ( char* path ) ; FUNCTION: int chdir ( char* path ) ;
@ -86,7 +100,7 @@ FUNCTION: int dup2 ( int oldd, int newd ) ;
! FUNCTION: int dup ( int oldd ) ; ! FUNCTION: int dup ( int oldd ) ;
: _exit ( status -- * ) : _exit ( status -- * )
#! We throw to give this a terminating stack effect. #! We throw to give this a terminating stack effect.
"int" f "_exit" { "int" } alien-invoke "Exit failed" throw ; int f "_exit" { int } alien-invoke "Exit failed" throw ;
FUNCTION: void endpwent ( ) ; FUNCTION: void endpwent ( ) ;
FUNCTION: int fchdir ( int fd ) ; FUNCTION: int fchdir ( int fd ) ;
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ; FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
@ -207,12 +221,3 @@ FUNCTION: int utimes ( char* path, timeval[2] times ) ;
FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ; FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
{
{ [ os linux? ] [ "unix.linux" require ] }
{ [ os bsd? ] [ "unix.bsd" require ] }
{ [ os solaris? ] [ "unix.solaris" require ] }
} cond
"debugger" vocab [
"unix.debugger" require
] when

View File

@ -1,9 +1,10 @@
! Copyright (C) 2009 Phil Dawes. ! Copyright (C) 2009 Phil Dawes.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: classes.struct alien.syntax ; USING: classes.struct alien.c-types alien.syntax ;
IN: vm IN: vm
TYPEDEF: void* cell TYPEDEF: void* cell
TYPEDEF: void* context*
STRUCT: zone STRUCT: zone
{ start cell } { start cell }