1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)EXCEPT.c 1.2 02/08/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 return; 18 #else 19 /* 20 * The values for this switch statement come from page 12-5 of 21 * Volume 1 of the 1978 VAX 11/780 Architecture Handbook 22 */ 23 switch (type) { 24 case 1: 25 ERROR("Integer overflow\n"); 26 return; 27 case 2: 28 ERROR("Integer division by zero\n"); 29 return; 30 case 3: 31 ERROR("Real overflow\n"); 32 return; 33 case 4: 34 ERROR("Real division by zero\n"); 35 return; 36 case 5: 37 ERROR("Real underflow\n"); 38 return; 39 default: 40 ERROR("Panic: Computational error in interpreter\n"); 41 return; 42 } 43 #endif 44 } 45