Add the 'unix-system-call' macro

db4
Eduardo Cavazos 2008-05-10 05:40:00 -05:00
parent a5aab5919e
commit 709e35a392
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
USING: kernel continuations sequences math accessors inference macros
fry arrays.lib unix ;
IN: unix.system-call
ERROR: unix-system-call-error word args message ;
MACRO: unix-system-call ( quot -- )
[ ] [ infer in>> ] [ first ] tri
'[
[ @ dup 0 < [ dup throw ] [ ] if ]
[ drop , narray , swap err_no strerror unix-system-call-error ]
recover
] ;