- (:constructor make-unix-signal (%name %number %description)))
- %name ; signal keyword
- (%number nil :type integer) ; UNIX signal number
- (%description nil :type string)) ; documentation
-
-(defvar *unix-signals* nil
- #!+sb-doc
- "A list of Unix signal structures.")
-
-(defmacro def-unix-signal (name number description)
- (let ((symbol (intern (symbol-name name))))
- `(progn
- ;; KLUDGE: This PUSH should be probably be something like PUSHNEW if we
- ;; want to be able to cleanly reload this file. (Or perhaps
- ;; *UNIX-SIGNALS* should be a hash table keyed by signal name, or a
- ;; vector keyed by signal number?)
- (push (make-unix-signal ,name ,number ,description) *unix-signals*)
- ;; This is to make the new signal lookup stuff compatible with
- ;; old code which expects the symbol with the same print name as
- ;; our keywords to be a constant with a value equal to the signal
- ;; number.
- (defconstant ,symbol ,number ,description)
- (let ((sb!int::*rogue-export* "DEF-MATH-RTN"))
- (export ',symbol)))))
-
-(defun unix-signal-or-lose (arg)
- (let ((signal (find arg *unix-signals*
- :key (etypecase arg
- (symbol #'unix-signal-%name)
- (number #'unix-signal-%number)))))
- (unless signal
- (error "~S is not a valid signal name or number." arg))
- signal))
-
-(defun unix-signal-name (signal)
- #!+sb-doc
- "Return the name of the signal as a string. Signal should be a valid
- signal number or a keyword of the standard UNIX signal name."
- (symbol-name (unix-signal-%name (unix-signal-or-lose signal))))
-
-(defun unix-signal-description (signal)
- #!+sb-doc
- "Return a string describing signal. Signal should be a valid signal
- number or a keyword of the standard UNIX signal name."
- (unix-signal-%description (unix-signal-or-lose signal)))
-
-(defun unix-signal-number (signal)
- #!+sb-doc
- "Return the number of the given signal. Signal should be a valid
- signal number or a keyword of the standard UNIX signal name."
- (unix-signal-%number (unix-signal-or-lose signal)))
-
-;;; Known signals
-(def-unix-signal :CHECK 0 "Check")
-
-(def-unix-signal :SIGHUP 1 "Hangup")
-(def-unix-signal :SIGINT 2 "Interrupt")
-(def-unix-signal :SIGQUIT 3 "Quit")
-(def-unix-signal :SIGILL 4 "Illegal instruction")
-(def-unix-signal :SIGTRAP 5 "Trace trap")
-(def-unix-signal :SIGIOT 6 "Iot instruction")
+ (:constructor make-unix-signal (%name %number))
+ (:copier nil))
+ ;; signal keyword (e.g. :SIGINT for the Unix SIGINT signal)
+ (%name (missing-arg) :type keyword :read-only t)
+ ;; signal number
+ (%number (missing-arg) :type integer :read-only t))
+
+;;; list of all defined UNIX-SIGNALs
+(defvar *unix-signals* nil)
+
+(defmacro !def-unix-signal (name number)
+ (declare (type keyword name))
+ (declare (type (and fixnum unsigned-byte) number))
+ `(push (make-unix-signal ,name ,number) *unix-signals*))
+
+(/show0 "signal.lisp 131")
+
+(defun unix-signal-or-lose (designator)
+ (or (find designator (the list *unix-signals*)
+ :key (etypecase designator
+ (symbol #'unix-signal-%name)
+ (number #'unix-signal-%number)))
+ (error "not a valid signal name or number: ~S" designator)))
+
+(/show0 "signal.lisp 142")
+
+;;; Return the name of the designated signal.
+(defun unix-signal-name (designator)
+ (symbol-name (unix-signal-%name (unix-signal-or-lose designator))))
+
+(/show0 "signal.lisp 150")
+
+;;; Return the number of the designated signal.
+(defun unix-signal-number (designator)
+ (unix-signal-%number (unix-signal-or-lose designator)))
+
+(/show0 "signal.lisp 168")
+
+;;; known signals
+(/show0 "defining Unix signals")
+(!def-unix-signal :CHECK 0) ; check
+(/show0 "done defining CHECK")
+(!def-unix-signal :SIGHUP 1) ; hangup
+(/show0 "done defining SIGHUP")
+(!def-unix-signal :SIGINT 2) ; interrupt
+(/show0 "done defining SIGINT")
+(!def-unix-signal :SIGQUIT 3) ; quit
+(!def-unix-signal :SIGILL 4) ; illegal instruction
+(!def-unix-signal :SIGTRAP 5) ; trace trap
+(!def-unix-signal :SIGIOT 6) ; IOT instruction