[Ecls-list] Signaling a more specific condition on signals.

Pascal J. Bourguignon pjb at informatimago.com
Sun Aug 22 18:07:01 UTC 2010


Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> writes:

> On Fri, Aug 20, 2010 at 10:23 PM, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
>
>     When a unix signal is received, ecl cl:signals a simple-error with:
>    
>     unixint.d:370:                FEerror("Serious signal ~D caught.", 1, signal_code);
>    
>     In this it would be better if a specific condition was signaled
>     instead, so that applications could more easily handle the signal.
>
> It's in CVS now. Slight change of names. Please report if it works for you!
>
> (define-condition ext:unix-signal-received ()
>   ((code :type fixnum
>          :initform 0
>          :initarg :signal-code
>          :accessor ext:unix-signal-received-code))
>   (:report (lambda (condition stream)
>              (format stream "Serious signal ~D caught."
>                      (ext:unix-signal-received-code condition)))))
>
> Juanjo


Sorry, I proposed  :initarg :signal-code  but you use  :code, 

    [pjb at kuiper :0.0  |MDI| tools]$ ecl 
    ECL (Embeddable Common-Lisp) 10.7.1
    Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
    Copyright (C) 1993 Giuseppe Attardi
    Copyright (C) 2000 Juan J. Garcia-Ripoll
    ECL is free software, and you are welcome to redistribute it
    under certain conditions; see file 'Copyright' for details.
    Type :h for Help.  
    Top level in: #<process SI:TOP-LEVEL 0000000000643f60>.
    > (apropos "CATCH-SIG")
    SI:CATCH-SIGNAL  Function
    > (SI:CATCH-SIGNAL 13 t)

    T
    > (SI:GETPID)

    2348
    > 
    Unknown initialization option :CODE for class #<The STANDARD-CLASS SI:UNIX-SIGNAL-RECEIVED>

    Available restarts:

    1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

    Broken at SI:BYTECODES. [Evaluation of: (SI:TOP-LEVEL)] In: #<process SI:TOP-LEVEL 0000000000643f60>.
    >> 


so you will have to update the definition of the condition:

    (define-condition ext:unix-signal-received (error)
         ((code :type fixnum
             :initform 0
             :initarg :code
             :accessor ext:unix-signal-received-code))
         (:report (lambda (condition stream)
               (format stream "Serious signal ~D caught."
                   (ext:unix-signal-received-code condition)))))




-- 
__Pascal Bourguignon__                     http://www.informatimago.com/





More information about the ecl-devel mailing list