Changed the representation of scsh-conditions to the exception
os-error so it may be throwen from C.
This commit is contained in:
parent
27bafee1bc
commit
8ce0551795
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue