]> gitweb.factorcode.org Git - factor.git/commitdiff
Show the signal name next to the number in parentheses on Unices.
authorElliott Hird <penguinofthegods@gmail.com>
Mon, 20 Apr 2009 00:28:41 +0000 (01:28 +0100)
committerElliott Hird <penguinofthegods@gmail.com>
Mon, 20 Apr 2009 00:28:41 +0000 (01:28 +0100)
basis/debugger/debugger.factor

index 49ec534e8fa59c9bc0f27219235a8e9934394628..64bac3ecee69b3664d0ab136f7cddb6b87cefe41 100644 (file)
@@ -88,8 +88,27 @@ M: string error. print ;
 : divide-by-zero-error. ( obj -- )
     "Division by zero" print drop ;
 
+CONSTANT: signal-names
+{
+    "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT"
+    "SIGEMT" "SIGFPE" "SIGKILL" "SIGBUS" "SIGSEGV" "SIGSYS"
+    "SIGPIPE" "SIGALRM" "SIGTERM" "SIGURG" "SIGSTOP" "SIGTSIP"
+    "SIGCONT" "SIGCHLD" "SIGTTIN" "SIGTTOU" "SIGIO" "SIGXCPU"
+    "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH" "SIGINFO"
+    "SIGUSR1" "SIGUSR2"
+}
+
+: signal-name ( n -- str )
+    1- signal-names nth;
+
+: signal-name. ( n -- )
+    dup signal-names length <=
+    os unix? and
+    [ " (" write signal-name write ")" write ] [ drop ] if ;
+
 : signal-error. ( obj -- )
-    "Operating system signal " write third . ;
+    "Operating system signal " write
+    third [ pprint ] [ signal-name. ] bi nl ;
 
 : array-size-error. ( obj -- )
     "Invalid array size: " write dup third .