qse/ase/awk/err.c

125 lines
3.9 KiB
C
Raw Normal View History

2006-03-04 10:08:13 +00:00
/*
2006-10-22 12:39:30 +00:00
* $Id: err.c,v 1.44 2006-10-22 12:39:29 bacon Exp $
2006-03-04 10:08:13 +00:00
*/
2006-10-22 11:34:53 +00:00
#include <sse/awk/awk_i.h>
2006-03-04 10:08:13 +00:00
2006-10-22 11:34:53 +00:00
int sse_awk_geterrnum (sse_awk_t* awk)
2006-03-04 10:08:13 +00:00
{
return awk->errnum;
}
2006-10-22 11:34:53 +00:00
const sse_char_t* sse_awk_geterrstr (int errnum)
2006-03-04 10:08:13 +00:00
{
2006-10-22 11:34:53 +00:00
static const sse_char_t* __errstr[] =
2006-03-04 10:08:13 +00:00
{
2006-10-22 11:34:53 +00:00
SSE_T("no error"),
SSE_T("out of memory"),
SSE_T("invalid parameter"),
SSE_T("general run-time error"),
SSE_T("one or more running instances"),
SSE_T("too many running instances"),
SSE_T("recursion too deep"),
2006-04-22 13:54:53 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("cannot open source input"),
SSE_T("cannot close source input"),
SSE_T("cannot read source input"),
2006-04-22 13:54:53 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("cannot open source output"),
SSE_T("cannot close source output"),
SSE_T("cannot write source output"),
2006-08-06 12:35:06 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("cannot open console for read"),
SSE_T("cannot close console for read"),
SSE_T("cannot switch to next console for read"),
SSE_T("cannot read from console"),
2006-08-03 09:54:16 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("cannot open console for write"),
SSE_T("cannot close console for write"),
SSE_T("cannot switch to next console for write"),
SSE_T("cannot write to console"),
2006-04-22 13:54:53 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("invalid character"),
SSE_T("cannot unget character"),
2006-04-07 04:23:11 +00:00
2006-10-22 12:39:30 +00:00
SSE_T("unexpected end of source"),
SSE_T("unexpected end of a comment"),
SSE_T("unexpected end of a string"),
SSE_T("unexpected end of a regular expression"),
SSE_T("left brace expected"),
SSE_T("left parenthesis expected"),
SSE_T("right parenthesis expected"),
SSE_T("right bracket expected"),
SSE_T("comma expected"),
SSE_T("semicolon expected"),
SSE_T("colon expected"),
SSE_T("keyword 'in' expected"),
2006-10-22 11:34:53 +00:00
SSE_T("not a variable after 'in'"),
2006-10-22 12:39:30 +00:00
SSE_T("expression expected"),
2006-04-10 15:52:07 +00:00
2006-10-22 12:39:30 +00:00
SSE_T("keyword 'while' expected"),
SSE_T("assignment statement expected"),
SSE_T("identifier expected"),
2006-10-22 11:34:53 +00:00
SSE_T("BEGIN requires an action block"),
SSE_T("END requires an action block"),
SSE_T("duplicate BEGIN"),
SSE_T("duplicate END"),
SSE_T("duplicate function name"),
SSE_T("duplicate parameter name"),
SSE_T("duplicate variable name"),
SSE_T("duplicate name"),
SSE_T("undefined identifier"),
SSE_T("l-value required"),
SSE_T("too few arguments"),
SSE_T("too many arguments"),
SSE_T("too many global variables"),
SSE_T("too many local variables"),
SSE_T("too many parameters"),
SSE_T("break outside a loop"),
SSE_T("continue outside a loop"),
SSE_T("next illegal in BEGIN or END block"),
SSE_T("nextfile illegal in BEGIN or END block"),
2006-10-22 12:39:30 +00:00
SSE_T("getline expected"),
2006-04-05 15:56:20 +00:00
2006-10-22 11:34:53 +00:00
SSE_T("divide by zero"),
SSE_T("invalid operand"),
SSE_T("wrong position index"),
SSE_T("no such function"),
SSE_T("value not assignable"),
SSE_T("variable not indexable"),
SSE_T("variable not deletable"),
SSE_T("value not referenceable"),
SSE_T("an indexed value cannot be assigned a map"),
SSE_T("a positional value cannot be assigned a map"),
SSE_T("cannot change a map to a scalar value"),
SSE_T("cannot change a scalar value to a map"),
SSE_T("a map is not allowed"),
SSE_T("wrong value type"),
SSE_T("pipe operation error"),
SSE_T("next cannot be called from the BEGIN or END block"),
SSE_T("nextfile cannot be called from the BEGIN or END block"),
SSE_T("wrong implementation of user-defined io handler"),
SSE_T("no such io name found"),
SSE_T("io handler has returned an error"),
SSE_T("internal error that should never have happened"),
2006-08-10 16:02:15 +00:00
2006-10-22 12:39:30 +00:00
SSE_T("a right parenthesis is expected in the regular expression"),
SSE_T("a right bracket is expected in the regular expression"),
SSE_T("a right brace is expected in the regular expression"),
SSE_T("a colon is expected in the regular expression"),
SSE_T("invalid character range in the regular expression"),
SSE_T("invalid character class in the regular expression"),
SSE_T("invalid boundary range in the regular expression"),
SSE_T("unexpected end of the regular expression"),
SSE_T("garbage after the regular expression")
2006-03-04 10:08:13 +00:00
};
2006-10-22 11:34:53 +00:00
if (errnum >= 0 && errnum < sse_countof(__errstr))
2006-07-25 16:41:40 +00:00
{
2006-08-10 16:02:15 +00:00
return __errstr[errnum];
2006-03-04 10:08:13 +00:00
}
2006-10-22 11:34:53 +00:00
return SSE_T("unknown error");
2006-03-04 10:08:13 +00:00
}
2006-07-26 16:43:35 +00:00