unix: Convert a couple of words to the 'unix-system-call' macro

db4
Eduardo Cavazos 2008-05-10 05:41:00 -05:00
parent 709e35a392
commit 8e341475fe
1 changed files with 4 additions and 12 deletions

View File

@ -2,8 +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.syntax kernel libc structs USING: alien alien.c-types alien.syntax kernel libc structs
math namespaces system combinators vocabs.loader unix.ffi unix.types math namespaces system combinators vocabs.loader qualified
qualified ; unix.ffi unix.types unix.system-call ;
QUALIFIED: unix.ffi QUALIFIED: unix.ffi
@ -80,17 +80,9 @@ FUNCTION: uint ntohl ( uint n ) ;
FUNCTION: ushort ntohs ( ushort n ) ; FUNCTION: ushort ntohs ( ushort n ) ;
FUNCTION: char* strerror ( int errno ) ; FUNCTION: char* strerror ( int errno ) ;
ERROR: open-error path flags prot message ; : open ( path flags prot -- int ) [ unix.ffi:open ] unix-system-call ;
: open ( path flags prot -- int ) : utime ( path buf -- ) [ unix.ffi:utime ] unix-system-call drop ;
3dup unix.ffi:open
dup 0 >= [ >r 3drop r> ] [ drop err_no strerror open-error ] if ;
ERROR: utime-error path message ;
: utime ( path buf -- )
dupd unix.ffi:utime
0 = [ drop ] [ err_no strerror utime-error ] if ;
FUNCTION: int pclose ( void* file ) ; FUNCTION: int pclose ( void* file ) ;
FUNCTION: int pipe ( int* filedes ) ; FUNCTION: int pipe ( int* filedes ) ;