2006-03-04 10:08:13 +00:00
|
|
|
/*
|
2006-06-26 15:09:28 +00:00
|
|
|
* $Id: err.c,v 1.23 2006-06-26 15:09:28 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk)
|
|
|
|
{
|
|
|
|
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-04-22 13:54:53 +00:00
|
|
|
|
2006-05-06 12:52:36 +00:00
|
|
|
XP_T("no source io handler set"),
|
|
|
|
XP_T("cannot open source input"),
|
|
|
|
XP_T("cannot close source input"),
|
|
|
|
XP_T("cannot switch to next source input"),
|
|
|
|
XP_T("cannot read source input"),
|
2006-04-22 13:54:53 +00:00
|
|
|
|
2006-05-06 12:52:36 +00:00
|
|
|
XP_T("cannot open text input"),
|
|
|
|
XP_T("cannot close text input"),
|
|
|
|
XP_T("cannot switch to next text input"),
|
|
|
|
XP_T("cannot read text input"),
|
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"),
|
|
|
|
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"),
|
|
|
|
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-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"),
|
|
|
|
XP_T("no such function"),
|
|
|
|
XP_T("value not assignable"),
|
|
|
|
XP_T("value not indexable"),
|
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-06-19 09:10:57 +00:00
|
|
|
XP_T("wrong implementation of user-defined io handler"),
|
2006-04-07 16:52:42 +00:00
|
|
|
|
2006-05-06 12:52:36 +00:00
|
|
|
XP_T("internal error that should never have happened")
|
2006-03-04 10:08:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (awk->errnum >= 0 && awk->errnum < xp_countof(__errstr)) {
|
|
|
|
return __errstr[awk->errnum];
|
|
|
|
}
|
|
|
|
|
2006-05-06 12:52:36 +00:00
|
|
|
return XP_T("unknown error");
|
2006-03-04 10:08:13 +00:00
|
|
|
}
|