Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-05-08 16:01:03 -05:00
commit e0adccbddb
3 changed files with 22 additions and 4 deletions

View File

@ -277,7 +277,7 @@ HELP: append-path
HELP: prepend-path
{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
{ $description "Concatenates two pathnames." } ;
{ $description "Appends str1 onto str2 to form a pathname." } ;
{ append-path prepend-path } related-words

View File

@ -0,0 +1,6 @@
USING: alien.syntax ;
IN: unix.ffi
FUNCTION: int open ( char* path, int flags, int prot ) ;

View File

@ -2,7 +2,10 @@
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.syntax kernel libc structs
math namespaces system combinators vocabs.loader unix.types ;
math namespaces system combinators vocabs.loader unix.ffi unix.types
qualified ;
QUALIFIED: unix.ffi
IN: unix
@ -75,7 +78,17 @@ FUNCTION: void* mmap ( void* addr, size_t len, int prot, int flags, int fd, off_
FUNCTION: int munmap ( void* addr, size_t len ) ;
FUNCTION: uint ntohl ( uint n ) ;
FUNCTION: ushort ntohs ( ushort n ) ;
FUNCTION: int open ( char* path, int flags, int prot ) ;
FUNCTION: char* strerror ( int errno ) ;
TUPLE: open-error path flags prot message ;
: open ( path flags prot -- int )
[ ] [ unix.ffi:open ] 3bi
dup 0 >=
[ nip nip nip ]
[ drop err_no strerror open-error boa throw ]
if ;
FUNCTION: int pclose ( void* file ) ;
FUNCTION: int pipe ( int* filedes ) ;
FUNCTION: void* popen ( char* command, char* type ) ;
@ -96,7 +109,6 @@ FUNCTION: int setreuid ( uid_t ruid, uid_t euid ) ;
FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ;
FUNCTION: int setuid ( uid_t uid ) ;
FUNCTION: int socket ( int domain, int type, int protocol ) ;
FUNCTION: char* strerror ( int errno ) ;
FUNCTION: int symlink ( char* path1, char* path2 ) ;
FUNCTION: int system ( char* command ) ;
FUNCTION: int unlink ( char* path ) ;