*** empty log message ***

This commit is contained in:
hyung-hwan 2006-08-31 13:56:46 +00:00
parent d82757c8bd
commit c51c0d9378

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.171 2006-08-30 14:48:09 bacon Exp $
* $Id: parse.c,v 1.172 2006-08-31 13:56:46 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -325,6 +325,11 @@ static struct __bvent __bvtab[] =
#define PANIC(awk,code) \
do { (awk)->errnum = (code); return XP_NULL; } while (0)
#define MALLOC(awk,size) \
(awk)->syscas->malloc (size, (awk)->syscas->custom_data)
#define FREE(awk,ptr) \
(awk)->syscas->free (ptr, (awk)->syscas->custom_data)
int xp_awk_parse (xp_awk_t* awk, xp_awk_srcios_t* srcios)
{
int n = 0;
@ -603,7 +608,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
/* get the next token */
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
return XP_NULL;
}
@ -611,14 +616,14 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (!MATCH(awk,TOKEN_LPAREN))
{
/* a function name is not followed by a left parenthesis */
xp_free (name_dup);
FREE (awk, name_dup);
PANIC (awk, XP_AWK_ELPAREN);
}
/* get the next token */
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
return XP_NULL;
}
@ -631,7 +636,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
/* no function parameter found. get the next token */
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
return XP_NULL;
}
}
@ -644,7 +649,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (!MATCH(awk,TOKEN_IDENT))
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_EIDENT);
}
@ -658,7 +663,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (xp_strxncmp (name_dup, name_len, param, param_len) == 0 ||
xp_awk_map_get (&awk->tree.afns, param, param_len) != XP_NULL)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_EDUPNAME);
}
@ -675,7 +680,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
&awk->parse.params,
0, param, param_len) != (xp_size_t)-1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_EDUPPARAM);
}
@ -684,7 +689,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (xp_awk_tab_getsize (
&awk->parse.params) >= XP_AWK_MAX_PARAMS)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_ETOOMANYPARAMS);
}
@ -693,14 +698,14 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
&awk->parse.params,
param, param_len) == (xp_size_t)-1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_ENOMEM);
}
if (__get_token (awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
return XP_NULL;
}
@ -709,14 +714,14 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (!MATCH(awk,TOKEN_COMMA))
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_ECOMMA);
}
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
return XP_NULL;
}
@ -724,7 +729,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
return XP_NULL;
}
@ -733,13 +738,13 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
/* check if the function body starts with a left brace */
if (!MATCH(awk,TOKEN_LBRACE))
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
PANIC (awk, XP_AWK_ELBRACE);
}
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
return XP_NULL;
}
@ -748,7 +753,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
body = __parse_block (awk, xp_true);
if (body == XP_NULL)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_tab_clear (&awk->parse.params);
return XP_NULL;
}
@ -759,10 +764,10 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
/* parameter names are not required anymore. clear them */
xp_awk_tab_clear (&awk->parse.params);
afn = (xp_awk_afn_t*) xp_malloc (xp_sizeof(xp_awk_afn_t));
afn = (xp_awk_afn_t*) MALLOC (awk, xp_sizeof(xp_awk_afn_t));
if (afn == XP_NULL)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_clrpt (body);
return XP_NULL;
}
@ -775,9 +780,9 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
n = xp_awk_map_putx (&awk->tree.afns, name_dup, name_len, afn, &pair);
if (n < 0)
{
xp_free (name_dup);
FREE (awk, name_dup);
xp_awk_clrpt (body);
xp_free (afn);
FREE (awk, afn);
PANIC (awk, XP_AWK_ENOMEM);
}
@ -786,7 +791,7 @@ static xp_awk_nde_t* __parse_function (xp_awk_t* awk)
afn->name = pair->key; /* do some trick to save a string. */
afn->name_len = pair->key_len;
xp_free (name_dup);
FREE (awk, name_dup);
return body;
}
@ -834,7 +839,7 @@ static xp_awk_chain_t* __parse_pattern_block (
if (nde == XP_NULL) return XP_NULL;
}
chain = (xp_awk_chain_t*) xp_malloc (xp_sizeof(xp_awk_chain_t));
chain = (xp_awk_chain_t*) MALLOC (awk, xp_sizeof(xp_awk_chain_t));
if (chain == XP_NULL)
{
xp_awk_clrpt (nde);
@ -942,7 +947,7 @@ static xp_awk_nde_t* __parse_block (xp_awk_t* awk, xp_bool_t is_top)
curr = nde;
}
block = (xp_awk_nde_blk_t*) xp_malloc (xp_sizeof(xp_awk_nde_blk_t));
block = (xp_awk_nde_blk_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_blk_t));
if (block == XP_NULL)
{
xp_awk_tab_remove (
@ -1137,7 +1142,7 @@ static xp_awk_nde_t* __parse_statement (xp_awk_t* awk)
if (MATCH(awk,TOKEN_SEMICOLON))
{
/* null statement */
nde = (xp_awk_nde_t*) xp_malloc (xp_sizeof(xp_awk_nde_t));
nde = (xp_awk_nde_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_NULL;
@ -1145,7 +1150,7 @@ static xp_awk_nde_t* __parse_statement (xp_awk_t* awk)
if (__get_token(awk) == -1)
{
xp_free (nde);
FREE (awk, nde);
return XP_NULL;
}
}
@ -1310,7 +1315,7 @@ static xp_awk_nde_t* __parse_expression (xp_awk_t* awk)
return XP_NULL;
}
nde = (xp_awk_nde_ass_t*) xp_malloc (xp_sizeof(xp_awk_nde_ass_t));
nde = (xp_awk_nde_ass_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_ass_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (x);
@ -1358,8 +1363,8 @@ static xp_awk_nde_t* __parse_basic_expr (xp_awk_t* awk)
return XP_NULL;
}
tmp = (xp_awk_nde_cnd_t*)
xp_malloc (xp_sizeof(xp_awk_nde_cnd_t));
tmp = (xp_awk_nde_cnd_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_cnd_t));
if (tmp == XP_NULL)
{
xp_awk_clrpt (nde);
@ -1465,8 +1470,8 @@ static xp_awk_nde_t* __parse_binary_expr (
/* TODO: enhance constant folding more... */
skip_constant_folding:
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (right);
@ -1550,8 +1555,8 @@ static xp_awk_nde_t* __parse_in (xp_awk_t* awk)
PANIC (awk, XP_AWK_ENOTVAR);
}
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (right);
@ -1650,8 +1655,8 @@ static xp_awk_nde_t* __parse_bitwise_or_with_extio (xp_awk_t* awk)
}
}
nde = (xp_awk_nde_getline_t*)
xp_malloc (xp_sizeof(xp_awk_nde_getline_t));
nde = (xp_awk_nde_getline_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_getline_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (left);
@ -1685,8 +1690,8 @@ static xp_awk_nde_t* __parse_bitwise_or_with_extio (xp_awk_t* awk)
/* TODO: do constant folding */
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (right);
@ -1788,8 +1793,8 @@ static xp_awk_nde_t* __parse_concat (xp_awk_t* awk)
return XP_NULL;
}
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (left);
@ -1853,8 +1858,7 @@ static xp_awk_nde_t* __parse_unary (xp_awk_t* awk)
left = __parse_unary (awk);
if (left == XP_NULL) return XP_NULL;
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (left);
@ -1912,8 +1916,7 @@ static xp_awk_nde_t* __parse_increment (xp_awk_t* awk)
if (__get_token(awk) == -1) return XP_NULL;
}
nde = (xp_awk_nde_exp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_exp_t));
nde = (xp_awk_nde_exp_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_exp_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (left);
@ -1939,8 +1942,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
{
xp_awk_nde_int_t* nde;
nde = (xp_awk_nde_int_t*)
xp_malloc (xp_sizeof(xp_awk_nde_int_t));
nde = (xp_awk_nde_int_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_int_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_INT;
@ -1954,7 +1957,7 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
if (__get_token(awk) == -1)
{
xp_free (nde);
FREE (awk, nde);
return XP_NULL;
}
@ -1964,8 +1967,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
{
xp_awk_nde_real_t* nde;
nde = (xp_awk_nde_real_t*)
xp_malloc (xp_sizeof(xp_awk_nde_real_t));
nde = (xp_awk_nde_real_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_real_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_REAL;
@ -1978,7 +1981,7 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
if (__get_token(awk) == -1)
{
xp_free (nde);
FREE (awk, nde);
return XP_NULL;
}
@ -1988,8 +1991,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
{
xp_awk_nde_str_t* nde;
nde = (xp_awk_nde_str_t*)
xp_malloc (xp_sizeof(xp_awk_nde_str_t));
nde = (xp_awk_nde_str_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_str_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_STR;
@ -1998,14 +2001,14 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
nde->buf = xp_strxdup(XP_STR_BUF(&awk->token.name), nde->len);
if (nde->buf == XP_NULL)
{
xp_free (nde);
FREE (awk, nde);
PANIC (awk, XP_AWK_ENOMEM);
}
if (__get_token(awk) == -1)
{
xp_free (nde->buf);
xp_free (nde);
FREE (awk, nde->buf);
FREE (awk, nde);
return XP_NULL;
}
@ -2023,8 +2026,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
if (__get_rexstr (awk) == -1) return XP_NULL;
xp_assert (MATCH(awk,TOKEN_REX));
nde = (xp_awk_nde_rex_t*)
xp_malloc (xp_sizeof(xp_awk_nde_rex_t));
nde = (xp_awk_nde_rex_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_rex_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_REX;
@ -2036,7 +2039,7 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
XP_STR_LEN(&awk->token.name));
if (nde->buf == XP_NULL)
{
xp_free (nde);
FREE (awk, nde);
PANIC (awk, XP_AWK_ENOMEM);
}
@ -2046,16 +2049,16 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
&errnum);
if (nde->code == XP_NULL)
{
xp_free (nde->buf);
xp_free (nde);
FREE (awk, nde->buf);
FREE (awk, nde);
PANIC (awk, errnum);
}
if (__get_token(awk) == -1)
{
xp_free (nde->buf);
xp_free (nde->code);
xp_free (nde);
FREE (awk, nde->buf);
FREE (awk, nde->code);
FREE (awk, nde);
return XP_NULL;
}
@ -2071,8 +2074,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
prim = __parse_primary (awk);
if (prim == XP_NULL) return XP_NULL;
nde = (xp_awk_nde_pos_t*)
xp_malloc (xp_sizeof(xp_awk_nde_pos_t));
nde = (xp_awk_nde_pos_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_pos_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (prim);
@ -2151,8 +2154,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
PANIC (awk, XP_AWK_EIN);
}
tmp = (xp_awk_nde_grp_t*)
xp_malloc (xp_sizeof(xp_awk_nde_grp_t));
tmp = (xp_awk_nde_grp_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_grp_t));
if (tmp == XP_NULL)
{
xp_awk_clrpt (nde);
@ -2204,8 +2207,8 @@ static xp_awk_nde_t* __parse_primary (xp_awk_t* awk)
}
}
nde = (xp_awk_nde_getline_t*)
xp_malloc (xp_sizeof(xp_awk_nde_getline_t));
nde = (xp_awk_nde_getline_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_getline_t));
if (nde == XP_NULL)
{
if (var != XP_NULL) xp_awk_clrpt (var);
@ -2242,7 +2245,7 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
if (__get_token(awk) == -1)
{
xp_free (name_dup);
FREE (awk, name_dup);
return XP_NULL;
}
@ -2252,7 +2255,7 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
{
xp_awk_nde_t* nde;
xp_free (name_dup);
FREE (awk, name_dup);
if (!MATCH(awk,TOKEN_LPAREN))
{
/* built-in function should be in the form
@ -2269,7 +2272,7 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
{
xp_awk_nde_t* nde;
nde = __parse_hashidx (awk, name_dup, name_len);
if (nde == XP_NULL) xp_free (name_dup);
if (nde == XP_NULL) FREE (awk, name_dup);
return (xp_awk_nde_t*)nde;
}
else if (MATCH(awk,TOKEN_LPAREN))
@ -2277,7 +2280,7 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
/* function call */
xp_awk_nde_t* nde;
nde = __parse_fncall (awk, name_dup, name_len, XP_NULL);
if (nde == XP_NULL) xp_free (name_dup);
if (nde == XP_NULL) FREE (awk, name_dup);
return (xp_awk_nde_t*)nde;
}
else
@ -2286,11 +2289,11 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
xp_awk_nde_var_t* nde;
xp_size_t idxa;
nde = (xp_awk_nde_var_t*)
xp_malloc (xp_sizeof(xp_awk_nde_var_t));
nde = (xp_awk_nde_var_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_var_t));
if (nde == XP_NULL)
{
xp_free (name_dup);
FREE (awk, name_dup);
PANIC (awk, XP_AWK_ENOMEM);
}
@ -2355,8 +2358,8 @@ static xp_awk_nde_t* __parse_primary_ident (xp_awk_t* awk)
}
/* undefined variable */
xp_free (name_dup);
xp_free (nde);
FREE (awk, name_dup);
FREE (awk, nde);
PANIC (awk, XP_AWK_EUNDEF);
}
}
@ -2413,7 +2416,7 @@ static xp_awk_nde_t* __parse_hashidx (
return XP_NULL;
}
nde = (xp_awk_nde_var_t*) xp_malloc (xp_sizeof(xp_awk_nde_var_t));
nde = (xp_awk_nde_var_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_var_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (idx);
@ -2479,7 +2482,7 @@ static xp_awk_nde_t* __parse_hashidx (
/* undefined variable */
xp_awk_clrpt (idx);
xp_free (nde);
FREE (awk, nde);
PANIC (awk, XP_AWK_EUNDEF);
}
@ -2545,7 +2548,7 @@ static xp_awk_nde_t* __parse_fncall (
}
call = (xp_awk_nde_call_t*) xp_malloc (xp_sizeof(xp_awk_nde_call_t));
call = (xp_awk_nde_call_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_call_t));
if (call == XP_NULL)
{
if (head != XP_NULL) xp_awk_clrpt (head);
@ -2632,7 +2635,7 @@ static xp_awk_nde_t* __parse_if (xp_awk_t* awk)
}
else else_part = XP_NULL;
nde = (xp_awk_nde_if_t*) xp_malloc (xp_sizeof(xp_awk_nde_if_t));
nde = (xp_awk_nde_if_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_if_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (else_part);
@ -2680,7 +2683,7 @@ static xp_awk_nde_t* __parse_while (xp_awk_t* awk)
return XP_NULL;
}
nde = (xp_awk_nde_while_t*) xp_malloc (xp_sizeof(xp_awk_nde_while_t));
nde = (xp_awk_nde_while_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_while_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (body);
@ -2742,8 +2745,8 @@ static xp_awk_nde_t* __parse_for (xp_awk_t* awk)
return XP_NULL;
}
nde2 = (xp_awk_nde_foreach_t*)
xp_malloc (xp_sizeof(xp_awk_nde_foreach_t));
nde2 = (xp_awk_nde_foreach_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_foreach_t));
if (nde2 == XP_NULL)
{
xp_awk_clrpt (init);
@ -2834,7 +2837,7 @@ static xp_awk_nde_t* __parse_for (xp_awk_t* awk)
return XP_NULL;
}
nde = (xp_awk_nde_for_t*) xp_malloc (xp_sizeof(xp_awk_nde_for_t));
nde = (xp_awk_nde_for_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_for_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (init);
@ -2907,7 +2910,7 @@ static xp_awk_nde_t* __parse_dowhile (xp_awk_t* awk)
return XP_NULL;
}
nde = (xp_awk_nde_while_t*) xp_malloc (xp_sizeof(xp_awk_nde_while_t));
nde = (xp_awk_nde_while_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_while_t));
if (nde == XP_NULL)
{
xp_awk_clrpt (body);
@ -2929,7 +2932,7 @@ static xp_awk_nde_t* __parse_break (xp_awk_t* awk)
if (awk->parse.depth.loop <= 0) PANIC (awk, XP_AWK_EBREAK);
nde = (xp_awk_nde_break_t*) xp_malloc (xp_sizeof(xp_awk_nde_break_t));
nde = (xp_awk_nde_break_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_break_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_BREAK;
nde->next = XP_NULL;
@ -2943,7 +2946,8 @@ static xp_awk_nde_t* __parse_continue (xp_awk_t* awk)
if (awk->parse.depth.loop <= 0) PANIC (awk, XP_AWK_ECONTINUE);
nde = (xp_awk_nde_continue_t*)xp_malloc(xp_sizeof(xp_awk_nde_continue_t));
nde = (xp_awk_nde_continue_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_continue_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_CONTINUE;
nde->next = XP_NULL;
@ -2956,7 +2960,8 @@ static xp_awk_nde_t* __parse_return (xp_awk_t* awk)
xp_awk_nde_return_t* nde;
xp_awk_nde_t* val;
nde = (xp_awk_nde_return_t*)xp_malloc(xp_sizeof(xp_awk_nde_return_t));
nde = (xp_awk_nde_return_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_return_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_RETURN;
nde->next = XP_NULL;
@ -2971,7 +2976,7 @@ static xp_awk_nde_t* __parse_return (xp_awk_t* awk)
val = __parse_expression (awk);
if (val == XP_NULL)
{
xp_free (nde);
FREE (awk, nde);
return XP_NULL;
}
}
@ -2985,7 +2990,7 @@ static xp_awk_nde_t* __parse_exit (xp_awk_t* awk)
xp_awk_nde_exit_t* nde;
xp_awk_nde_t* val;
nde = (xp_awk_nde_exit_t*)xp_malloc(xp_sizeof(xp_awk_nde_exit_t));
nde = (xp_awk_nde_exit_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_exit_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_EXIT;
nde->next = XP_NULL;
@ -3000,7 +3005,7 @@ static xp_awk_nde_t* __parse_exit (xp_awk_t* awk)
val = __parse_expression (awk);
if (val == XP_NULL)
{
xp_free (nde);
FREE (awk, nde);
return XP_NULL;
}
}
@ -3026,7 +3031,8 @@ static xp_awk_nde_t* __parse_delete (xp_awk_t* awk)
PANIC (awk, XP_AWK_EIDENT);
}
nde = (xp_awk_nde_delete_t*)xp_malloc(xp_sizeof(xp_awk_nde_delete_t));
nde = (xp_awk_nde_delete_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_delete_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_DELETE;
@ -3093,7 +3099,7 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk)
out = ep->right;
out_type = XP_AWK_OUT_FILE;
xp_free (tmp);
FREE (awk, tmp);
}
else if (ep->opcode == XP_AWK_BINOP_RSHIFT)
{
@ -3106,7 +3112,7 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk)
out = ep->right;
out_type = XP_AWK_OUT_FILE_APPEND;
xp_free (tmp);
FREE (awk, tmp);
}
else if (ep->opcode == XP_AWK_BINOP_BOR)
{
@ -3119,7 +3125,7 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk)
out = ep->right;
out_type = XP_AWK_OUT_PIPE;
xp_free (tmp);
FREE (awk, tmp);
}
}
}
@ -3149,7 +3155,7 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk)
}
}
nde = (xp_awk_nde_print_t*) xp_malloc (xp_sizeof(xp_awk_nde_print_t));
nde = (xp_awk_nde_print_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_print_t));
if (nde == XP_NULL)
{
if (args != XP_NULL) xp_awk_clrpt (args);
@ -3182,7 +3188,7 @@ static xp_awk_nde_t* __parse_next (xp_awk_t* awk)
PANIC (awk, XP_AWK_ENEXT);
}
nde = (xp_awk_nde_next_t*) xp_malloc (xp_sizeof(xp_awk_nde_next_t));
nde = (xp_awk_nde_next_t*) MALLOC (awk, xp_sizeof(xp_awk_nde_next_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_NEXT;
nde->next = XP_NULL;
@ -3200,8 +3206,8 @@ static xp_awk_nde_t* __parse_nextfile (xp_awk_t* awk)
PANIC (awk, XP_AWK_ENEXTFILE);
}
nde = (xp_awk_nde_nextfile_t*)
xp_malloc (xp_sizeof(xp_awk_nde_nextfile_t));
nde = (xp_awk_nde_nextfile_t*) MALLOC (
awk, xp_sizeof(xp_awk_nde_nextfile_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_NEXTFILE;
nde->next = XP_NULL;