1987-05-13 14:36:45 +00:00
|
|
|
#include <em_abs.h>
|
|
|
|
|
|
|
|
static struct errm {
|
|
|
|
int errno;
|
|
|
|
char *errmes;
|
|
|
|
} errors[] = {
|
|
|
|
{ EARRAY, "array bound error"},
|
|
|
|
{ ERANGE, "range bound error"},
|
|
|
|
{ ESET, "set bound error"},
|
|
|
|
{ EIOVFL, "integer overflow"},
|
|
|
|
{ EFOVFL, "floating overflow"},
|
|
|
|
{ EFUNFL, "floating underflow"},
|
|
|
|
{ EIDIVZ, "divide by 0"},
|
|
|
|
{ EFDIVZ, "divide by 0.0"},
|
|
|
|
{ EIUND, "undefined integer"},
|
|
|
|
{ EFUND, "undefined float"},
|
|
|
|
{ ECONV, "conversion error"},
|
|
|
|
|
|
|
|
{ ESTACK, "stack overflow"},
|
|
|
|
{ EHEAP, "heap overflow"},
|
|
|
|
{ EILLINS, "illegal instruction"},
|
|
|
|
{ EODDZ, "illegal size argument"},
|
|
|
|
{ ECASE, "case error"},
|
|
|
|
{ EMEMFLT, "addressing non existent memory"},
|
|
|
|
{ EBADPTR, "bad pointer used"},
|
|
|
|
{ EBADPC, "program counter out of range"},
|
|
|
|
{ EBADLAE, "bad argument of lae"},
|
|
|
|
{ EBADMON, "bad monitor call"},
|
|
|
|
{ EBADLIN, "argument if LIN too high"},
|
|
|
|
{ EBADGTO, "GTO descriptor error"},
|
1987-06-23 17:12:42 +00:00
|
|
|
|
1987-05-13 14:36:45 +00:00
|
|
|
{ 64, "stack size of process too large"},
|
1987-06-23 17:12:42 +00:00
|
|
|
{ 65, "too many nested traps + handlers"},
|
1987-05-13 14:36:45 +00:00
|
|
|
{ -1, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern exit();
|
|
|
|
|
|
|
|
_catch(trapno)
|
|
|
|
int trapno;
|
|
|
|
{
|
|
|
|
register struct errm *ep = &errors[0];
|
|
|
|
char *errmessage;
|
1987-06-26 15:59:52 +00:00
|
|
|
char buf[20];
|
|
|
|
register char *p, *s;
|
1987-05-13 14:36:45 +00:00
|
|
|
char *q;
|
|
|
|
|
|
|
|
while (ep->errno != trapno && ep->errmes != 0) ep++;
|
1987-06-26 15:59:52 +00:00
|
|
|
if (p = ep->errmes) {
|
|
|
|
while (*p) p++;
|
|
|
|
Traps_Message(ep->errmes, 0, (int) (p - ep->errmes), 1);
|
|
|
|
}
|
1987-05-13 14:36:45 +00:00
|
|
|
else {
|
1987-06-26 15:59:52 +00:00
|
|
|
int i = trapno;
|
|
|
|
|
|
|
|
q = "error number xxxxxxxxxxxxx";
|
|
|
|
p = &q[13];
|
|
|
|
s = buf;
|
1987-05-13 14:36:45 +00:00
|
|
|
if (i < 0) {
|
|
|
|
i = -i;
|
1987-06-26 15:59:52 +00:00
|
|
|
*p++ = '-';
|
1987-05-13 14:36:45 +00:00
|
|
|
}
|
|
|
|
do
|
1987-06-26 15:59:52 +00:00
|
|
|
*s++ = i % 10 + '0';
|
1987-05-13 14:36:45 +00:00
|
|
|
while (i /= 10);
|
1987-06-26 15:59:52 +00:00
|
|
|
*s = 0;
|
|
|
|
s = buf;
|
|
|
|
while (*p++ = *s++) /* nothing */;
|
|
|
|
Traps_Message(q, 0, (int) (p - q), 1);
|
1987-05-13 14:36:45 +00:00
|
|
|
}
|
|
|
|
exit(trapno);
|
|
|
|
}
|