static void
throw_msg (int id, char *msg)
{
static const char *throw_explanation[] =
{
NULL,
NULL,
"stack overflow",
"stack underflow",
"return-stack overflow",
"return-stack underflow",
"do-loops nested too deeply during execution",
"dictionary overflow",
"invalid memory address",
"division by zero",
"result out of range",
"argument type mismatch",
"undefined word",
"interpreting a compile-only word",
"invalid FORGET (not between FENCE and HERE)",
"attempt to use a zero-length string as a name",
"pictured numeric output string overflow",
"parsed string overflow (input token longer than 255)",
"definition name too long",
"write to a read-only location",
"unsupported operation",
"control structure mismatch",
"address alignment exception",
"invalid numeric argument",
"return stack imbalance",
"loop parameters unavailable",
"invalid recursion",
"user interrupt",
"compiler nesting (exec/comp state incorrect)",
"obsolescent feature",
">BODY used on non-CREATEDd definition",
"invalid name argument",
"block read exception",
"block write exception",
"invalid block number",
"invalid file position",
"file I/O exception",
"non-existent file",
"unexpected end of file",
"invalid BASE for floating-point conversion",
"loss of precision",
"floating-point divide by zero",
"floating-point result out of range",
"floating-point stack overflow",
"floating-point stack underflow",
"floating-point invalid argument",
"CURRENT deleted (forget on DEFINITIONS vocabulary)",
"invalid POSTPONE",
"search-order overflow (ALSO failed)",
"search-order underflow (PREVIOUS failed)",
"compilation word list changed",
"control flow stack overflow",
"exception stack overflow",
"floating-point underflow",
"floating-point unidentified fault",
NULL,
"error in sending or receiving a character",
"[IF], [ELSE] or [THEN] error",
"dictionary space exhausted"
};
if (-1 - DIM (throw_explanation) < id && id <= -1)
{
strcpy (msg, throw_explanation[-1 - id]);
}
else if (-1024 < id && id <= -256)
{
sprintf (msg, "Received signal %d", -256 - id);
}
else if (-2048 < id && id <= -1024)
{
sprintf (msg, "I/O Error %d : %s", -1024-id, strerror (-1024-id));
}
else if (-32767 < id && id <= -2048)
{
p4_Exception* expt = PFE.exception_link;
strcpy (msg, "module-specific error-condition");
while (expt)
{
if (expt->id == id)
{
strcpy (msg, expt->name);
break;
}
expt = expt->next;
}
}
else if (0 < id)
{
# ifdef PFE_HAVE_STRERROR_R
strerror_r (id, msg, 255);
# else
strcpy (msg, strerror (id));
# endif
}
else
{
sprintf (msg, "%d THROW unassigned", id);
}
} |