Changed the representation of scsh-conditions to the exception

os-error so it may be throwen from C.
This commit is contained in:
marting 2000-07-17 13:15:45 +00:00
parent 27bafee1bc
commit 8ce0551795
1 changed files with 13 additions and 6 deletions

View File

@ -9,19 +9,26 @@
(define (errno-error errno syscall . stuff) (define (errno-error errno syscall . stuff)
(let ((msg (errno-msg errno))) (let ((msg (errno-msg errno)))
(apply signal 'syscall-error errno msg syscall stuff))) (apply (structure-ref exceptions signal-exception)
(enum op call-external-value) (enum exception os-error)
syscall errno msg stuff)))
(define (with-errno-handler* handler thunk) (define (with-errno-handler* handler thunk)
(with-handler (with-handler
(lambda (condition more) (lambda (condition more)
(if (syscall-error? condition) (if (and (exception? condition) (eq? (exception-reason condition)
(let ((stuff (condition-stuff condition))) 'os-error))
(handler (car stuff) ; errno (let ((stuff (exception-arguments condition)))
(cdr stuff)))) ; (msg syscall . packet) (handler (cadr stuff) ; errno
(list (caddr stuff) ;msg
(car stuff) ;syscall
(cdddr stuff) ;packet
)))) ; (msg syscall . packet)
(more)) (more))
thunk)) thunk))
;;; (with-errno-handler ;;; (with-errno-handler
;;; ((errno data) ; These are vars bound in this scope. ;;; ((errno data) ; These are vars bound in this scope.
;;; ((errno/exist) . body1) ;;; ((errno/exist) . body1)