Hide posix internal words in a separate vocabulary.
This commit is contained in:
@ -60,7 +60,9 @@ variable tests-found variable tests-run variable tests-passed
|
|||||||
else
|
else
|
||||||
." FAILED: " red tests-run @ tests-passed @ - . normal cr
|
." FAILED: " red tests-run @ tests-passed @ - . normal cr
|
||||||
then hr ;
|
then hr ;
|
||||||
|
posix
|
||||||
: run-tests
|
: run-tests
|
||||||
reset-test-counters ['] count-test for-tests
|
reset-test-counters ['] count-test for-tests
|
||||||
['] run-test for-tests show-test-results
|
['] run-test for-tests show-test-results
|
||||||
tests-passed @ tests-found @ <> sysexit ;
|
tests-passed @ tests-found @ <> sysexit ;
|
||||||
|
forth
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
vocabulary posix posix definitions
|
||||||
|
|
||||||
( Shared Library Handling )
|
( Shared Library Handling )
|
||||||
1 constant RTLD_LAZY
|
1 constant RTLD_LAZY
|
||||||
2 constant RTLD_NOW
|
2 constant RTLD_NOW
|
||||||
@ -81,11 +83,29 @@ decimal
|
|||||||
( I/O Error Helpers )
|
( I/O Error Helpers )
|
||||||
: d0<ior ( n -- n ior ) dup 0< if errno else 0 then ;
|
: d0<ior ( n -- n ior ) dup 0< if errno else 0 then ;
|
||||||
|
|
||||||
|
( errno.h )
|
||||||
|
11 constant EAGAIN
|
||||||
|
|
||||||
|
( Signal Handling )
|
||||||
|
0 constant SIG_DFL
|
||||||
|
1 constant SIG_IGN
|
||||||
|
( Signals )
|
||||||
|
1 constant SIGHUP
|
||||||
|
2 constant SIGINT
|
||||||
|
9 constant SIGKILL
|
||||||
|
10 constant SIGPIPE
|
||||||
|
7 constant SIGBUS
|
||||||
|
|
||||||
|
( Modes )
|
||||||
|
octal 777 constant 0777 decimal
|
||||||
|
|
||||||
|
forth definitions posix
|
||||||
|
|
||||||
( Generic Files )
|
( Generic Files )
|
||||||
O_RDONLY constant r/o
|
O_RDONLY constant r/o
|
||||||
O_WRONLY constant w/o
|
O_WRONLY constant w/o
|
||||||
O_RDWR constant r/w
|
O_RDWR constant r/w
|
||||||
octal 777 constant 0777 decimal
|
|
||||||
: open-file ( a n fam -- fh ior ) >r s>z r> 0777 open sign-extend d0<ior ;
|
: open-file ( a n fam -- fh ior ) >r s>z r> 0777 open sign-extend d0<ior ;
|
||||||
: create-file ( a n fam -- fh ior )
|
: create-file ( a n fam -- fh ior )
|
||||||
>r s>z r> O_CREAT or 0777 open sign-extend d0<ior ;
|
>r s>z r> O_CREAT or 0777 open sign-extend d0<ior ;
|
||||||
@ -106,15 +126,4 @@ octal 777 constant 0777 decimal
|
|||||||
( Other Utils )
|
( Other Utils )
|
||||||
: ms ( n -- ) 1000 * usleep drop ;
|
: ms ( n -- ) 1000 * usleep drop ;
|
||||||
|
|
||||||
( errno.h )
|
forth
|
||||||
11 constant EAGAIN
|
|
||||||
|
|
||||||
( Signal Handling )
|
|
||||||
0 constant SIG_DFL
|
|
||||||
1 constant SIG_IGN
|
|
||||||
( Signals )
|
|
||||||
1 constant SIGHUP
|
|
||||||
2 constant SIGINT
|
|
||||||
9 constant SIGKILL
|
|
||||||
10 constant SIGPIPE
|
|
||||||
7 constant SIGBUS
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
( Words with OS assist )
|
( Words with OS assist )
|
||||||
|
posix
|
||||||
: allocate ( n -- a ior ) malloc dup 0= ;
|
: allocate ( n -- a ior ) malloc dup 0= ;
|
||||||
: free ( a -- ior ) sysfree drop 0 ;
|
: free ( a -- ior ) sysfree drop 0 ;
|
||||||
: resize ( a n -- a ior ) realloc dup 0= ;
|
: resize ( a n -- a ior ) realloc dup 0= ;
|
||||||
|
forth
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user