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 )
<< \ void \ void* "pointer-c-type" set-word-prop >>
M: word resolve-pointer-type
dup "pointer-c-type" word-prop
[ ] [ drop void* ] ?if ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2006, 2007 Slava Pestov
! 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
TYPEDEF: void* SEL

View File

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

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! 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
TYPEDEF: void* CFArrayRef

View File

@ -1,6 +1,8 @@
! Copyright (C) 2009 Slava Pestov.
! 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 ;
IN: core-foundation.attributed-strings
@ -16,4 +18,4 @@ FUNCTION: CFAttributedStringRef CFAttributedStringCreate (
[
[ >cf &CFRelease ] bi@
[ kCFAllocatorDefault ] 2dip CFAttributedStringCreate
] with-destructors ;
] with-destructors ;

View File

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

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008 Joe Groff.
! 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
TYPEDEF: void* CFDataRef
@ -16,4 +17,4 @@ FUNCTION: CFDataRef CFDataCreate ( CFAllocatorRef allocator, uchar* bytes, CFInd
FUNCTION: CFTypeID CFGetTypeID ( CFTypeRef cf ) ;
: <CFData> ( byte-array -- alien )
[ f ] dip dup length CFDataCreate ;
[ f ] dip dup length CFDataCreate ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2009 Slava Pestov.
! 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 ;
IN: core-foundation.dictionaries
@ -31,4 +31,4 @@ FUNCTION: void* CFDictionaryGetValue (
[ [ underlying>> ] bi@ ] [ nip length ] 2bi
&: kCFTypeDictionaryKeyCallBacks
&: kCFTypeDictionaryValueCallBacks
CFDictionaryCreate ;
CFDictionaryCreate ;

View File

@ -1,11 +1,12 @@
! Copyright (C) 2008 Slava Pestov.
! 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
TYPEDEF: void* CFFileDescriptorRef
TYPEDEF: int CFFileDescriptorNativeDescriptor
TYPEDEF: void* CFFileDescriptorCallBack
TYPEDEF: void* CFFileDescriptorContext*
FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate (
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
continuations combinators io.encodings.utf8 destructors locals
arrays specialized-arrays classes.struct core-foundation
core-foundation.run-loop core-foundation.strings
core-foundation.time ;
core-foundation.arrays core-foundation.run-loop
core-foundation.strings core-foundation.time unix.types ;
IN: core-foundation.fsevents
SPECIALIZED-ARRAY: void*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.destructors alien.syntax accessors
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
! CGImageAlphaInfo

View File

@ -1,10 +1,12 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
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
<< cell 4 = "float" "double" ? "CGFloat" typedef >>
SYMBOL: CGFloat
<< cell 4 = float double ? \ CGFloat typedef >>
: <CGFloat> ( x -- alien )
cell 4 = [ <float> ] [ <double> ] if ; inline

View File

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

View File

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

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman.
! 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
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
strings math.vectors specialized-arrays locals
images.loader ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
IN: images.tiff

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov.
! 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 ;
QUALIFIED: io.pipes
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
USING: alien alien.syntax combinators kernel parser sequences
system words opengl.gl.extensions ;
USING: alien alien.c-types alien.syntax combinators kernel parser
sequences system words opengl.gl.extensions ;
FROM: alien.c-types => short ;
IN: opengl.gl
TYPEDEF: uint GLenum

View File

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

View File

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

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007 Elie CHAFTARI
! Portions copyright (C) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax combinators kernel system namespaces
assocs parser lexer sequences words quotations math.bitwise
alien.libraries ;
USING: alien alien.c-types alien.syntax combinators kernel
system namespaces assocs parser lexer sequences words
quotations math.bitwise alien.libraries ;
IN: openssl.libssl
@ -95,6 +95,17 @@ TYPEDEF: void* SSL*
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
! ===============================================
@ -258,17 +269,6 @@ CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE HEX: 0200
: SSL_SESS_CACHE_NO_INTERNAL ( -- n )
{ 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
! ===============================================

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
! Copyright (C) 2008 Doug Coleman.
! 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
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
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.
! 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 ;
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
STRUCT: kevent

View File

@ -1,6 +1,6 @@
USING: kernel alien.c-types alien.data alien.strings sequences
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
! Low-level Unix process launching utilities. These are used

View File

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

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman.
! 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
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
TYPEDEF: char int8_t
@ -37,6 +37,12 @@ TYPEDEF: fsfilcnt_t __fsfilcnt_t
TYPEDEF: __uint64_t rlim_t
TYPEDEF: uint32_t id_t
TYPEDEF: void* DIR*
TYPEDEF: void* FILE*
TYPEDEF: void* rlimit*
TYPEDEF: void* rusage*
TYPEDEF: void* sockaddr*
os {
{ linux [ "unix.types.linux" require ] }
{ macosx [ "unix.types.macosx" require ] }
@ -45,3 +51,4 @@ os {
{ netbsd [ "unix.types.netbsd" require ] }
{ winnt [ ] }
} case

View File

@ -5,7 +5,7 @@ USING: alien alien.c-types alien.syntax kernel libc
sequences continuations byte-arrays strings math namespaces
system combinators vocabs.loader accessors
stack-checker macros locals generalizations unix.types
io vocabs classes.struct ;
io vocabs classes.struct unix.time ;
IN: unix
CONSTANT: PROT_NONE 0
@ -35,12 +35,6 @@ CONSTANT: DT_LNK 10
CONSTANT: DT_SOCK 12
CONSTANT: DT_WHT 14
STRUCT: group
{ gr_name char* }
{ gr_passwd char* }
{ gr_gid int }
{ gr_mem char** } ;
LIBRARY: libc
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 bind ( int s, void* name, socklen_t namelen ) ;
FUNCTION: int chdir ( char* path ) ;
@ -86,7 +100,7 @@ FUNCTION: int dup2 ( int oldd, int newd ) ;
! FUNCTION: int dup ( int oldd ) ;
: _exit ( status -- * )
#! 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: int fchdir ( int fd ) ;
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 ) ;
{
{ [ 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.
! See http://factorcode.org/license.txt for BSD license.
USING: classes.struct alien.syntax ;
USING: classes.struct alien.c-types alien.syntax ;
IN: vm
TYPEDEF: void* cell
TYPEDEF: void* context*
STRUCT: zone
{ start cell }