1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)EXCEPT.c 1.1 02/02/82"; 4 5 #include <signal.h> 6 #include "whoami.h" 7 8 /* 9 * catch runtime arithmetic errors 10 */ 11 EXCEPT(signum, type) 12 int signum, type; 13 { 14 signal(SIGFPE, EXCEPT); 15 #ifndef VAX 16 ERROR("Overflow, underflow, or division by zero in arithmetic operation\n"); 17 #else 18 switch (type) { 19 case 1: 20 ERROR("Integer overflow\n"); 21 case 2: 22 ERROR("Integer division by zero\n"); 23 case 3: 24 ERROR("Real overflow\n"); 25 case 4: 26 ERROR("Real division by zero\n"); 27 case 5: 28 ERROR("Real underflow\n"); 29 default: 30 ERROR("Panic: Computational error in interpreter\n"); 31 } 32 #endif 33 } 34