From 709e35a392a9214888e448f419efc4f34e00fe28 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sat, 10 May 2008 05:40:00 -0500 Subject: [PATCH] Add the 'unix-system-call' macro --- extra/unix/system-call/system-call.factor | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 extra/unix/system-call/system-call.factor diff --git a/extra/unix/system-call/system-call.factor b/extra/unix/system-call/system-call.factor new file mode 100644 index 0000000000..5a77693ed7 --- /dev/null +++ b/extra/unix/system-call/system-call.factor @@ -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 + ] ;