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