*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-10 11:59:04 +00:00
parent b93d0890ce
commit 9ea63a0b73
8 changed files with 379 additions and 472 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.205 2007-03-09 14:19:55 bacon Exp $
* $Id: awk.h,v 1.206 2007-03-10 11:58:34 bacon Exp $
*
* {License}
*/
@ -201,10 +201,10 @@ enum
ASE_AWK_ENOPER, /* operation not allowed */
ASE_AWK_ENODEV, /* function '%.*s' not found */
ASE_AWK_ENOSPC, /* no space left on device */
ASE_AWK_ENOENT, /* no such file, directory, or data */
ASE_AWK_EMFILE, /* too many open files */
ASE_AWK_EMLINK, /* too many links */
ASE_AWK_EAGAIN, /* resource temporarily unavailable */
ASE_AWK_ENOENT, /* file or data not existing */
ASE_AWK_EEXIST, /* file or data exists */
ASE_AWK_EFTBIG, /* file or data too big */
ASE_AWK_ETBUSY, /* system too busy */
@ -238,8 +238,8 @@ enum
ASE_AWK_ELXUNG, /* lexer failed to unget a character */
ASE_AWK_EENDSRC, /* unexpected end of source */
ASE_AWK_EENDCMT, /* unexpected end of a comment */
ASE_AWK_EENDSTR, /* unexpected end of a string */
ASE_AWK_EENDCMT, /* a comment not closed properly */
ASE_AWK_EENDSTR, /* a string not closed with a quote */
ASE_AWK_EENDREX, /* unexpected end of a regular expression */
ASE_AWK_ELBRACE, /* left brace expected */
ASE_AWK_ELPAREN, /* left parenthesis expected */
@ -268,17 +268,24 @@ enum
ASE_AWK_EDUPPAR, /* duplicate parameter name */
ASE_AWK_EDUPGBL, /* duplicate global variable name */
ASE_AWK_EDUPLCL, /* duplicate local variable name */
ASE_AWK_EBADPAR, /* not a valid parameter name */
ASE_AWK_EBADVAR, /* not a valid variable name */
ASE_AWK_EUNDEF, /* undefined identifier */
ASE_AWK_ELVALUE, /* l-value required */
ASE_AWK_EGBLTM, /* too many global variables */
ASE_AWK_ELCLTM, /* too many local variables */
ASE_AWK_EPARTM, /* too many parameters */
ASE_AWK_EDELETE, /* delete not followed by a variable */
ASE_AWK_EBREAK, /* break outside a loop */
ASE_AWK_ECONTINUE, /* continue outside a loop */
ASE_AWK_ENEXT, /* next illegal in BEGIN or END block */
ASE_AWK_ENEXTFILE, /* nextfile illegal in BEGIN or END block */
ASE_AWK_EGETLINE, /* getline expected */
ASE_AWK_EPRINTFARG, /* printf must have one or more arguments */
ASE_AWK_ENEXTBEG, /* next illegal in BEGIN block */
ASE_AWK_ENEXTEND, /* next illegal in END block */
ASE_AWK_ENEXTFBEG, /* nextfile illegal in BEGIN block */
ASE_AWK_ENEXTFEND, /* nextfile illegal in END block */
ASE_AWK_EPRINTFARG, /* printf not followed by any arguments */
ASE_AWK_EPREPST, /* both prefix and postfix increment/decrement
operator present */
ASE_AWK_EGLNCPS, /* coprocess not supported by getline */
/* run time error */
ASE_AWK_EDIVBY0, /* divide by zero */
@ -396,10 +403,6 @@ void ase_awk_seterror (
ase_awk_t* awk, int errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt);
void ase_awk_seterror_old (
ase_awk_t* run, int errnum,
ase_size_t errlin, const ase_char_t* errmsg);
int ase_awk_getoption (ase_awk_t* awk);
void ase_awk_setoption (ase_awk_t* awk, int opt);

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.89 2007-03-09 14:19:55 bacon Exp $
* $Id: err.c,v 1.90 2007-03-10 11:58:35 bacon Exp $
*
* {License}
*/
@ -18,11 +18,11 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("operation not allowed"),
ASE_T("no such device"),
ASE_T("no space left on device"),
ASE_T("no such file, directory, or data"),
ASE_T("too many open files"),
ASE_T("too many links"),
ASE_T("resource temporarily unavailable"),
ASE_T("file or data exists"),
ASE_T("'%.*s' not existing"),
ASE_T("'%.*s' already exists"),
ASE_T("file or data too big"),
ASE_T("system too busy"),
ASE_T("is a directory"),
@ -55,8 +55,8 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("cannot unget character"),
ASE_T("unexpected end of source"),
ASE_T("unexpected end of a comment"),
ASE_T("unexpected end of a string"),
ASE_T("a comment not closed properly"),
ASE_T("a string not closed with a quote"),
ASE_T("unexpected end of a regular expression"),
ASE_T("a left brace expected n place of '%.*s'"),
ASE_T("a left parenthesis expected in place of '%.*s'"),
@ -67,12 +67,12 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("a colon expected in place of '%.*s'"),
ASE_T("statement not ending with a semicolon"),
ASE_T("keyword 'in' expected in place of '%.*s'"),
ASE_T("not a variable after 'in'"),
ASE_T("expression expected"),
ASE_T("right-hand side of the 'in' operator not a variable"),
ASE_T("invalid expression"),
ASE_T("keyword 'while' expected"),
ASE_T("assignment statement expected"),
ASE_T("identifier expected"),
ASE_T("keyword 'while' expected in place of '%.*s'"),
ASE_T("invalid assignment statement"),
ASE_T("an identifier expected in place of '%.*s'"),
ASE_T("'%.*s' not a valid function name"),
ASE_T("BEGIN not followed by a left bracket on the same line"),
ASE_T("END not followed by a left bracket on the same line"),
@ -85,17 +85,23 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("duplicate parameter name '%.*s'"),
ASE_T("duplicate global variable '%.*s'"),
ASE_T("duplicate local variable '%.*s'"),
ASE_T("undefined identifier"),
ASE_T("'%.*s' not a valid parameter name"),
ASE_T("'%.*s' not a valid variable name"),
ASE_T("undefined identifier '%.*s'"),
ASE_T("l-value required"),
ASE_T("too many global variables"),
ASE_T("too many local variables"),
ASE_T("too many parameters"),
ASE_T("break outside a loop"),
ASE_T("continue outside a loop"),
ASE_T("next illegal in BEGIN or END block"),
ASE_T("nextfile illegal in BEGIN or END block"),
ASE_T("getline expected"),
ASE_T("printf requires one or more arguments"),
ASE_T("delete statement not followed by a normal variable"),
ASE_T("break statement outside a loop"),
ASE_T("continue statement outside a loop"),
ASE_T("next statement illegal in the BEGIN block"),
ASE_T("next statement illegal in the END block"),
ASE_T("nextfile statement illegal in the BEGIN block"),
ASE_T("nextfile statement illegal in the END block"),
ASE_T("printf not followed by any arguments"),
ASE_T("both prefix and postfix increment/decrement operator present"),
ASE_T("coprocess not supported by getline"),
ASE_T("divide by zero"),
ASE_T("invalid operand"),
@ -113,7 +119,7 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("map '%.*s' not assignable with a scalar"),
ASE_T("cannot change a scalar value to a map"),
ASE_T("a map is not allowed"),
ASE_T("wrong value type"),
ASE_T("invalid value type"),
ASE_T("next cannot be called from the BEGIN or END block"),
ASE_T("nextfile cannot be called from the BEGIN or END block"),
ASE_T("wrong implementation of built-in function handler"),
@ -131,7 +137,7 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("a right parenthesis expected in the regular expression"),
ASE_T("a right bracket expected in the regular expression"),
ASE_T("a right brace expected in the regular expression"),
ASE_T("unbalanced parenthesis"),
ASE_T("unbalanced parenthesis in the regular expression"),
ASE_T("a colon expected in the regular expression"),
ASE_T("invalid character range in the regular expression"),
ASE_T("invalid character class in the regular expression"),
@ -307,21 +313,6 @@ void ase_awk_seterror (
}
}
void ase_awk_seterror_old (
ase_awk_t* awk, int errnum,
ase_size_t errlin, const ase_char_t* errmsg)
{
awk->errnum = errnum;
awk->errlin = errlin;
if (errmsg == ASE_NULL) awk->errmsg[0] = ASE_T('\0');
else if (awk->errmsg != errmsg)
{
ase_strxcpy (
awk->errmsg, ASE_COUNTOF(awk->errmsg), errmsg);
}
}
int ase_awk_getrunerrnum (ase_awk_run_t* run)
{
return run->errnum;

View File

@ -1,5 +1,5 @@
/*
* $Id: extio.c,v 1.74 2007-03-06 14:51:52 bacon Exp $
* $Id: extio.c,v 1.75 2007-03-10 11:58:35 bacon Exp $
*
* {License}
*/
@ -117,7 +117,8 @@ int ase_awk_readextio (
run->awk, ASE_SIZEOF(ase_awk_extio_t));
if (p == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -125,7 +126,8 @@ int ase_awk_readextio (
if (p->name == ASE_NULL)
{
ASE_AWK_FREE (run->awk, p);
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -319,7 +321,8 @@ int ase_awk_readextio (
if (ase_str_ccat (buf, c) == (ase_size_t)-1)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
ret = -1;
break;
}
@ -353,7 +356,8 @@ int ase_awk_readextio (
nr = ase_awk_makeintval (run, lv + 1);
if (nr == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
ret = -1;
}
else
@ -445,7 +449,8 @@ int ase_awk_writeextio_str (
run->awk, ASE_SIZEOF(ase_awk_extio_t));
if (p == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -453,7 +458,8 @@ int ase_awk_writeextio_str (
if (p->name == ASE_NULL)
{
ASE_AWK_FREE (run->awk, p);
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: func.c,v 1.100 2007-03-06 14:51:52 bacon Exp $
* $Id: func.c,v 1.101 2007-03-10 11:58:35 bacon Exp $
*
* {License}
*/
@ -53,18 +53,19 @@ void* ase_awk_addbfn (
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
{
awk->prmfns.misc.sprintf (
awk->prmfns.misc.custom_data,
awk->errmsg, ASE_COUNTOF(awk->errmsg),
ASE_T("'%.*s' added already"), name_len, name);
ase_awk_seterror_old (awk, ASE_AWK_EEXIST, 0, awk->errmsg);
ase_cstr_t errarg;
errarg.ptr = name;
errarg.len = name_len;
ase_awk_seterror (awk, ASE_AWK_EEXIST, 0, &errarg, 1);
return ASE_NULL;
}
p = (ase_awk_bfn_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_bfn_t));
if (p == ASE_NULL)
{
ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -72,7 +73,7 @@ void* ase_awk_addbfn (
if (p->name.ptr == ASE_NULL)
{
ASE_AWK_FREE (awk, p);
ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -88,7 +89,7 @@ void* ase_awk_addbfn (
{
ASE_AWK_FREE (awk, p->name.ptr);
ASE_AWK_FREE (awk, p);
ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
}
@ -103,6 +104,7 @@ void* ase_awk_addbfn (
int ase_awk_delbfn (ase_awk_t* awk, const ase_char_t* name, ase_size_t name_len)
{
ase_awk_bfn_t* p, * pp = ASE_NULL;
ase_cstr_t errarg;
for (p = awk->bfn.user; p != ASE_NULL; p = p->next)
{
@ -123,7 +125,10 @@ int ase_awk_delbfn (ase_awk_t* awk, const ase_char_t* name, ase_size_t name_len)
pp = p;
}
ase_awk_seterror_old (awk, ASE_AWK_ENOENT, 0, ASE_NULL);
errarg.ptr = name;
errarg.len = name_len;
ase_awk_seterror (awk, ASE_AWK_ENOENT, 0, &errarg, 1);
return -1;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c,v 1.341 2007-03-09 14:19:55 bacon Exp $
* $Id: run.c,v 1.342 2007-03-10 11:58:35 bacon Exp $
*
* {License}
*/
@ -601,7 +601,7 @@ int ase_awk_run (ase_awk_t* awk,
ase_awk_map_getsize(&awk->tree.afns) == 0)
{
/* if not, deny the run */
ase_awk_seterror_old (awk, ASE_AWK_ENOPER, 0, ASE_NULL);
ase_awk_seterror (awk, ASE_AWK_ENOPER, 0, ASE_NULL, 0);
return -1;
}
@ -646,13 +646,16 @@ int ase_awk_run (ase_awk_t* awk,
* is updated with the run's error number */
if (runcbs == ASE_NULL)
{
ase_awk_seterror_old (
awk, run->errnum, run->errlin, run->errmsg);
awk->errnum = run->errnum;
awk->errlin = run->errlin;
ase_strxcpy (
awk->errmsg, ASE_COUNTOF(awk->errmsg),
run->errmsg);
}
else
{
ase_awk_seterror_old (
awk, ASE_AWK_ERUNTIME, 0, ASE_NULL);
ase_awk_seterror (awk, ASE_AWK_ERUNTIME, 0, ASE_NULL, 0);
}
}
@ -3375,7 +3378,8 @@ static ase_awk_val_t* __eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
res = __binop_func[exp->opcode] (run, left, right);
if (res == ASE_NULL)
{
ase_awk_setrunerror_old (run, run->errnum, nde->line, ASE_NULL);
/* change the error line */
run->errlin = nde->line;
}
ase_awk_refdownval (run, left);
@ -3499,7 +3503,8 @@ static ase_awk_val_t* __eval_binop_in (
ASE_ASSERT (
!"should never happen - in needs a plain variable");
ase_awk_setrunerror_old (run, ASE_AWK_EINTERN, right->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EINTERN, right->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -4153,7 +4158,8 @@ static ase_awk_val_t* __eval_binop_div (
{
if (l2 == 0)
{
ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EDIVBY0, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -4215,7 +4221,8 @@ static ase_awk_val_t* __eval_binop_idiv (
{
if (l2 == 0)
{
ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EDIVBY0, 0, ASE_NULL, 0);
return ASE_NULL;
}
res = ase_awk_makeintval (
@ -4321,7 +4328,8 @@ static ase_awk_val_t* __eval_binop_exp (
}
else if (l1 == 0)
{
ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EDIVBY0, 0, ASE_NULL, 0);
return ASE_NULL;
}
else
@ -4343,7 +4351,8 @@ static ase_awk_val_t* __eval_binop_exp (
}
else if (r1 == 0.0)
{
ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EDIVBY0, 0, ASE_NULL, 0);
return ASE_NULL;
}
else
@ -4503,7 +4512,7 @@ static ase_awk_val_t* __eval_binop_match0 (
((ase_awk_val_str_t*)right)->len, &errnum);
if (rex_code == ASE_NULL)
{
ase_awk_setrunerror_old (run, errnum, rline, ASE_NULL);
ase_awk_setrunerror (run, errnum, rline, ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4518,7 +4527,7 @@ static ase_awk_val_t* __eval_binop_match0 (
{
ASE_AWK_FREE (run->awk, str);
ase_awk_setrunerror_old (run, errnum, rline, ASE_NULL);
ase_awk_setrunerror (run, errnum, rline, ASE_NULL, 0);
return ASE_NULL;
}
@ -4538,7 +4547,7 @@ static ase_awk_val_t* __eval_binop_match0 (
if (right->type != ASE_AWK_VAL_REX)
ASE_AWK_FREE (run->awk, rex_code);
ase_awk_setrunerror_old (run, errnum, lline, ASE_NULL);
ase_awk_setrunerror (run, errnum, lline, ASE_NULL, 0);
return ASE_NULL;
}
@ -4548,8 +4557,8 @@ static ase_awk_val_t* __eval_binop_match0 (
if (right->type != ASE_AWK_VAL_REX)
ASE_AWK_FREE (run->awk, rex_code);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, lline, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, lline, ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4574,8 +4583,7 @@ static ase_awk_val_t* __eval_binop_match0 (
if (right->type != ASE_AWK_VAL_REX)
ASE_AWK_FREE (run->awk, rex_code);
ase_awk_setrunerror_old (
run, errnum, lline, ASE_NULL);
ase_awk_setrunerror (run, errnum, lline, ASE_NULL, 0);
return ASE_NULL;
}
@ -4586,8 +4594,8 @@ static ase_awk_val_t* __eval_binop_match0 (
if (right->type != ASE_AWK_VAL_REX)
ASE_AWK_FREE (run->awk, rex_code);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, lline, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, lline, ASE_NULL, 0);
return ASE_NULL;
}
@ -4683,8 +4691,8 @@ static ase_awk_val_t* __eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -4728,8 +4736,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4740,8 +4749,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4773,8 +4783,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4788,8 +4799,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4800,8 +4812,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4816,7 +4829,8 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror (
run, ASE_AWK_EOPERAND, nde->line, ASE_NULL, 0);
run, ASE_AWK_EOPERAND, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4833,8 +4847,9 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4896,8 +4911,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4906,8 +4922,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4918,8 +4935,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4928,8 +4946,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4944,7 +4963,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror (
run, ASE_AWK_EOPERAND, nde->line, ASE_NULL, 0);
run, ASE_AWK_EOPERAND, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4955,7 +4975,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4964,8 +4985,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -4976,8 +4998,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -4986,8 +5009,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -5002,8 +5026,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5012,8 +5037,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -5024,8 +5050,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5035,7 +5062,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -5050,7 +5078,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror (
run, ASE_AWK_EOPERAND, nde->line, ASE_NULL, 0);
run, ASE_AWK_EOPERAND, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5061,7 +5090,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5070,8 +5100,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -5082,8 +5113,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5093,8 +5125,9 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
}
@ -5285,16 +5318,16 @@ static ase_awk_val_t* __eval_call (
#endif
if (__raw_push(run,(void*)run->stack_base) == -1)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
if (__raw_push(run,(void*)saved_stack_top) == -1)
{
__raw_pop (run);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -5303,8 +5336,8 @@ static ase_awk_val_t* __eval_call (
{
__raw_pop (run);
__raw_pop (run);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -5314,8 +5347,8 @@ static ase_awk_val_t* __eval_call (
__raw_pop (run);
__raw_pop (run);
__raw_pop (run);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -5374,8 +5407,8 @@ static ase_awk_val_t* __eval_call (
ase_awk_refdownval (run, v);
UNWIND_RUN_STACK (run, nargs);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -5395,8 +5428,9 @@ static ase_awk_val_t* __eval_call (
if (__raw_push(run,ase_awk_val_nil) == -1)
{
UNWIND_RUN_STACK (run, nargs);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return ASE_NULL;
}
@ -5493,8 +5527,9 @@ static int __get_reference (
tgt->id.name_len, ase_awk_val_nil);
if (pair == ASE_NULL)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return -1;
}
}
@ -5534,8 +5569,9 @@ static int __get_reference (
tgt->id.name_len, ase_awk_val_nil);
if (pair == ASE_NULL)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line,
ASE_NULL, 0);
return -1;
}
}
@ -5625,8 +5661,8 @@ static ase_awk_val_t** __get_reference_indexed (
tmp = ase_awk_makemapval (run);
if (tmp == ASE_NULL)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -5655,8 +5691,8 @@ static ase_awk_val_t** __get_reference_indexed (
if (pair == ASE_NULL)
{
ASE_AWK_FREE (run->awk, str);
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, nde->line, ASE_NULL, 0);
return ASE_NULL;
}
@ -6829,7 +6865,8 @@ ase_char_t* ase_awk_format (
else
{
ase_awk_refdownval (run, v);
ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_EVALTYPE, 0, ASE_NULL, 0);
return ASE_NULL;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c,v 1.114 2007-03-06 14:51:53 bacon Exp $
* $Id: val.c,v 1.115 2007-03-10 11:58:35 bacon Exp $
*
* {License}
*/
@ -481,7 +481,7 @@ ase_char_t* ase_awk_valtostr (
v->type);
#endif
ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL);
ase_awk_setrunerror (run, ASE_AWK_EVALTYPE, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -495,7 +495,8 @@ static ase_char_t* __str_to_str (
tmp = ase_strxdup (str, str_len, &run->awk->prmfns.mmgr);
if (tmp == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -510,7 +511,8 @@ static ase_char_t* __str_to_str (
n = ase_str_ncat (buf, str, str_len);
if (n == (ase_size_t)-1)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -537,8 +539,8 @@ static ase_char_t* __val_int_to_str (
run->awk, 2 * ASE_SIZEOF(ase_char_t));
if (tmp == ASE_NULL)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -552,8 +554,8 @@ static ase_char_t* __val_int_to_str (
if (opt & ASE_AWK_VALTOSTR_CLEAR) ase_str_clear (buf);
if (ase_str_cat (buf, ASE_T("0")) == (ase_size_t)-1)
{
ase_awk_setrunerror_old (
run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -572,7 +574,8 @@ static ase_char_t* __val_int_to_str (
run->awk, (l + 1) * ASE_SIZEOF(ase_char_t));
if (tmp == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -590,7 +593,8 @@ static ase_char_t* __val_int_to_str (
if (ase_str_nccat (
buf, ASE_T(' '), l) == (ase_size_t)-1)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
}
@ -636,14 +640,14 @@ static ase_char_t* __val_real_to_str (
if (ase_str_open (&out, 256, &run->awk->prmfns.mmgr) == ASE_NULL)
{
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
if (ase_str_open (&fbu, 256, &run->awk->prmfns.mmgr) == ASE_NULL)
{
ase_str_close (&out);
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -670,7 +674,8 @@ static ase_char_t* __val_real_to_str (
{
ase_str_close (&fbu);
ase_str_close (&out);
ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
@ -738,7 +743,7 @@ int ase_awk_valtonum (
v->type);
#endif
ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL);
ase_awk_setrunerror (run, ASE_AWK_EVALTYPE, 0, ASE_NULL, 0);
return -1; /* error */
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.186 2007-03-09 14:19:55 bacon Exp $
* $Id: awk.c,v 1.187 2007-03-10 11:59:04 bacon Exp $
*/
#include <ase/awk/awk.h>
@ -716,7 +716,7 @@ static int awk_main (int argc, ase_char_t* argv[])
ase_awk_runios_t runios;
ase_awk_prmfns_t prmfns;
struct awk_src_io src_io = { NULL, NULL };
int opt, i, file_count = 0, errnum;
int opt, i, file_count = 0;
#ifdef _WIN32
struct mmgr_data_t mmgr_data;
#endif