diff --git a/ase/awk/awk.h b/ase/awk/awk.h index 462ba778..d2c22c6f 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.193 2007-03-02 10:06:17 bacon Exp $ + * $Id: awk.h,v 1.194 2007-03-02 11:14:33 bacon Exp $ * * {License} */ @@ -29,7 +29,6 @@ typedef int (*ase_awk_sprintf_t) ( typedef void (*ase_awk_aprintf_t) (void* custom, const ase_char_t* fmt, ...); typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...); typedef void (*ase_awk_abort_t) (void* custom); -typedef void (*ase_awk_lock_t) (void* custom); typedef ase_ssize_t (*ase_awk_io_t) ( int cmd, void* arg, ase_char_t* data, ase_size_t count); @@ -77,10 +76,6 @@ struct ase_awk_prmfns_t ase_awk_dprintf_t dprintf; /* required in the debug mode */ ase_awk_abort_t abort; /* required in the debug mode */ - /* thread lock */ - ase_awk_lock_t lock; /* required if multi-threaded */ - ase_awk_lock_t unlock; /* required if multi-threaded */ - /* user-defined data passed to the functions above */ void* custom_data; /* optional */ } misc; @@ -404,6 +399,10 @@ void ase_awk_geterror ( void ase_awk_seterrnum (ase_awk_t* awk, int errnum); 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); @@ -434,7 +433,7 @@ int ase_awk_run ( ase_awk_runios_t* runios, ase_awk_runcbs_t* runcbs, ase_awk_runarg_t* runarg, void* custom_data); -int ase_awk_stop (ase_awk_t* awk, ase_awk_run_t* run); +int ase_awk_stop (ase_awk_run_t* run); /* functions to access internal stack structure */ ase_size_t ase_awk_getnargs (ase_awk_run_t* run); @@ -461,7 +460,12 @@ void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum); void ase_awk_getrunerror ( ase_awk_run_t* run, int* errnum, ase_size_t* errlin, const ase_char_t** errmsg); + void ase_awk_setrunerror ( + ase_awk_run_t* run, int errnum, ase_size_t errlin, + const ase_cstr_t* errarg, ase_size_t argcnt); + +void ase_awk_setrunerror_old ( ase_awk_run_t* run, int errnum, ase_size_t errlin, const ase_char_t* msg); diff --git a/ase/awk/awk_i.h b/ase/awk/awk_i.h index 248f73e3..0ba922aa 100644 --- a/ase/awk/awk_i.h +++ b/ase/awk/awk_i.h @@ -1,5 +1,5 @@ /* - * $Id: awk_i.h,v 1.105 2007-03-02 10:12:40 bacon Exp $ + * $Id: awk_i.h,v 1.106 2007-03-02 11:14:33 bacon Exp $ * * {License} */ @@ -30,12 +30,6 @@ typedef struct ase_awk_tree_t ase_awk_tree_t; #pragma warning (disable: 4296) #endif -/* TODO: remove this */ -#ifdef _WIN32 -#include -#define xp_printf _tprintf -#endif - #define ASE_AWK_MAX_GLOBALS 9999 #define ASE_AWK_MAX_LOCALS 9999 #define ASE_AWK_MAX_PARAMS 9999 @@ -67,19 +61,6 @@ typedef struct ase_awk_tree_t ase_awk_tree_t; #define ASE_AWK_TOUPPER(awk,c) ASE_TOUPPER(&(awk)->prmfns.ccls,c) #define ASE_AWK_TOLOWER(awk,c) ASE_TOLOWER(&(awk)->prmfns.ccls,c) -#define ASE_AWK_LOCK(awk) \ - do { \ - if ((awk)->prmfns.misc.lock != ASE_NULL) \ - (awk)->prmfns.misc.lock ((awk)->prmfns.misc.custom_data); \ - } while (0) - -#define ASE_AWK_UNLOCK(awk) \ - do { \ - if ((awk)->prmfns.misc.unlock != ASE_NULL) \ - (awk)->prmfns.misc.unlock ((awk)->prmfns.misc.custom_data); \ - } while (0) - - struct ase_awk_tree_t { ase_size_t nglobals; /* total number of globals */ diff --git a/ase/awk/err.c b/ase/awk/err.c index f1013b53..8cb0ccb1 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,66 +1,12 @@ /* - * $Id: err.c,v 1.74 2007-02-23 08:17:49 bacon Exp $ + * $Id: err.c,v 1.75 2007-03-02 11:14:33 bacon Exp $ * * {License} */ #include -int ase_awk_geterrnum (ase_awk_t* awk) -{ - return awk->errnum; -} - -ase_size_t ase_awk_geterrlin (ase_awk_t* awk) -{ - return awk->errlin; -} - -const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk) -{ - if (awk->errmsg[0] == ASE_T('\0')) - return ase_awk_geterrstr (awk->errnum); - return awk->errmsg; -} - - -void ase_awk_geterror ( - ase_awk_t* awk, int* errnum, - ase_size_t* errlin, const ase_char_t** errmsg) -{ - if (errnum != ASE_NULL) *errnum = awk->errnum; - if (errlin != ASE_NULL) *errlin = awk->errlin; - if (errmsg != ASE_NULL) - { - if (awk->errmsg[0] == ASE_T('\0')) - *errmsg = ase_awk_geterrstr (awk->errnum); - else - *errmsg = awk->errmsg; - } -} - -void ase_awk_seterrnum (ase_awk_t* awk, int errnum) -{ - awk->errnum = errnum; - awk->errlin = 0; - awk->errmsg[0] = ASE_T('\0'); -} - -void ase_awk_seterror ( - 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); - } -} - -const ase_char_t* ase_awk_geterrstr (int errnum) +static const ase_char_t* __geterrstr (int errnum) { static const ase_char_t* __errstr[] = { @@ -157,13 +103,13 @@ const ase_char_t* ase_awk_geterrstr (int errnum) ASE_T("too many arguments"), ASE_T("no such function"), ASE_T("variable not indexable"), - ASE_T("variable not deletable"), + ASE_T("variable '%.*s' not deletable"), ASE_T("value not a map"), ASE_T("value not referenceable"), ASE_T("value not assignable"), ASE_T("an indexed value cannot be assigned a map"), ASE_T("a positional value cannot be assigned a map"), - ASE_T("cannot change a map to a scalar value"), + 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"), @@ -200,3 +146,276 @@ const ase_char_t* ase_awk_geterrstr (int errnum) return ASE_T("unknown error"); } +const ase_char_t* ase_awk_geterrstr (int errnum) +{ + return __geterrstr (errnum); +} + + +int ase_awk_geterrnum (ase_awk_t* awk) +{ + return awk->errnum; +} + +ase_size_t ase_awk_geterrlin (ase_awk_t* awk) +{ + return awk->errlin; +} + +const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk) +{ + if (awk->errmsg[0] == ASE_T('\0')) + return ase_awk_geterrstr (awk->errnum); + return awk->errmsg; +} + +void ase_awk_geterror ( + ase_awk_t* awk, int* errnum, + ase_size_t* errlin, const ase_char_t** errmsg) +{ + if (errnum != ASE_NULL) *errnum = awk->errnum; + if (errlin != ASE_NULL) *errlin = awk->errlin; + if (errmsg != ASE_NULL) + { + if (awk->errmsg[0] == ASE_T('\0')) + *errmsg = ase_awk_geterrstr (awk->errnum); + else + *errmsg = awk->errmsg; + } +} + +void ase_awk_seterrnum (ase_awk_t* awk, int errnum) +{ + awk->errnum = errnum; + awk->errlin = 0; + awk->errmsg[0] = ASE_T('\0'); +} + +void ase_awk_seterror ( + ase_awk_t* awk, int errnum, ase_size_t errlin, + const ase_cstr_t* errarg, ase_size_t argcnt) +{ + const ase_char_t* errfmt; + + ASE_AWK_ASSERT (awk, argcnt <= 5); + + awk->errnum = errnum; + awk->errlin = errlin; + + errfmt = __geterrstr (errnum); + + switch (argcnt) + { + case 0: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt); + return; + + case 1: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr); + return; + + case 2: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr); + return; + + case 3: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr); + return; + + case 4: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr, + errarg[3].len, errarg[3].ptr); + return; + + case 5: + awk->prmfns.misc.sprintf ( + awk->prmfns.misc.custom_data, + awk->errmsg, + ASE_COUNTOF(awk->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr, + errarg[3].len, errarg[3].ptr, + errarg[4].len, errarg[4].ptr); + return; + } +} + +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; +} + +ase_size_t ase_awk_getrunerrlin (ase_awk_run_t* run) +{ + return run->errlin; +} + +const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run) +{ + if (run->errmsg[0] == ASE_T('\0')) + return ase_awk_geterrstr (run->errnum); + + return run->errmsg; +} + +void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum) +{ + run->errnum = errnum; + run->errlin = 0; + run->errmsg[0] = ASE_T('\0'); +} + +void ase_awk_getrunerror ( + ase_awk_run_t* run, int* errnum, + ase_size_t* errlin, const ase_char_t** errmsg) +{ + if (errnum != ASE_NULL) *errnum = run->errnum; + if (errlin != ASE_NULL) *errlin = run->errlin; + if (errmsg != ASE_NULL) + { + if (run->errmsg[0] == ASE_T('\0')) + *errmsg = ase_awk_geterrstr (run->errnum); + else + *errmsg = run->errmsg; + } +} + +void ase_awk_setrunerror ( + ase_awk_run_t* run, int errnum, ase_size_t errlin, + const ase_cstr_t* errarg, ase_size_t argcnt) +{ + const ase_char_t* errfmt; + + ASE_AWK_ASSERT (run->awk, argcnt <= 5); + + run->errnum = errnum; + run->errlin = errlin; + + errfmt = __geterrstr (errnum); + + switch (argcnt) + { + case 0: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt); + return; + + case 1: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr); + return; + + case 2: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr); + return; + + case 3: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr); + return; + + case 4: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr, + errarg[3].len, errarg[3].ptr); + return; + + case 5: + run->awk->prmfns.misc.sprintf ( + run->awk->prmfns.misc.custom_data, + run->errmsg, + ASE_COUNTOF(run->errmsg), + errfmt, + errarg[0].len, errarg[0].ptr, + errarg[1].len, errarg[1].ptr, + errarg[2].len, errarg[2].ptr, + errarg[3].len, errarg[3].ptr, + errarg[4].len, errarg[4].ptr); + return; + } +} + +void ase_awk_setrunerror_old ( + ase_awk_run_t* run, int errnum, + ase_size_t errlin, const ase_char_t* errmsg) +{ + run->errnum = errnum; + run->errlin = errlin; + + if (errmsg == ASE_NULL) run->errmsg[0] = ASE_T('\0'); + else if (errmsg != run->errmsg) + { + ase_strxcpy (run->errmsg, ASE_COUNTOF(run->errmsg), errmsg); + } +} diff --git a/ase/awk/extio.c b/ase/awk/extio.c index 52518994..1cfb4cf7 100644 --- a/ase/awk/extio.c +++ b/ase/awk/extio.c @@ -1,5 +1,5 @@ /* - * $Id: extio.c,v 1.72 2007-02-23 08:17:49 bacon Exp $ + * $Id: extio.c,v 1.73 2007-03-02 11:14:33 bacon Exp $ * * {License} */ @@ -103,7 +103,7 @@ int ase_awk_readextio ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -120,7 +120,7 @@ int ase_awk_readextio ( run->awk, ASE_SIZEOF(ase_awk_extio_t)); if (p == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -128,7 +128,7 @@ int ase_awk_readextio ( if (p->name == ASE_NULL) { ASE_AWK_FREE (run->awk, p); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -150,7 +150,7 @@ int ase_awk_readextio ( { ASE_AWK_FREE (run->awk, p->name); ASE_AWK_FREE (run->awk, p); - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -223,7 +223,7 @@ int ase_awk_readextio ( if (n <= -1) { /* handler error. getline should return -1 */ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); ret = -1; break; } @@ -322,7 +322,7 @@ int ase_awk_readextio ( if (ase_str_ccat (buf, c) == (ase_size_t)-1) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); ret = -1; break; } @@ -356,7 +356,7 @@ int ase_awk_readextio ( nr = ase_awk_makeintval (run, lv + 1); if (nr == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); ret = -1; } else @@ -422,7 +422,7 @@ int ase_awk_writeextio_str ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -451,7 +451,7 @@ int ase_awk_writeextio_str ( run->awk, ASE_SIZEOF(ase_awk_extio_t)); if (p == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -459,7 +459,7 @@ int ase_awk_writeextio_str ( if (p->name == ASE_NULL) { ASE_AWK_FREE (run->awk, p); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -478,7 +478,7 @@ int ase_awk_writeextio_str ( { ASE_AWK_FREE (run->awk, p->name); ASE_AWK_FREE (run->awk, p); - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -517,7 +517,7 @@ int ase_awk_writeextio_str ( if (n <= -1) { - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -558,7 +558,7 @@ int ase_awk_flushextio ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -572,7 +572,7 @@ int ase_awk_flushextio ( if (n <= -1) { - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -585,7 +585,7 @@ int ase_awk_flushextio ( if (ok) return 0; /* there is no corresponding extio for name */ - ase_awk_setrunerror (run, ASE_AWK_EIONONE, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIONONE, 0, ASE_NULL); return -1; } @@ -612,7 +612,7 @@ int ase_awk_nextextio_read ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -628,7 +628,7 @@ int ase_awk_nextextio_read ( /* something is totally wrong */ ASE_AWK_ASSERT (run->awk, !"should never happen - cannot find the relevant extio entry"); - ase_awk_setrunerror (run, ASE_AWK_EINTERN, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EINTERN, 0, ASE_NULL); return -1; } @@ -641,7 +641,7 @@ int ase_awk_nextextio_read ( n = handler (ASE_AWK_IO_NEXT, p, ASE_NULL, 0); if (n <= -1) { - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -689,7 +689,7 @@ int ase_awk_nextextio_write ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -706,7 +706,7 @@ int ase_awk_nextextio_write ( ASE_AWK_ASSERT (run->awk, !"should never happen - cannot find the relevant extio entry"); - ase_awk_setrunerror (run, ASE_AWK_EINTERN, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EINTERN, 0, ASE_NULL); return -1; } @@ -719,7 +719,7 @@ int ase_awk_nextextio_write ( n = handler (ASE_AWK_IO_NEXT, p, ASE_NULL, 0); if (n <= -1) { - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -732,7 +732,7 @@ int ase_awk_nextextio_write ( n = handler (ASE_AWK_IO_NEXT, p, ASE_NULL, 0); if (n <= -1) { - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -776,7 +776,7 @@ int ase_awk_closeextio_read ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -793,7 +793,7 @@ int ase_awk_closeextio_read ( if (handler (ASE_AWK_IO_CLOSE, p, ASE_NULL, 0) <= -1) { /* this is not a run-time error.*/ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } } @@ -811,7 +811,7 @@ int ase_awk_closeextio_read ( } /* this is not a run-time error */ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -838,7 +838,7 @@ int ase_awk_closeextio_write ( if (handler == ASE_NULL) { /* no io handler provided */ - ase_awk_setrunerror (run, ASE_AWK_EIOUSER, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOUSER, 0, ASE_NULL); return -1; } @@ -855,7 +855,7 @@ int ase_awk_closeextio_write ( if (handler (ASE_AWK_IO_CLOSE, p, ASE_NULL, 0) <= -1) { /* this is not a run-time error.*/ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } } @@ -873,7 +873,7 @@ int ase_awk_closeextio_write ( } /* this is not a run-time error */ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } @@ -895,7 +895,7 @@ int ase_awk_closeextio (ase_awk_run_t* run, const ase_char_t* name) if (handler (ASE_AWK_IO_CLOSE, p, ASE_NULL, 0) <= -1) { /* this is not a run-time error.*/ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } } @@ -913,7 +913,7 @@ int ase_awk_closeextio (ase_awk_run_t* run, const ase_char_t* name) } /* this is not a run-time error */ - ase_awk_setrunerror (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EIOIMPL, 0, ASE_NULL); return -1; } diff --git a/ase/awk/func.c b/ase/awk/func.c index 5b0654c6..4f0b23c7 100644 --- a/ase/awk/func.c +++ b/ase/awk/func.c @@ -1,5 +1,5 @@ /* - * $Id: func.c,v 1.98 2007-03-02 10:12:40 bacon Exp $ + * $Id: func.c,v 1.99 2007-03-02 11:14:33 bacon Exp $ * * {License} */ @@ -56,15 +56,15 @@ void* ase_awk_addbfn ( awk->prmfns.misc.sprintf ( awk->prmfns.misc.custom_data, awk->errmsg, ASE_COUNTOF(awk->errmsg), - ASE_T("'%.*s' added already"), (int)name_len, name); - ase_awk_seterror (awk, ASE_AWK_EEXIST, 0, awk->errmsg); + ASE_T("'%.*s' added already"), name_len, name); + ase_awk_seterror_old (awk, ASE_AWK_EEXIST, 0, awk->errmsg); 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 (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -72,7 +72,7 @@ void* ase_awk_addbfn ( if (p->name.ptr == ASE_NULL) { ASE_AWK_FREE (awk, p); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -88,7 +88,7 @@ void* ase_awk_addbfn ( { ASE_AWK_FREE (awk, p->name.ptr); ASE_AWK_FREE (awk, p); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } } @@ -123,7 +123,7 @@ int ase_awk_delbfn (ase_awk_t* awk, const ase_char_t* name, ase_size_t name_len) pp = p; } - ase_awk_seterror (awk, ASE_AWK_ENOENT, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOENT, 0, ASE_NULL); return -1; } diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 334a1d39..7ae7b0de 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.70 2007-02-24 14:31:44 bacon Exp $ + * $Id: jni.c,v 1.71 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -1375,7 +1375,7 @@ static int __handle_bfn ( jchar* tmp = (jchar*) malloc (ASE_SIZEOF(jchar)*fnl); if (tmp == NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1393,14 +1393,14 @@ static int __handle_bfn ( { if (is_debug(awk)) (*env)->ExceptionDescribe (env); (*env)->ExceptionClear (env); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } name_utf = (*env)->GetStringUTFChars (env, name, JNI_FALSE); if (name_utf == NULL) { (*env)->DeleteLocalRef (env, name); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1427,7 +1427,7 @@ static int __handle_bfn ( { if (is_debug(awk)) (*env)->ExceptionDescribe (env); (*env)->ExceptionClear (env); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1467,7 +1467,7 @@ static int __handle_bfn ( if (tmp == NULL) { (*env)->DeleteLocalRef (env, args); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1494,7 +1494,7 @@ static int __handle_bfn ( (*env)->ExceptionClear (env); } (*env)->DeleteLocalRef (env, args); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1529,7 +1529,7 @@ static int __handle_bfn ( if (v == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1545,7 +1545,7 @@ static int __handle_bfn ( if (v == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1561,7 +1561,7 @@ static int __handle_bfn ( if (v == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1576,7 +1576,7 @@ static int __handle_bfn ( if (v == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1591,7 +1591,7 @@ static int __handle_bfn ( if (v == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1608,7 +1608,7 @@ static int __handle_bfn ( if (ptr == NULL) { (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1621,7 +1621,7 @@ static int __handle_bfn ( { (*env)->ReleaseStringChars (env, ret, ptr); (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } @@ -1638,7 +1638,7 @@ static int __handle_bfn ( { (*env)->ReleaseStringChars (env, ret, ptr); (*env)->DeleteLocalRef (env, ret); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, msg_nomem); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, msg_nomem); return -1; } diff --git a/ase/awk/parse.c b/ase/awk/parse.c index c62adb86..774a854e 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.246 2007-02-24 14:31:44 bacon Exp $ + * $Id: parse.c,v 1.247 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -264,14 +264,16 @@ static struct __kwent __kwtab[] = { ASE_NULL, 0, 0, 0 } }; -struct __bvent +typedef struct global_t global_t; + +struct global_t { const ase_char_t* name; ase_size_t name_len; int valid; }; -static struct __bvent __bvtab[] = +static global_t gtab[] = { { ASE_T("ARGC"), 4, 0 }, { ASE_T("ARGV"), 4, 0 }, @@ -316,7 +318,7 @@ static struct __bvent __bvtab[] = #define ADD_TOKEN_CHAR(awk,c) \ do { \ if (ase_str_ccat(&(awk)->token.name,(c)) == (ase_size_t)-1) { \ - ase_awk_seterror (awk, ASE_AWK_ENOMEM, (awk)->token.line, ASE_NULL); \ + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, (awk)->token.line, ASE_NULL); \ return -1; \ } \ } while (0) @@ -327,7 +329,7 @@ static struct __bvent __bvtab[] = do { \ if (MATCH(awk,TOKEN_EOF)) \ { \ - ase_awk_seterror ( \ + ase_awk_seterror_old ( \ awk, ASE_AWK_EENDSRC, \ (awk)->token.prev.line, ASE_NULL); \ } \ @@ -339,7 +341,7 @@ static struct __bvent __bvtab[] = msg, \ ASE_STR_LEN(&(awk)->token.name), \ ASE_STR_BUF(&(awk)->token.name)); \ - ase_awk_seterror ( \ + ase_awk_seterror_old ( \ awk, code, (awk)->token.line, \ (awk)->errmsg); \ } \ @@ -392,6 +394,13 @@ void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth) } } +const ase_char_t* ase_awk_getglobalname ( + ase_awk_t* awk, ase_size_t idx, ase_size_t* len) +{ + *len = gtab[idx].name_len; + return gtab[idx].name; +} + int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios) { int n; @@ -425,7 +434,7 @@ static int __parse (ase_awk_t* awk) { /* cannot open the source file. * it doesn't even have to call CLOSE */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESINOP, 0, ASE_T("cannot open the source input")); return -1; @@ -489,7 +498,7 @@ exit_parse: { /* this is to keep the earlier error above * that might be more critical than this */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESINCL, 0, ASE_T("cannot close the source input")); n = -1; @@ -543,7 +552,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk) { /* when the blockless pattern is supported * BEGIN and { should be located on the same line */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EBLKBEG, awk->token.prev.line, ASE_T("BEGIN not followed by a left bracket on the same line")); return ASE_NULL; @@ -551,7 +560,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk) if (!MATCH(awk,TOKEN_LBRACE)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELBRACE, awk->token.prev.line, ASE_T("BEGIN not followed by a left bracket")); return ASE_NULL; @@ -570,7 +579,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk) { /* when the blockless pattern is supported * END and { should be located on the same line */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EBLKEND, awk->token.prev.line, ASE_T("END not followed by a left bracket on the same line")); return ASE_NULL; @@ -578,7 +587,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk) if (!MATCH(awk,TOKEN_LBRACE)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELBRACE, awk->token.prev.line, ASE_T("END not followed by a left bracket")); return ASE_NULL; @@ -662,7 +671,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk) if (!MATCH(awk,TOKEN_LBRACE)) { ase_awk_clrpt (awk, ptn); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELBRACE, (MATCH(awk,TOKEN_EOF)? awk->token.prev.line: awk->token.line), ASE_T("not a valid start of a block")); @@ -703,7 +712,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) /* cannot find a valid identifier for a function name */ if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.prev.line, ASE_T("function definition without a name")); } @@ -716,7 +725,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_STR_LEN(&awk->token.name), ASE_STR_BUF(&awk->token.name)); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.line, awk->errmsg); } @@ -735,7 +744,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_T("built-in function '%.*s' redefined"), name_len, name); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EBFNRED, awk->token.line, awk->errmsg); @@ -751,7 +760,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_T("function '%.*s' redefined"), name_len, name); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EAFNRED, awk->token.line, awk->errmsg); @@ -772,7 +781,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_T("global variable '%.*s' redefined"), name_len, name); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EGBLRED, awk->token.line, awk->errmsg); @@ -784,7 +793,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) name_dup = ase_strxdup (name, name_len, &awk->prmfns.mmgr); if (name_dup == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, awk->token.line, ASE_NULL); return ASE_NULL; } @@ -802,7 +811,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) /* a function name is not followed by a left parenthesis */ ASE_AWK_FREE (awk, name_dup); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELPAREN, awk->token.line, ASE_T("function name not followed by a left parenthesis")); return ASE_NULL; @@ -842,13 +851,13 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); } else if (MATCH(awk,TOKEN_RPAREN)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.prev.line, ASE_T("premature end of parameter list")); } @@ -861,7 +870,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_STR_LEN(&awk->token.name), ASE_STR_BUF(&awk->token.name)); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.line, awk->errmsg); } @@ -887,7 +896,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_T("conflicting parameter '%.*s' with the function"), param_len, param); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EDUPPAR, awk->token.line, awk->errmsg); @@ -915,7 +924,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_T("duplicate parameter '%.*s'"), param_len, param); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EDUPPAR, awk->token.line, awk->errmsg); @@ -929,7 +938,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_AWK_FREE (awk, name_dup); ase_awk_tab_clear (&awk->parse.params); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EPARTM, awk->token.line, ASE_T("too many parameters in the parameter list")); @@ -943,7 +952,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_AWK_FREE (awk, name_dup); ase_awk_tab_clear (&awk->parse.params); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, awk->token.line, ASE_NULL); return ASE_NULL; @@ -992,7 +1001,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); } @@ -1005,7 +1014,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_STR_LEN(&awk->token.name), ASE_STR_BUF(&awk->token.name)); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELBRACE, awk->token.line, awk->errmsg); } @@ -1041,7 +1050,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ASE_AWK_FREE (awk, name_dup); ase_awk_clrpt (awk, body); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, awk->token.line, ASE_NULL); return ASE_NULL; } @@ -1058,7 +1067,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) ase_awk_clrpt (awk, body); ASE_AWK_FREE (awk, afn); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, awk->token.line, ASE_NULL); return ASE_NULL; } @@ -1123,7 +1132,7 @@ static ase_awk_chain_t* __parse_pattern_block ( { ase_awk_clrpt (awk, nde); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1194,7 +1203,7 @@ static ase_awk_nde_t* __parse_block ( ase_awk_tab_getsize(&awk->parse.locals) - nlocals); if (head != ASE_NULL) ase_awk_clrpt (awk, head); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); return ASE_NULL; @@ -1242,7 +1251,7 @@ static ase_awk_nde_t* __parse_block ( ase_awk_tab_getsize(&awk->parse.locals)-nlocals); ase_awk_clrpt (awk, head); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1288,7 +1297,7 @@ static ase_awk_nde_t* __parse_block_dc ( if (awk->parse.depth.cur.block >= awk->parse.depth.max.block) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ERECUR, awk->token.prev.line, ASE_T("block nested too deeply")); return ASE_NULL; @@ -1303,7 +1312,7 @@ static ase_awk_nde_t* __parse_block_dc ( static ase_awk_t* __add_builtin_globals (ase_awk_t* awk) { - struct __bvent* p = __bvtab; + global_t* p = gtab; ase_awk_t* tmp; awk->tree.nbglobals = 0; @@ -1348,7 +1357,7 @@ static ase_awk_t* __add_global ( ASE_T("built-in function '%.*s' redefined"), len, name); - ase_awk_seterror (awk, ASE_AWK_EBFNRED, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_EBFNRED, line, awk->errmsg); return ASE_NULL; } @@ -1362,7 +1371,7 @@ static ase_awk_t* __add_global ( ASE_T("function '%.*s' redefined"), len, name); - ase_awk_seterror (awk, ASE_AWK_EAFNRED, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_EAFNRED, line, awk->errmsg); return ASE_NULL; } } @@ -1377,20 +1386,20 @@ static ase_awk_t* __add_global ( ASE_T("duplicate global variable '%.*s'"), len, name); - ase_awk_seterror (awk, ASE_AWK_EDUPGBL, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_EDUPGBL, line, awk->errmsg); return ASE_NULL; } } if (ase_awk_tab_getsize(&awk->parse.globals) >= ASE_AWK_MAX_GLOBALS) { - ase_awk_seterror (awk, ASE_AWK_EGBLTM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_EGBLTM, line, ASE_NULL); return ASE_NULL; } if (ase_awk_tab_add (&awk->parse.globals, name, len) == (ase_size_t)-1) { - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1405,7 +1414,7 @@ static ase_awk_t* __collect_globals (ase_awk_t* awk) { if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); return ASE_NULL; @@ -1419,7 +1428,7 @@ static ase_awk_t* __collect_globals (ase_awk_t* awk) ASE_STR_LEN(&awk->token.name), ASE_STR_BUF(&awk->token.name)); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.line, awk->errmsg); return ASE_NULL; @@ -1464,7 +1473,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) { if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); return ASE_NULL; @@ -1478,7 +1487,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) ASE_STR_LEN(&awk->token.name), ASE_STR_BUF(&awk->token.name)); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EIDENT, awk->token.line, awk->errmsg); return ASE_NULL; @@ -1501,7 +1510,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) ASE_T("built-in function '%.*s' redefined"), local_len, local); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EBFNRED, awk->token.line, awk->errmsg); return ASE_NULL; @@ -1517,7 +1526,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) ASE_T("function '%.*s' redefined"), local_len, local); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EAFNRED, awk->token.line, awk->errmsg); return ASE_NULL; @@ -1534,7 +1543,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) ASE_T("parameter '%.*s' redefined"), local_len, local); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EPARRED, awk->token.line, awk->errmsg); return ASE_NULL; @@ -1551,14 +1560,14 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) ASE_T("duplicate local variable '%.*s'"), local_len, local); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EDUPLCL, awk->token.line, awk->errmsg); return ASE_NULL; } if (ase_awk_tab_getsize(&awk->parse.locals) >= ASE_AWK_MAX_LOCALS) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELCLTM, awk->token.line, ASE_NULL); return ASE_NULL; } @@ -1566,7 +1575,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals) if (ase_awk_tab_add ( &awk->parse.locals, local, local_len) == (ase_size_t)-1) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, awk->token.line, ASE_NULL); return ASE_NULL; } @@ -1602,7 +1611,7 @@ static ase_awk_nde_t* __parse_statement (ase_awk_t* awk, ase_size_t line) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_t)); if (nde == ASE_NULL) { - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1751,13 +1760,13 @@ static ase_awk_nde_t* __parse_statement_nb (ase_awk_t* awk, ase_size_t line) if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); } else { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESCOLON, awk->token.prev.line, ASE_T("statement not terminated with a semicolon")); } @@ -1781,7 +1790,7 @@ static ase_awk_nde_t* __parse_expression (ase_awk_t* awk, ase_size_t line) if (awk->parse.depth.max.expr > 0 && awk->parse.depth.cur.expr >= awk->parse.depth.max.expr) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ERECUR, line, ASE_T("expression nested too deeply")); return ASE_NULL; @@ -1814,7 +1823,7 @@ static ase_awk_nde_t* __parse_expression0 (ase_awk_t* awk, ase_size_t line) if (!__is_var(x) && x->type != ASE_AWK_NDE_POS) { ase_awk_clrpt (awk, x); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EASSIGN, line, ASE_T("invalid assignment expression")); return ASE_NULL; @@ -1841,7 +1850,7 @@ static ase_awk_nde_t* __parse_expression0 (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, x); ase_awk_clrpt (awk, y); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1880,13 +1889,13 @@ static ase_awk_nde_t* __parse_basic_expr (ase_awk_t* awk, ase_size_t line) { if (MATCH(awk,TOKEN_EOF)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSRC, awk->token.prev.line, ASE_NULL); } else { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ECOLON, awk->token.line, ASE_NULL); } @@ -1911,7 +1920,7 @@ static ase_awk_nde_t* __parse_basic_expr (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, n1); ase_awk_clrpt (awk, n2); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -1977,7 +1986,7 @@ static ase_awk_nde_t* __parse_binary_expr ( ase_awk_clrpt (awk, right); ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2060,7 +2069,7 @@ static ase_awk_nde_t* __parse_in (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, right); ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOTVAR, line2, ASE_T("right-hand side of the 'in' operator not a variable")); return ASE_NULL; @@ -2073,7 +2082,7 @@ static ase_awk_nde_t* __parse_in (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, right); ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2177,7 +2186,7 @@ static ase_awk_nde_t* __parse_bitwise_or_with_extio (ase_awk_t* awk, ase_size_t { ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2200,7 +2209,7 @@ static ase_awk_nde_t* __parse_bitwise_or_with_extio (ase_awk_t* awk, ase_size_t ase_awk_clrpt (awk, left); /* TODO: support coprocess */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EGETLINE, line, ASE_T("coprocess not supported by getline")); return ASE_NULL; @@ -2220,7 +2229,7 @@ static ase_awk_nde_t* __parse_bitwise_or_with_extio (ase_awk_t* awk, ase_size_t ase_awk_clrpt (awk, right); ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2337,7 +2346,7 @@ static ase_awk_nde_t* __parse_concat (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, left); ase_awk_clrpt (awk, right); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2401,7 +2410,7 @@ static ase_awk_nde_t* __parse_unary (ase_awk_t* awk, ase_size_t line) if (awk->parse.depth.max.expr > 0 && awk->parse.depth.cur.expr >= awk->parse.depth.max.expr) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ERECUR, awk->token.line, ASE_T("expression nested too deeply")); return ASE_NULL; @@ -2417,7 +2426,7 @@ static ase_awk_nde_t* __parse_unary (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2461,7 +2470,7 @@ static ase_awk_nde_t* __parse_unary_exp (ase_awk_t* awk, ase_size_t line) if (awk->parse.depth.max.expr > 0 && awk->parse.depth.cur.expr >= awk->parse.depth.max.expr) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ERECUR, awk->token.line, ASE_T("expression nested too deeply")); return ASE_NULL; @@ -2477,7 +2486,7 @@ static ase_awk_nde_t* __parse_unary_exp (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2520,7 +2529,7 @@ static ase_awk_nde_t* __parse_increment (ase_awk_t* awk, ase_size_t line) * not allowed */ ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELVALUE, line, ASE_T("both prefix and postfix increment/decrement operator present")); return ASE_NULL; @@ -2551,7 +2560,7 @@ static ase_awk_nde_t* __parse_increment (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, left); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2580,7 +2589,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_int_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2623,7 +2632,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_real_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2666,7 +2675,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_str_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2682,7 +2691,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) if (nde->buf == ASE_NULL) { ASE_AWK_FREE (awk, nde); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2713,7 +2722,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_rex_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2730,7 +2739,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) if (nde->buf == ASE_NULL) { ASE_AWK_FREE (awk, nde); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2744,7 +2753,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) ASE_AWK_FREE (awk, nde->buf); ASE_AWK_FREE (awk, nde); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, errnum, line, ASE_NULL); return ASE_NULL; } @@ -2774,7 +2783,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) if (nde == ASE_NULL) { ase_awk_clrpt (awk, prim); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2869,7 +2878,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, nde); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2926,7 +2935,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) if (var != ASE_NULL) ase_awk_clrpt (awk, var); if (in != ASE_NULL) ase_awk_clrpt (awk, in); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -2943,7 +2952,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) } /* valid expression introducer is expected */ - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EEXPRES, (MATCH(awk,TOKEN_EOF)? awk->token.prev.line: line), ASE_T("invalid expression")); @@ -2964,7 +2973,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line) &awk->prmfns.mmgr); if (name_dup == ASE_NULL) { - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } name_len = ASE_STR_LEN(&awk->token.name); @@ -2994,7 +3003,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line) ASE_AWK_FREE (awk, name_dup); - ase_awk_seterror (awk, ASE_AWK_ELPAREN, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_ELPAREN, line, awk->errmsg); return ASE_NULL; } @@ -3030,7 +3039,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line) if (nde == ASE_NULL) { ASE_AWK_FREE (awk, name_dup); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3108,7 +3117,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line) ASE_AWK_FREE (awk, name_dup); ASE_AWK_FREE (awk, nde); - ase_awk_seterror (awk, ASE_AWK_EUNDEF, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_EUNDEF, line, awk->errmsg); return ASE_NULL; } } @@ -3173,7 +3182,7 @@ static ase_awk_nde_t* __parse_hashidx ( if (nde == ASE_NULL) { ase_awk_clrpt (awk, idx); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3246,7 +3255,7 @@ static ase_awk_nde_t* __parse_hashidx ( awk->prmfns.misc.custom_data, awk->errmsg, ASE_COUNTOF(awk->errmsg), ASE_T("undefined identifier '%.*s'"), name_len, name); - ase_awk_seterror (awk, ASE_AWK_EUNDEF, line, awk->errmsg); + ase_awk_seterror_old (awk, ASE_AWK_EUNDEF, line, awk->errmsg); return ASE_NULL; } @@ -3322,7 +3331,7 @@ static ase_awk_nde_t* __parse_fncall ( { if (head != ASE_NULL) ase_awk_clrpt (awk, head); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3428,7 +3437,7 @@ static ase_awk_nde_t* __parse_if (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, then_part); ase_awk_clrpt (awk, test); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3489,7 +3498,7 @@ static ase_awk_nde_t* __parse_while (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, body); ase_awk_clrpt (awk, test); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3564,7 +3573,7 @@ static ase_awk_nde_t* __parse_for (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, init); ase_awk_clrpt (awk, body); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3672,7 +3681,7 @@ static ase_awk_nde_t* __parse_for (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, incr); ase_awk_clrpt (awk, body); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3762,7 +3771,7 @@ static ase_awk_nde_t* __parse_dowhile (ase_awk_t* awk, ase_size_t line) ase_awk_clrpt (awk, body); ase_awk_clrpt (awk, test); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3783,7 +3792,7 @@ static ase_awk_nde_t* __parse_break (ase_awk_t* awk, ase_size_t line) ASE_AWK_ASSERT (awk, awk->token.prev.type == TOKEN_BREAK); if (awk->parse.depth.cur.loop <= 0) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EBREAK, line, ASE_T("break statement outside a loop")); return ASE_NULL; @@ -3793,7 +3802,7 @@ static ase_awk_nde_t* __parse_break (ase_awk_t* awk, ase_size_t line) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_break_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3812,7 +3821,7 @@ static ase_awk_nde_t* __parse_continue (ase_awk_t* awk, ase_size_t line) ASE_AWK_ASSERT (awk, awk->token.prev.type == TOKEN_CONTINUE); if (awk->parse.depth.cur.loop <= 0) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ECONTINUE, line, ASE_T("continue statement outside a loop")); return ASE_NULL; @@ -3822,7 +3831,7 @@ static ase_awk_nde_t* __parse_continue (ase_awk_t* awk, ase_size_t line) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_continue_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3845,7 +3854,7 @@ static ase_awk_nde_t* __parse_return (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_return_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3884,7 +3893,7 @@ static ase_awk_nde_t* __parse_exit (ase_awk_t* awk, ase_size_t line) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_exit_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3920,14 +3929,14 @@ static ase_awk_nde_t* __parse_next (ase_awk_t* awk, ase_size_t line) if (awk->parse.id.block == PARSE_BEGIN_BLOCK) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENEXT, line, ASE_T("next statement in BEGIN block")); return ASE_NULL; } if (awk->parse.id.block == PARSE_END_BLOCK) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENEXT, line, ASE_T("next statement in END block")); return ASE_NULL; @@ -3937,7 +3946,7 @@ static ase_awk_nde_t* __parse_next (ase_awk_t* awk, ase_size_t line) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_next_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -3954,14 +3963,14 @@ static ase_awk_nde_t* __parse_nextfile (ase_awk_t* awk, ase_size_t line, int out if (awk->parse.id.block == PARSE_BEGIN_BLOCK) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENEXTFILE, line, ASE_T("nextfile statement in BEGIN block")); return ASE_NULL; } if (awk->parse.id.block == PARSE_END_BLOCK) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENEXTFILE, line, ASE_T("nextfile statement in END block")); return ASE_NULL; @@ -3971,7 +3980,7 @@ static ase_awk_nde_t* __parse_nextfile (ase_awk_t* awk, ase_size_t line, int out ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_nextfile_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -4006,7 +4015,7 @@ static ase_awk_nde_t* __parse_delete (ase_awk_t* awk, ase_size_t line) /* a normal identifier is expected */ ase_awk_clrpt (awk, var); - ase_awk_seterror (awk, ASE_AWK_EIDENT, line, + ase_awk_seterror_old (awk, ASE_AWK_EIDENT, line, ASE_T("'delete' not followed by a normal variable")); return ASE_NULL; } @@ -4015,7 +4024,7 @@ static ase_awk_nde_t* __parse_delete (ase_awk_t* awk, ase_size_t line) awk, ASE_SIZEOF(ase_awk_nde_delete_t)); if (nde == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -4155,7 +4164,7 @@ static ase_awk_nde_t* __parse_print (ase_awk_t* awk, ase_size_t line, int type) if (args != ASE_NULL) ase_awk_clrpt (awk, args); if (out != ASE_NULL) ase_awk_clrpt (awk, out); - ase_awk_seterror (awk, ASE_AWK_ENOMEM, line, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, line, ASE_NULL); return ASE_NULL; } @@ -4166,7 +4175,7 @@ static ase_awk_nde_t* __parse_print (ase_awk_t* awk, ase_size_t line, int type) if (type == ASE_AWK_NDE_PRINTF && args == ASE_NULL) { if (out != ASE_NULL) ase_awk_clrpt (awk, out); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EPRINTFARG, line, ASE_T("printf not followed by any arguments")); return ASE_NULL; @@ -4248,7 +4257,7 @@ static int __get_token (ase_awk_t* awk) /* else { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELXCHR, awk->token.line, ASE_T("floating point not followed by any valid digits")); return -1; @@ -4634,7 +4643,7 @@ static int __get_token (ase_awk_t* awk) awk->prmfns.misc.custom_data, awk->errmsg, ASE_COUNTOF(awk->errmsg), ASE_T("invalid character '%c'"), c); - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELXCHR, awk->token.line, awk->errmsg); return -1; } @@ -4781,7 +4790,7 @@ static int __get_string ( if (c == ASE_CHAR_EOF) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDSTR, awk->token.line, ASE_T("string not closed with a quote")); return -1; @@ -4942,7 +4951,7 @@ static int __get_char (ase_awk_t* awk) awk->src.shared.buf, ASE_COUNTOF(awk->src.shared.buf)); if (n <= -1) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESINRD, 0, ASE_T("cannot read the source input")); return -1; @@ -4974,7 +4983,7 @@ static int __unget_char (ase_awk_t* awk, ase_cint_t c) { if (awk->src.lex.ungotc_count >= ASE_COUNTOF(awk->src.lex.ungotc)) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ELXUNG, awk->src.lex.line, ASE_NULL); return -1; } @@ -5022,7 +5031,7 @@ static int __skip_comment (ase_awk_t* awk) GET_CHAR_TO (awk, c); if (c == ASE_CHAR_EOF) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDCMT, awk->src.lex.line, ASE_T("comment not properly closed")); return -1; @@ -5033,7 +5042,7 @@ static int __skip_comment (ase_awk_t* awk) GET_CHAR_TO (awk, c); if (c == ASE_CHAR_EOF) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_EENDCMT, awk->src.lex.line, ASE_T("comment not properly closed")); return -1; @@ -5145,7 +5154,7 @@ static int __deparse (ase_awk_t* awk) ASE_AWK_IO_OPEN, awk->src.ios.custom_data, ASE_NULL, 0); if (op <= -1) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESOUTOP, 0, ASE_T("cannot open the source output")); return -1; @@ -5171,7 +5180,7 @@ static int __deparse (ase_awk_t* awk) #define EXIT_DEPARSE(num) \ do { \ n = -1; \ - ase_awk_seterror (awk, num, 0, ASE_NULL); \ + ase_awk_seterror_old (awk, num, 0, ASE_NULL); \ goto exit_deparse; \ } while(0) @@ -5320,7 +5329,7 @@ exit_deparse: { if (n == 0) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ESOUTCL, 0, ASE_T("cannot close the source output")); n = -1; diff --git a/ase/awk/parse.h b/ase/awk/parse.h index 21b35dd4..83216a8e 100644 --- a/ase/awk/parse.h +++ b/ase/awk/parse.h @@ -1,5 +1,5 @@ /* - * $Id: parse.h,v 1.4 2007-02-03 10:47:41 bacon Exp $ + * $Id: parse.h,v 1.5 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -19,6 +19,9 @@ int ase_awk_putsrcstr (ase_awk_t* awk, const ase_char_t* str); int ase_awk_putsrcstrx ( ase_awk_t* awk, const ase_char_t* str, ase_size_t len); +const ase_char_t* ase_awk_getglobalname ( + ase_awk_t* awk, ase_size_t idx, ase_size_t* len); + #ifdef __cplusplus } #endif diff --git a/ase/awk/rec.c b/ase/awk/rec.c index a8a860d6..7a39e35d 100644 --- a/ase/awk/rec.c +++ b/ase/awk/rec.c @@ -1,5 +1,5 @@ /* - * $Id: rec.c,v 1.15 2007-02-23 08:17:49 bacon Exp $ + * $Id: rec.c,v 1.16 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -32,7 +32,7 @@ int ase_awk_setrec ( if (ase_str_ncpy (&run->inrec.line, str, len) == (ase_size_t)-1) { ase_awk_clrrec (run, ase_false); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -42,7 +42,7 @@ int ase_awk_setrec ( if (v == ASE_NULL) { ase_awk_clrrec (run, ase_false); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -56,7 +56,7 @@ int ase_awk_setrec ( { errnum = run->errnum; ase_awk_clrrec (run, ase_false); - ase_awk_setrunerror (run, errnum, 0, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, 0, ASE_NULL); return -1; } } @@ -66,7 +66,7 @@ int ase_awk_setrec ( { errnum = run->errnum; ase_awk_clrrec (run, ase_false); - ase_awk_setrunerror (run, errnum, 0, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, 0, ASE_NULL); return -1; } @@ -77,7 +77,7 @@ int ase_awk_setrec ( if (v == ASE_NULL) { ase_awk_clrrec (run, ase_false); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -143,7 +143,7 @@ static int __split_record (ase_awk_run_t* run) { if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free); - ase_awk_setrunerror (run, errnum, 0, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, 0, ASE_NULL); return -1; } } @@ -172,7 +172,7 @@ static int __split_record (ase_awk_run_t* run) if (tmp == ASE_NULL) { if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -201,7 +201,7 @@ static int __split_record (ase_awk_run_t* run) { if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free); - ase_awk_setrunerror (run, errnum, 0, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, 0, ASE_NULL); return -1; } } @@ -217,7 +217,7 @@ static int __split_record (ase_awk_run_t* run) if (run->inrec.flds[run->inrec.nflds].val == ASE_NULL) { if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -234,7 +234,7 @@ static int __split_record (ase_awk_run_t* run) v = ase_awk_makeintval (run, (ase_long_t)nflds); if (v == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -312,7 +312,7 @@ static int __recomp_record_fields ( ASE_SIZEOF(*run->inrec.flds) * max); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -323,7 +323,7 @@ static int __recomp_record_fields ( run->awk, ASE_SIZEOF(*run->inrec.flds) * max); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -352,7 +352,7 @@ static int __recomp_record_fields ( run->global.ofs.ptr, run->global.ofs.len) == (ase_size_t)-1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -370,7 +370,7 @@ static int __recomp_record_fields ( if (ase_str_ncat ( &run->inrec.line, str, len) == (ase_size_t)-1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -378,7 +378,7 @@ static int __recomp_record_fields ( tmp = ase_awk_makestrval (run, str,len); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -400,7 +400,7 @@ static int __recomp_record_fields ( if (ase_str_cat ( &run->inrec.line, ASE_T("")) == (ase_size_t)-1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -427,7 +427,7 @@ static int __recomp_record_fields ( if (ase_str_ncat (&run->inrec.line, tmp->buf, tmp->len) == (ase_size_t)-1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -441,7 +441,7 @@ static int __recomp_record_fields ( v = ase_awk_makeintval (run, (ase_long_t)max); if (v == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } diff --git a/ase/awk/run.c b/ase/awk/run.c index 5c4d8b15..e2ec3de0 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.333 2007-03-02 10:12:41 bacon Exp $ + * $Id: run.c,v 1.334 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -247,18 +247,24 @@ static int __set_global ( if (var != ASE_NULL) { - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("map '%.*s' not assignable with a scalar"), - var->id.name_len, var->id.name); - ase_awk_setrunerror ( - run, ASE_AWK_EMAPTOSCALAR, var->line, run->errmsg); + /* global variable */ + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; + + ase_awk_setrunerror (run, + ASE_AWK_EMAPTOSCALAR, var->line, &errarg, 1); } else { - ase_awk_setrunerror (run, ASE_AWK_EMAPTOSCALAR, 0, - ASE_T("map not assignable with a scalar")); + /* ase_awk_setglobal has been called */ + ase_cstr_t errarg; + + errarg.ptr = ase_awk_getglobalname ( + run->awk, idx, &errarg.len); + ase_awk_setrunerror (run, + ASE_AWK_EMAPTOSCALAR, var->line, &errarg, 1); } return -1; } @@ -269,7 +275,7 @@ static int __set_global ( idx != ASE_AWK_GLOBAL_ARGV) { /* TODO: better error code */ - ase_awk_setrunerror (run, ASE_AWK_ESCALARTOMAP, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ESCALARTOMAP, 0, ASE_NULL); return -1; } @@ -287,7 +293,7 @@ static int __set_global ( if (convfmt_ptr[i] == ASE_T('\0')) { ASE_AWK_FREE (run->awk, convfmt_ptr); - ase_awk_setrunerror (run, ASE_AWK_ECONVFMTCHAR, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ECONVFMTCHAR, 0, ASE_NULL); return -1; } } @@ -387,7 +393,7 @@ static int __set_global ( if (ofmt_ptr[i] == ASE_T('\0')) { ASE_AWK_FREE (run->awk, ofmt_ptr); - ase_awk_setrunerror (run, ASE_AWK_ECONVFMTCHAR, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ECONVFMTCHAR, 0, ASE_NULL); return -1; } } @@ -512,7 +518,7 @@ int ase_awk_setfilename ( tmp = ase_awk_makestrval (run, name, len); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -538,7 +544,7 @@ int ase_awk_setofilename ( tmp = ase_awk_makestrval (run, name, len); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -567,60 +573,6 @@ ase_awk_map_t* ase_awk_getrunnamedvarmap (ase_awk_run_t* awk) return &awk->named; } -int ase_awk_getrunerrnum (ase_awk_run_t* run) -{ - return run->errnum; -} - -ase_size_t ase_awk_getrunerrlin (ase_awk_run_t* run) -{ - return run->errlin; -} - -const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run) -{ - if (run->errmsg[0] == ASE_T('\0')) - return ase_awk_geterrstr (run->errnum); - - return run->errmsg; -} - -void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum) -{ - run->errnum = errnum; - run->errlin = 0; - run->errmsg[0] = ASE_T('\0'); -} - -void ase_awk_getrunerror ( - ase_awk_run_t* run, int* errnum, - ase_size_t* errlin, const ase_char_t** errmsg) -{ - if (errnum != ASE_NULL) *errnum = run->errnum; - if (errlin != ASE_NULL) *errlin = run->errlin; - if (errmsg != ASE_NULL) - { - if (run->errmsg[0] == ASE_T('\0')) - *errmsg = ase_awk_geterrstr (run->errnum); - else - *errmsg = run->errmsg; - } -} - -void ase_awk_setrunerror ( - ase_awk_run_t* run, int errnum, - ase_size_t errlin, const ase_char_t* errmsg) -{ - run->errnum = errnum; - run->errlin = errlin; - - if (errmsg == ASE_NULL) run->errmsg[0] = ASE_T('\0'); - else if (errmsg != run->errmsg) - { - ase_strxcpy (run->errmsg, ASE_COUNTOF(run->errmsg), errmsg); - } -} - int ase_awk_run (ase_awk_t* awk, const ase_char_t* main, ase_awk_runios_t* runios, @@ -632,7 +584,7 @@ int ase_awk_run (ase_awk_t* awk, int n, errnum; /* clear the awk error code */ - ase_awk_seterror (awk, ASE_AWK_ENOERR, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOERR, 0, ASE_NULL); /* check if the code has ever been parsed */ if (awk->tree.nglobals == 0 && @@ -642,7 +594,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 (awk, ASE_AWK_ENOPER, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOPER, 0, ASE_NULL); return -1; } @@ -652,7 +604,7 @@ int ase_awk_run (ase_awk_t* awk, { /* if it fails, the failure is reported thru * the awk object */ - ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_seterror_old (awk, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -664,7 +616,7 @@ int ase_awk_run (ase_awk_t* awk, { /* if it fails, the failure is still reported thru * the awk object */ - ase_awk_seterror (awk, errnum, 0, ASE_NULL); + ase_awk_seterror_old (awk, errnum, 0, ASE_NULL); /*__del_run (awk, run);*/ ASE_AWK_FREE (awk, run); @@ -690,12 +642,12 @@ int ase_awk_run (ase_awk_t* awk, * is updated with the run's error number */ if (runcbs == ASE_NULL) { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, run->errnum, run->errlin, run->errmsg); } else { - ase_awk_seterror ( + ase_awk_seterror_old ( awk, ASE_AWK_ERUNTIME, 0, ASE_NULL); } } @@ -722,49 +674,10 @@ int ase_awk_run (ase_awk_t* awk, return n; } -int ase_awk_stop (ase_awk_t* awk, ase_awk_run_t* run) +int ase_awk_stop (ase_awk_run_t* run) { - /* - ase_awk_run_t* r; - int n = 0; - */ - - if (ase_awk_getrunawk(run) != awk) - { - awk->errnum = ASE_AWK_EINVAL; - return -1; - } - - run->exit_level = EXIT_ABORT; return 0; - -#if 0 - ASE_AWK_LOCK (awk); - - /* check if the run handle given is valid */ - for (r = awk->run.ptr; r != ASE_NULL; r = r->next) - { - if (r == run) - { - ASE_AWK_ASSERT (run->awk, r->awk == awk); - r->exit_level = EXIT_ABORT; - break; - } - } - - if (r == ASE_NULL) - { - /* if it is not found in the awk's run list, - * it is not a valid handle */ - awk->errnum = ASE_AWK_EINVAL; - n = -1; - } - - ASE_AWK_UNLOCK (awk); - - return n; -#endif } static void __free_namedval (void* run, void* val) @@ -1018,7 +931,7 @@ static int __build_runarg ( v_argv = ase_awk_makemapval (run); if (v_argv == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } ase_awk_refupval (run, v_argv); @@ -1032,7 +945,7 @@ static int __build_runarg ( if (v_tmp == ASE_NULL) { ase_awk_refdownval (run, v_argv); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1056,7 +969,7 @@ static int __build_runarg ( * map will be freeed when v_argv is freed */ ase_awk_refdownval (run, v_argv); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -1066,7 +979,7 @@ static int __build_runarg ( if (v_argc == ASE_NULL) { ase_awk_refdownval (run, v_argv); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1121,7 +1034,7 @@ static int __update_fnr (ase_awk_run_t* run, ase_size_t fnr) tmp = ase_awk_makeintval (run, fnr); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1176,7 +1089,7 @@ static int __set_globals_to_default (ase_awk_run_t* run) tmp = ase_awk_makestrval0 (run, gtab[i].str); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -1230,7 +1143,7 @@ static int run_main ( * the successful __raw_push. it is ok because * the values pushed so far are all ase_awk_val_nil */ run->stack_top = saved_stack_top; - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -1306,7 +1219,7 @@ static int run_main ( __cleanup_globals (run); run->stack_top = saved_stack_top; - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1329,7 +1242,7 @@ static int run_main ( __cleanup_globals (run); run->stack_top = saved_stack_top; - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1373,7 +1286,7 @@ static int run_main ( __cleanup_globals (run); __raw_pop_times (run, run->awk->tree.nglobals); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1384,7 +1297,7 @@ static int run_main ( __cleanup_globals (run); __raw_pop_times (run, run->awk->tree.nglobals); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1396,7 +1309,7 @@ static int run_main ( __cleanup_globals (run); __raw_pop_times (run, run->awk->tree.nglobals); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1408,7 +1321,7 @@ static int run_main ( __cleanup_globals (run); __raw_pop_times (run, run->awk->tree.nglobals); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -1648,7 +1561,7 @@ static int __run_block (ase_awk_run_t* run, ase_awk_nde_blk_t* nde) if (run->depth.max.block > 0 && run->depth.cur.block >= run->depth.max.block) { - ase_awk_setrunerror (run, ASE_AWK_ERECUR, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ERECUR, nde->line, ASE_NULL); return -1;; } @@ -1681,7 +1594,7 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde) if (run->errnum == ASE_AWK_EIOIMPL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ECOUTDT, nde->line, ASE_NULL); } return -1; @@ -1696,7 +1609,7 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde) if (run->errnum == ASE_AWK_EIOIMPL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ECOUTDT, nde->line, ASE_NULL); } return -1; @@ -2095,7 +2008,7 @@ static int __walk_foreach (ase_awk_pair_t* pair, void* arg) w->run, pair->key, ase_strlen(pair->key)); if (str == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( w->run, ASE_AWK_ENOMEM, w->var->line, ASE_NULL); return -1; } @@ -2142,7 +2055,7 @@ static int __run_foreach (ase_awk_run_t* run, ase_awk_nde_foreach_t* nde) { ase_awk_refdownval (run, rv); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTMAP, test->right->line, ASE_T("right-hand side of the 'in' operator not a map")); return -1; @@ -2222,14 +2135,14 @@ static int __run_next (ase_awk_run_t* run, ase_awk_nde_next_t* nde) * check that explicitly */ if (run->active_block == (ase_awk_nde_blk_t*)run->awk->tree.begin) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENEXTCALL, nde->line, ASE_T("next called from the BEGIN block")); return -1; } else if (run->active_block == (ase_awk_nde_blk_t*)run->awk->tree.end) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENEXTCALL, nde->line, ASE_T("next called from the END block")); return -1; @@ -2246,14 +2159,14 @@ static int __run_nextinfile (ase_awk_run_t* run, ase_awk_nde_nextfile_t* nde) /* normal nextfile statement */ if (run->active_block == (ase_awk_nde_blk_t*)run->awk->tree.begin) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENEXTCALL, nde->line, ASE_T("nextfile called from the BEGIN block")); return -1; } else if (run->active_block == (ase_awk_nde_blk_t*)run->awk->tree.end) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENEXTCALL, nde->line, ASE_T("nextfile called from the END block")); return -1; @@ -2265,7 +2178,7 @@ static int __run_nextinfile (ase_awk_run_t* run, ase_awk_nde_nextfile_t* nde) if (run->errnum == ASE_AWK_EIOIMPL) run->errnum = ASE_AWK_ECINNX; - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2279,7 +2192,7 @@ static int __run_nextinfile (ase_awk_run_t* run, ase_awk_nde_nextfile_t* nde) if (__update_fnr (run, 0) == -1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2299,7 +2212,7 @@ static int __run_nextoutfile (ase_awk_run_t* run, ase_awk_nde_nextfile_t* nde) if (run->errnum == ASE_AWK_EIOIMPL) run->errnum = ASE_AWK_ECOUTNX; - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2350,7 +2263,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) tmp = ase_awk_makemapval (run); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return -1; } @@ -2361,7 +2274,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) ase_awk_refupval (run, tmp); ase_awk_refdownval (run, tmp); - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, var->line, ASE_NULL); return -1; } @@ -2380,14 +2293,12 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) if (val->type != ASE_AWK_VAL_MAP) { - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("'%.*s' not deletable"), - var->id.name_len, var->id.name); + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; ase_awk_setrunerror ( - run, ASE_AWK_ENOTDEL, var->line, - run->errmsg); + run, ASE_AWK_ENOTDEL, var->line, &errarg, 1); return -1; } @@ -2411,7 +2322,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) if (key == ASE_NULL) { - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, run->errnum, var->line, ASE_NULL); return -1; } @@ -2454,7 +2365,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) tmp = ase_awk_makemapval (run); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return -1; } @@ -2469,7 +2380,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) { ase_awk_refupval (run, tmp); ase_awk_refdownval (run, tmp); - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, run->errnum, var->line, ASE_NULL); return -1; } @@ -2492,14 +2403,13 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) if (val->type != ASE_AWK_VAL_MAP) { - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("'%.*s' not deletable"), - var->id.name_len, var->id.name); + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; + ase_awk_setrunerror ( - run, ASE_AWK_ENOTDEL, var->line, - run->errmsg); + run, ASE_AWK_ENOTDEL, var->line, &errarg, 1); return -1; } @@ -2525,7 +2435,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) if (key == ASE_NULL) { - ase_awk_setrunerror (run, + ase_awk_setrunerror_old (run, run->errnum, var->line, ASE_NULL); return -1; } @@ -2544,7 +2454,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) ASE_AWK_ASSERTX (run->awk, !"should never happen - wrong target for delete", "the delete statement cannot be called with other nodes than the variables such as a named variable, a named indexed variable, etc"); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EINTERN, var->line, ASE_T("delete statement called with a wrong target")); return -1; @@ -2582,7 +2492,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) if (out == ASE_NULL) { ase_awk_refdownval (run, v); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2592,7 +2502,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { /* the destination name is empty */ ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EIONAME, nde->line, ASE_T("destination name empty in print")); return -1; @@ -2606,7 +2516,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { /* if so, it skips writing */ ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EIONAME, nde->line, ASE_T("destination name containing a null character in print")); return -1; @@ -2629,7 +2539,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) if (n <= -1 /*&& run->errnum != ASE_AWK_EIOIMPL*/) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2659,7 +2569,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) if (n <= -1 /*&& run->errnum != ASE_AWK_EIOIMPL*/) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2678,7 +2588,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); ase_awk_refdownval (run, v); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2694,7 +2604,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde) if (n <= -1 /*&& run->errnum != ASE_AWK_EIOIMPL*/) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror (run, run->errnum, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2732,7 +2642,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde) if (out == ASE_NULL) { ase_awk_refdownval (run, v); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2742,7 +2652,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { /* the output destination name is empty. */ ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EIONAME, nde->line, ASE_T("destination name empty in printf")); return -1; @@ -2755,7 +2665,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde) /* the output destination name contains a null * character. */ ASE_AWK_FREE (run->awk, out); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EIONAME, nde->line, ASE_T("destination name containing a null character in printf")); return -1; @@ -2796,7 +2706,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); ase_awk_refdownval (run, v); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2812,7 +2722,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde) { if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out); ase_awk_refdownval (run, v); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return -1; } @@ -2880,7 +2790,7 @@ static ase_awk_val_t* __eval_expression (ase_awk_run_t* run, ase_awk_nde_t* nde) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, errnum, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, nde->line, ASE_NULL); return ASE_NULL; } } @@ -2890,7 +2800,7 @@ static ase_awk_val_t* __eval_expression (ase_awk_run_t* run, ase_awk_nde_t* nde) v = ase_awk_makeintval (run, (n != 0)); if (v == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } } @@ -2940,7 +2850,7 @@ static ase_awk_val_t* __eval_group (ase_awk_run_t* run, ase_awk_nde_t* nde) /* __eval_binop_in evaluates the ASE_AWK_NDE_GRP specially. * so this function should never be reached. */ ASE_AWK_ASSERT (run->awk, !"should never happen - NDE_GRP only for in"); - ase_awk_setrunerror (run, ASE_AWK_EINTERN, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EINTERN, nde->line, ASE_NULL); return ASE_NULL; } @@ -3016,7 +2926,7 @@ static ase_awk_val_t* __do_assignment ( if (val->type == ASE_AWK_VAL_MAP) { /* a map cannot be assigned to a variable */ - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTASS, var->line, ASE_NULL); return ASE_NULL; } @@ -3043,7 +2953,7 @@ static ase_awk_val_t* __do_assignment ( { ASE_AWK_ASSERT (run->awk, !"should never happen - invalid variable type"); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EINTERN, var->line, ASE_NULL); return ASE_NULL; } @@ -3074,13 +2984,13 @@ static ase_awk_val_t* __do_assignment_scalar ( { /* once a variable becomes a map, * it cannot be changed to a scalar variable */ - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("map '%.*s' not assignable with a scalar"), - var->id.name_len, var->id.name); - ase_awk_setrunerror ( - run, ASE_AWK_EMAPTOSCALAR, var->line, run->errmsg); + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; + + ase_awk_setrunerror (run, + ASE_AWK_EMAPTOSCALAR, var->line, &errarg, 1); return ASE_NULL; } @@ -3088,7 +2998,7 @@ static ase_awk_val_t* __do_assignment_scalar ( var->id.name, var->id.name_len, val, ASE_NULL); if (n < 0) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, var->line, run->errmsg); return ASE_NULL; } @@ -3109,13 +3019,13 @@ static ase_awk_val_t* __do_assignment_scalar ( { /* once the variable becomes a map, * it cannot be changed to a scalar variable */ - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("map '%.*s' not assignable with a scalar"), - var->id.name_len, var->id.name); - ase_awk_setrunerror ( - run, ASE_AWK_EMAPTOSCALAR, var->line, run->errmsg); + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; + + ase_awk_setrunerror (run, + ASE_AWK_EMAPTOSCALAR, var->line, &errarg, 1); return ASE_NULL; } @@ -3130,13 +3040,13 @@ static ase_awk_val_t* __do_assignment_scalar ( { /* once the variable becomes a map, * it cannot be changed to a scalar variable */ - run->awk->prmfns.misc.sprintf ( - run->awk->prmfns.misc.custom_data, - run->errmsg, ASE_COUNTOF(run->errmsg), - ASE_T("map '%.*s' not assignable with a scalar"), - var->id.name_len, var->id.name); - ase_awk_setrunerror ( - run, ASE_AWK_EMAPTOSCALAR, var->line, run->errmsg); + ase_cstr_t errarg; + + errarg.ptr = var->id.name; + errarg.len = var->id.name_len; + + ase_awk_setrunerror (run, + ASE_AWK_EMAPTOSCALAR, var->line, &errarg, 1); return ASE_NULL; } @@ -3189,7 +3099,7 @@ static ase_awk_val_t* __do_assignment_map ( tmp = ase_awk_makemapval (run); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, var->line, ASE_NULL); return ASE_NULL; } @@ -3205,7 +3115,7 @@ static ase_awk_val_t* __do_assignment_map ( ase_awk_refupval (run, tmp); ase_awk_refdownval (run, tmp); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, var->line, ASE_NULL); return ASE_NULL; } @@ -3218,7 +3128,7 @@ static ase_awk_val_t* __do_assignment_map ( if (ase_awk_setglobal (run, var->id.idxa, tmp) == -1) { ase_awk_refdownval (run, tmp); - ase_awk_setrunerror (run, run->errnum, var->line, ASE_NULL); + ase_awk_setrunerror_old (run, run->errnum, var->line, ASE_NULL); return ASE_NULL; } ase_awk_refdownval (run, tmp); @@ -3241,7 +3151,7 @@ static ase_awk_val_t* __do_assignment_map ( else if (map->type != ASE_AWK_VAL_MAP) { /* variable assigned is not a map */ - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTIDX, var->line, ASE_NULL); return ASE_NULL; } @@ -3258,7 +3168,7 @@ static ase_awk_val_t* __do_assignment_map ( if (n < 0) { ASE_AWK_FREE (run->awk, str); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, var->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, var->line, ASE_NULL); return ASE_NULL; } @@ -3286,13 +3196,13 @@ static ase_awk_val_t* __do_assignment_pos ( if (n == -1) { - ase_awk_setrunerror (run, ASE_AWK_EPOSIDX, pos->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EPOSIDX, pos->line, ASE_NULL); return ASE_NULL; } if (n == 1) lv = (ase_long_t)rv; if (!IS_VALID_POSIDX(lv)) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EPOSIDX, pos->line, ASE_NULL); return ASE_NULL; } @@ -3308,7 +3218,7 @@ static ase_awk_val_t* __do_assignment_pos ( run, val, ASE_AWK_VALTOSTR_CLEAR, ASE_NULL, &len); if (str == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, pos->line, ASE_NULL); return ASE_NULL; } @@ -3411,7 +3321,7 @@ 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 (run, run->errnum, nde->line, ASE_NULL); + ase_awk_setrunerror_old (run, run->errnum, nde->line, ASE_NULL); } ase_awk_refdownval (run, left); @@ -3431,7 +3341,7 @@ static ase_awk_val_t* __eval_binop_lor ( ase_awk_valtobool(run left) || ase_awk_valtobool(run,right)); if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, left->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, left->line, ASE_NULL); return ASE_NULL; } @@ -3480,7 +3390,7 @@ static ase_awk_val_t* __eval_binop_land ( ase_awk_valtobool(run,left) && ase_awk_valtobool(run,right)); if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, left->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, left->line, ASE_NULL); return ASE_NULL; } @@ -3535,7 +3445,7 @@ static ase_awk_val_t* __eval_binop_in ( ASE_AWK_ASSERT (run->awk, !"should never happen - in needs a plain variable"); - ase_awk_setrunerror (run, ASE_AWK_EINTERN, right->line, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EINTERN, right->line, ASE_NULL); return ASE_NULL; } @@ -3575,7 +3485,7 @@ static ase_awk_val_t* __eval_binop_in ( { ASE_AWK_FREE (run->awk, str); ase_awk_refdownval (run, rv); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, right->line, ASE_NULL); return ASE_NULL; }*/ @@ -3591,7 +3501,7 @@ static ase_awk_val_t* __eval_binop_in ( ASE_AWK_FREE (run->awk, str); ase_awk_refdownval (run, rv); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, right->line, ASE_T("right-hand side of the 'in' operator not nil or a map")); return ASE_NULL; @@ -3610,7 +3520,7 @@ static ase_awk_val_t* __eval_binop_bor ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -3623,7 +3533,7 @@ static ase_awk_val_t* __eval_binop_bor ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -3642,7 +3552,7 @@ static ase_awk_val_t* __eval_binop_bxor ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -3655,7 +3565,7 @@ static ase_awk_val_t* __eval_binop_bxor ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -3674,7 +3584,7 @@ static ase_awk_val_t* __eval_binop_band ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -3687,7 +3597,7 @@ static ase_awk_val_t* __eval_binop_band ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -3940,7 +3850,7 @@ static int __cmp_val ( if (left->type == ASE_AWK_VAL_MAP || right->type == ASE_AWK_VAL_MAP) { /* a map can't be compared againt other values */ - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return CMP_ERROR; } @@ -4015,7 +3925,7 @@ static ase_awk_val_t* __eval_binop_lshift ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4027,13 +3937,13 @@ static ase_awk_val_t* __eval_binop_lshift ( } else { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4052,7 +3962,7 @@ static ase_awk_val_t* __eval_binop_rshift ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4064,13 +3974,13 @@ static ase_awk_val_t* __eval_binop_rshift ( } else { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4089,7 +3999,7 @@ static ase_awk_val_t* __eval_binop_plus ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } /* @@ -4108,7 +4018,7 @@ static ase_awk_val_t* __eval_binop_plus ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4127,7 +4037,7 @@ static ase_awk_val_t* __eval_binop_minus ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4140,7 +4050,7 @@ static ase_awk_val_t* __eval_binop_minus ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4159,7 +4069,7 @@ static ase_awk_val_t* __eval_binop_mul ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4172,7 +4082,7 @@ static ase_awk_val_t* __eval_binop_mul ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4191,7 +4101,7 @@ static ase_awk_val_t* __eval_binop_div ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4200,7 +4110,7 @@ static ase_awk_val_t* __eval_binop_div ( { if (l2 == 0) { - ase_awk_setrunerror (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); return ASE_NULL; } @@ -4234,7 +4144,7 @@ static ase_awk_val_t* __eval_binop_div ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4253,7 +4163,7 @@ static ase_awk_val_t* __eval_binop_idiv ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4262,7 +4172,7 @@ static ase_awk_val_t* __eval_binop_idiv ( { if (l2 == 0) { - ase_awk_setrunerror (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); return ASE_NULL; } res = ase_awk_makeintval ( @@ -4288,7 +4198,7 @@ static ase_awk_val_t* __eval_binop_idiv ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4307,7 +4217,7 @@ static ase_awk_val_t* __eval_binop_mod ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4316,7 +4226,7 @@ static ase_awk_val_t* __eval_binop_mod ( { if (l2 == 0) { - ase_awk_setrunerror (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); return ASE_NULL; } res = ase_awk_makeintval ( @@ -4324,13 +4234,13 @@ static ase_awk_val_t* __eval_binop_mod ( } else { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } return res; @@ -4352,7 +4262,7 @@ static ase_awk_val_t* __eval_binop_exp ( if (n1 == -1 || n2 == -1) { - ase_awk_setrunerror (run, ASE_AWK_EOPERAND, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EOPERAND, 0, ASE_NULL); return ASE_NULL; } @@ -4368,7 +4278,7 @@ static ase_awk_val_t* __eval_binop_exp ( } else if (l1 == 0) { - ase_awk_setrunerror (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); return ASE_NULL; } else @@ -4390,7 +4300,7 @@ static ase_awk_val_t* __eval_binop_exp ( } else if (r1 == 0.0) { - ase_awk_setrunerror (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EDIVBY0, 0, ASE_NULL); return ASE_NULL; } else @@ -4421,7 +4331,7 @@ static ase_awk_val_t* __eval_binop_exp ( if (res == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -4453,7 +4363,7 @@ static ase_awk_val_t* __eval_binop_concat ( ASE_AWK_FREE (run->awk, strl); ASE_AWK_FREE (run->awk, strr); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -4550,7 +4460,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 (run, errnum, rline, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, rline, ASE_NULL); return ASE_NULL; } } @@ -4565,7 +4475,7 @@ static ase_awk_val_t* __eval_binop_match0 ( { ASE_AWK_FREE (run->awk, str); - ase_awk_setrunerror (run, errnum, rline, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, rline, ASE_NULL); return ASE_NULL; } @@ -4585,7 +4495,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 (run, errnum, lline, ASE_NULL); + ase_awk_setrunerror_old (run, errnum, lline, ASE_NULL); return ASE_NULL; } @@ -4595,7 +4505,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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, lline, ASE_NULL); return ASE_NULL; } @@ -4621,7 +4531,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 ( + ase_awk_setrunerror_old ( run, errnum, lline, ASE_NULL); return ASE_NULL; } @@ -4633,7 +4543,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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, lline, ASE_NULL); return ASE_NULL; } @@ -4730,7 +4640,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4755,7 +4665,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde) if (exp->left->type < ASE_AWK_NDE_NAMED || exp->left->type > ASE_AWK_NDE_ARGIDX) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -4775,7 +4685,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4787,7 +4697,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4802,7 +4712,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde) if (n == -1) { ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -4820,7 +4730,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4835,7 +4745,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4847,7 +4757,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4862,7 +4772,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde) if (n == -1) { ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -4880,7 +4790,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4892,7 +4802,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde) !"should never happen - invalid opcode"); ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EINTERN, nde->line, ASE_NULL); return ASE_NULL; } @@ -4923,7 +4833,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde) if (exp->left->type < ASE_AWK_NDE_NAMED || exp->left->type > ASE_AWK_NDE_ARGIDX) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -4943,7 +4853,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4953,7 +4863,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4965,7 +4875,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4975,7 +4885,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -4990,7 +4900,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde) if (n == -1) { ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -5001,7 +4911,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5011,7 +4921,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5023,7 +4933,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5033,7 +4943,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5049,7 +4959,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5059,7 +4969,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5071,7 +4981,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5081,7 +4991,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5096,7 +5006,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde) if (n == -1) { ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EOPERAND, nde->line, ASE_NULL); return ASE_NULL; } @@ -5107,7 +5017,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5117,7 +5027,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5129,7 +5039,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5140,7 +5050,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5153,7 +5063,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde) !"should never happen - invalid opcode"); ase_awk_refdownval (run, left); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EINTERN, nde->line, ASE_NULL); return ASE_NULL; } @@ -5198,14 +5108,14 @@ static ase_awk_val_t* __eval_bfn (ase_awk_run_t* run, ase_awk_nde_t* nde) /* built-in function */ if (call->nargs < call->what.bfn.arg.min) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EARGTF, nde->line, ASE_NULL); return ASE_NULL; } if (call->nargs > call->what.bfn.arg.max) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EARGTM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5250,7 +5160,7 @@ static ase_awk_val_t* __eval_afn (ase_awk_run_t* run, ase_awk_nde_t* nde) call->what.afn.name.ptr); } - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EFNNONE, nde->line, run->errmsg); return ASE_NULL; } @@ -5262,7 +5172,7 @@ static ase_awk_val_t* __eval_afn (ase_awk_run_t* run, ase_awk_nde_t* nde) { /* TODO: is this correct? what if i want to * allow arbitarary numbers of arguments? */ - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EARGTM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5354,7 +5264,7 @@ static ase_awk_val_t* __eval_call ( #endif if (__raw_push(run,(void*)run->stack_base) == -1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5362,7 +5272,7 @@ static ase_awk_val_t* __eval_call ( if (__raw_push(run,(void*)saved_stack_top) == -1) { __raw_pop (run); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5372,7 +5282,7 @@ static ase_awk_val_t* __eval_call ( { __raw_pop (run); __raw_pop (run); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5383,7 +5293,7 @@ static ase_awk_val_t* __eval_call ( __raw_pop (run); __raw_pop (run); __raw_pop (run); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5443,7 +5353,7 @@ static ase_awk_val_t* __eval_call ( ase_awk_refdownval (run, v); UNWIND_RUN_STACK (run, nargs); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5464,7 +5374,7 @@ static ase_awk_val_t* __eval_call ( if (__raw_push(run,ase_awk_val_nil) == -1) { UNWIND_RUN_STACK (run, nargs); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5562,7 +5472,7 @@ static int __get_reference ( tgt->id.name_len, ase_awk_val_nil); if (pair == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return -1; } @@ -5603,7 +5513,7 @@ static int __get_reference ( tgt->id.name_len, ase_awk_val_nil); if (pair == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return -1; } @@ -5657,14 +5567,14 @@ static int __get_reference ( if (n == -1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EPOSIDX, nde->line, ASE_NULL); return -1; } if (n == 1) lv = (ase_long_t)rv; if (!IS_VALID_POSIDX(lv)) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EPOSIDX, nde->line, ASE_NULL); return -1; } @@ -5673,7 +5583,7 @@ static int __get_reference ( return 0; } - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTREF, nde->line, ASE_NULL); return -1; } @@ -5694,7 +5604,7 @@ static ase_awk_val_t** __get_reference_indexed ( tmp = ase_awk_makemapval (run); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5705,7 +5615,7 @@ static ase_awk_val_t** __get_reference_indexed ( } else if ((*val)->type != ASE_AWK_VAL_MAP) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTMAP, nde->line, ASE_NULL); return ASE_NULL; } @@ -5724,7 +5634,7 @@ static ase_awk_val_t** __get_reference_indexed ( if (pair == ASE_NULL) { ASE_AWK_FREE (run->awk, str); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5743,7 +5653,7 @@ static ase_awk_val_t* __eval_int (ase_awk_run_t* run, ase_awk_nde_t* nde) val = ase_awk_makeintval (run, ((ase_awk_nde_int_t*)nde)->val); if (val == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5759,7 +5669,7 @@ static ase_awk_val_t* __eval_real (ase_awk_run_t* run, ase_awk_nde_t* nde) val = ase_awk_makerealval (run, ((ase_awk_nde_real_t*)nde)->val); if (val == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5777,7 +5687,7 @@ static ase_awk_val_t* __eval_str (ase_awk_run_t* run, ase_awk_nde_t* nde) ((ase_awk_nde_str_t*)nde)->len); if (val == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5795,7 +5705,7 @@ static ase_awk_val_t* __eval_rex (ase_awk_run_t* run, ase_awk_nde_t* nde) ((ase_awk_nde_rex_t*)nde)->code); if (val == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5845,7 +5755,7 @@ static ase_awk_val_t* __eval_indexed ( tmp = ase_awk_makemapval (run); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5856,7 +5766,7 @@ static ase_awk_val_t* __eval_indexed ( } else if ((*val)->type != ASE_AWK_VAL_MAP) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOTMAP, nde->line, ASE_NULL); return ASE_NULL; } @@ -5884,7 +5794,7 @@ static ase_awk_val_t* __eval_namedidx (ase_awk_run_t* run, ase_awk_nde_t* nde) tgt->id.name, tgt->id.name_len, ase_awk_val_nil); if (pair == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -5929,7 +5839,7 @@ static ase_awk_val_t* __eval_pos (ase_awk_run_t* run, ase_awk_nde_t* nde) ase_awk_refdownval (run, v); if (n == -1) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EPOSIDX, nde->line, ASE_NULL); return ASE_NULL; } @@ -5937,7 +5847,7 @@ static ase_awk_val_t* __eval_pos (ase_awk_run_t* run, ase_awk_nde_t* nde) if (lv < 0) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_EPOSIDX, nde->line, ASE_NULL); return ASE_NULL; } @@ -6016,7 +5926,7 @@ static ase_awk_val_t* __eval_getline (ase_awk_run_t* run, ase_awk_nde_t* nde) if (ase_str_open (&buf, DEF_BUF_CAPA, &run->awk->prmfns.mmgr) == ASE_NULL) { if (in != ASE_NULL) ASE_AWK_FREE (run->awk, in); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -6029,7 +5939,7 @@ static ase_awk_val_t* __eval_getline (ase_awk_run_t* run, ase_awk_nde_t* nde) if (run->errnum != ASE_AWK_EIOIMPL) { ase_str_close (&buf); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return ASE_NULL; } @@ -6063,7 +5973,7 @@ static ase_awk_val_t* __eval_getline (ase_awk_run_t* run, ase_awk_nde_t* nde) ase_str_close (&buf); if (v == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -6086,7 +5996,7 @@ skip_read: res = ase_awk_makeintval (run, n); if (res == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -6152,7 +6062,7 @@ static int __read_record (ase_awk_run_t* run) int saved = run->errnum; ase_awk_clrrec (run, ase_false); if (saved == ASE_AWK_EIOIMPL) saved = ASE_AWK_ECINDT; - ase_awk_setrunerror (run, saved, 0, ASE_NULL); + ase_awk_setrunerror_old (run, saved, 0, ASE_NULL); return -1; } #ifdef DEBUG_RUN @@ -6214,7 +6124,7 @@ static int __shorten_record (ase_awk_run_t* run, ase_size_t nflds) ASE_STR_LEN(&run->inrec.line), &run->awk->prmfns.mmgr) == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -6225,7 +6135,7 @@ static int __shorten_record (ase_awk_run_t* run, ase_size_t nflds) if (ofs_free != ASE_NULL) ASE_AWK_FREE (run->awk, ofs_free); if (nflds > 1) ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -6236,7 +6146,7 @@ static int __shorten_record (ase_awk_run_t* run, ase_size_t nflds) if (ofs_free != ASE_NULL) ASE_AWK_FREE (run->awk, ofs_free); if (nflds > 1) ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } } @@ -6248,7 +6158,7 @@ static int __shorten_record (ase_awk_run_t* run, ase_size_t nflds) run, ASE_STR_BUF(&tmp), ASE_STR_LEN(&tmp)); if (v == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return -1; } @@ -6289,7 +6199,7 @@ static ase_char_t* __idxnde_to_str ( if (str == ASE_NULL) { ase_awk_refdownval (run, idx); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return ASE_NULL; } @@ -6306,7 +6216,7 @@ static ase_char_t* __idxnde_to_str ( DEF_BUF_CAPA, &run->awk->prmfns.mmgr) == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -6329,7 +6239,7 @@ static ase_char_t* __idxnde_to_str ( { ase_awk_refdownval (run, idx); ase_str_close (&idxstr); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, nde->line, ASE_NULL); return ASE_NULL; } @@ -6339,7 +6249,7 @@ static ase_char_t* __idxnde_to_str ( { ase_awk_refdownval (run, idx); ase_str_close (&idxstr); - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, run->errnum, nde->line, ASE_NULL); return ASE_NULL; } @@ -6369,7 +6279,7 @@ ase_char_t* ase_awk_format ( do { \ if (ase_str_ccat (out, (c)) == -1) \ { \ - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); \ + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); \ return ASE_NULL; \ } \ } while (0) @@ -6378,7 +6288,7 @@ ase_char_t* ase_awk_format ( do { \ if (ase_str_ccat (fbu, (c)) == -1) \ { \ - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); \ + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); \ return ASE_NULL; \ } \ } while (0) @@ -6447,7 +6357,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6458,7 +6368,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6500,7 +6410,7 @@ ase_char_t* ase_awk_format ( GROW (&run->format.tmp); if (run->format.tmp.ptr == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -6553,7 +6463,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6564,7 +6474,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6604,7 +6514,7 @@ ase_char_t* ase_awk_format ( GROW (&run->format.tmp); if (run->format.tmp.ptr == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -6674,7 +6584,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6685,7 +6595,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6727,7 +6637,7 @@ ase_char_t* ase_awk_format ( GROW (&run->format.tmp); if (run->format.tmp.ptr == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -6762,7 +6672,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6773,7 +6683,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6806,7 +6716,7 @@ ase_char_t* ase_awk_format ( GROW (&run->format.tmp); if (run->format.tmp.ptr == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -6834,7 +6744,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6845,7 +6755,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6886,7 +6796,7 @@ ase_char_t* ase_awk_format ( else { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); return ASE_NULL; } @@ -6900,7 +6810,7 @@ ase_char_t* ase_awk_format ( if (ase_str_ccat (out, ASE_T(' ')) == -1) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } width--; @@ -6912,7 +6822,7 @@ ase_char_t* ase_awk_format ( if (ase_str_ccat (out, ch) == -1) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } } @@ -6924,7 +6834,7 @@ ase_char_t* ase_awk_format ( if (ase_str_ccat (out, ASE_T(' ')) == -1) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } width--; @@ -6943,7 +6853,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = ase_awk_getarg (run, stack_arg_idx); @@ -6954,7 +6864,7 @@ ase_char_t* ase_awk_format ( { if (stack_arg_idx >= nargs_on_stack) { - ase_awk_setrunerror (run, ASE_AWK_EFMTARG, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTARG, 0, ASE_NULL); return ASE_NULL; } v = val; @@ -6982,7 +6892,7 @@ ase_char_t* ase_awk_format ( if (v == val) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_EFMTCNV, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EFMTCNV, 0, ASE_NULL); return ASE_NULL; } @@ -7009,7 +6919,7 @@ ase_char_t* ase_awk_format ( if (str_free != ASE_NULL) ASE_AWK_FREE (run->awk, str_free); ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } width--; @@ -7023,7 +6933,7 @@ ase_char_t* ase_awk_format ( if (str_free != ASE_NULL) ASE_AWK_FREE (run->awk, str_free); ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } } @@ -7037,7 +6947,7 @@ ase_char_t* ase_awk_format ( if (ase_str_ccat (out, ASE_T(' ')) == -1) { ase_awk_refdownval (run, v); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } width--; diff --git a/ase/awk/val.c b/ase/awk/val.c index e543b1f6..1832aa63 100644 --- a/ase/awk/val.c +++ b/ase/awk/val.c @@ -1,5 +1,5 @@ /* - * $Id: val.c,v 1.112 2007-02-28 11:00:33 bacon Exp $ + * $Id: val.c,v 1.113 2007-03-02 11:14:34 bacon Exp $ * * {License} */ @@ -481,7 +481,7 @@ ase_char_t* ase_awk_valtostr ( v->type); #endif - ase_awk_setrunerror (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); return ASE_NULL; } @@ -495,7 +495,7 @@ static ase_char_t* __str_to_str ( tmp = ase_strxdup (str, str_len, &run->awk->prmfns.mmgr); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -510,7 +510,7 @@ static ase_char_t* __str_to_str ( n = ase_str_ncat (buf, str, str_len); if (n == (ase_size_t)-1) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -537,7 +537,7 @@ static ase_char_t* __val_int_to_str ( run->awk, 2 * ASE_SIZEOF(ase_char_t)); if (tmp == ASE_NULL) { - ase_awk_setrunerror ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -552,7 +552,7 @@ 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 ( + ase_awk_setrunerror_old ( run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -572,7 +572,7 @@ static ase_char_t* __val_int_to_str ( run->awk, (l + 1) * ASE_SIZEOF(ase_char_t)); if (tmp == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -590,7 +590,7 @@ static ase_char_t* __val_int_to_str ( if (ase_str_nccat ( buf, ASE_T(' '), l) == (ase_size_t)-1) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } } @@ -636,14 +636,14 @@ static ase_char_t* __val_real_to_str ( if (ase_str_open (&out, 256, &run->awk->prmfns.mmgr) == ASE_NULL) { - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } if (ase_str_open (&fbu, 256, &run->awk->prmfns.mmgr) == ASE_NULL) { ase_str_close (&out); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -670,7 +670,7 @@ static ase_char_t* __val_real_to_str ( { ase_str_close (&fbu); ase_str_close (&out); - ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_ENOMEM, 0, ASE_NULL); return ASE_NULL; } @@ -738,7 +738,7 @@ int ase_awk_valtonum ( v->type); #endif - ase_awk_setrunerror (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); + ase_awk_setrunerror_old (run, ASE_AWK_EVALTYPE, 0, ASE_NULL); return -1; /* error */ } diff --git a/ase/lsp/err.c b/ase/lsp/err.c index 3edab2eb..57bf834d 100644 --- a/ase/lsp/err.c +++ b/ase/lsp/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.13 2007-02-24 14:32:10 bacon Exp $ + * $Id: err.c,v 1.14 2007-03-02 11:14:35 bacon Exp $ * * {License} */ @@ -58,7 +58,7 @@ void ase_lsp_seterror ( ASE_LSP_ASSERT (lsp, argcnt <= 5); lsp->errnum = errnum; - errfmt = __geterrstr (errnum); + errfmt = __geterrstr (errnum); switch (argcnt) { diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index 99d3de61..19dba57a 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.179 2007-03-01 14:40:13 bacon Exp $ + * $Id: awk.c,v 1.180 2007-03-02 11:14:35 bacon Exp $ */ #include @@ -646,9 +646,7 @@ static BOOL WINAPI stop_run (DWORD ctrl_type) static void stop_run (int sig) { signal (SIGINT, SIG_IGN); - ase_awk_stop (ase_awk_getrunawk(app_run), app_run); - /*ase_awk_stopall (app_awk); */ - /*ase_awk_stopall (ase_awk_getrunawk(app_run)); */ + ase_awk_stop (app_run); signal (SIGINT, stop_run); } #endif @@ -862,8 +860,6 @@ static int awk_main (int argc, ase_char_t* argv[]) prmfns.misc.sprintf = custom_awk_sprintf; prmfns.misc.aprintf = custom_awk_aprintf; prmfns.misc.dprintf = custom_awk_dprintf; - prmfns.misc.lock = NULL; - prmfns.misc.unlock = NULL; prmfns.misc.custom_data = NULL; if ((awk = ase_awk_open(&prmfns, ASE_NULL, &errnum)) == ASE_NULL) diff --git a/ase/types.h b/ase/types.h index 1a72ce5a..03b0804e 100644 --- a/ase/types.h +++ b/ase/types.h @@ -1,5 +1,5 @@ /* - * $Id: types.h,v 1.74 2007-02-24 14:32:44 bacon Exp $ + * $Id: types.h,v 1.75 2007-03-02 11:14:33 bacon Exp $ * * {License} */ @@ -230,6 +230,7 @@ typedef int ase_mcint_t; #endif #endif +typedef struct ase_cstr_t ase_cstr_t; typedef struct ase_mmgr_t ase_mmgr_t; typedef struct ase_ccls_t ase_ccls_t; @@ -240,6 +241,12 @@ typedef void (*ase_free_t) (void* custom, void* ptr); typedef ase_bool_t (*ase_isccls_t) (void* custom, ase_cint_t c); typedef ase_cint_t (*ase_toccls_t) (void* custom, ase_cint_t c); +struct ase_cstr_t +{ + const ase_char_t* ptr; + ase_size_t len; +}; + struct ase_mmgr_t { ase_malloc_t malloc;