This commit is contained in:
2008-06-10 00:24:10 +00:00
parent 49380746f7
commit 6eead095a5
10 changed files with 106 additions and 106 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: awk.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -166,7 +166,7 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
awk->option = 0;
awk->errnum = ASE_AWK_ENOERR;
awk->errlin = 0;
awk->stopall = ase_false;
awk->stopall = ASE_FALSE;
awk->parse.nlocals_max = 0;
@ -304,7 +304,7 @@ int ase_awk_close (ase_awk_t* awk)
int ase_awk_clear (ase_awk_t* awk)
{
awk->stopall = ase_false;
awk->stopall = ASE_FALSE;
ase_memset (&awk->src.ios, 0, ASE_SIZEOF(awk->src.ios));
awk->src.lex.curc = ASE_CHAR_EOF;
@ -397,7 +397,7 @@ void* ase_awk_getcustomdata (ase_awk_t* awk)
void ase_awk_stopall (ase_awk_t* awk)
{
awk->stopall = ase_true;
awk->stopall = ASE_TRUE;
}
int ase_awk_getword (ase_awk_t* awk,

View File

@ -1,5 +1,5 @@
/*
* $Id: extio.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: extio.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -140,8 +140,8 @@ int ase_awk_readextio (
p->in.buf[0] = ASE_T('\0');
p->in.pos = 0;
p->in.len = 0;
p->in.eof = ase_false;
p->in.eos = ase_false;
p->in.eof = ASE_FALSE;
p->in.eos = ASE_FALSE;
ase_awk_setrunerrnum (run, ASE_AWK_ENOERR);
@ -172,7 +172,7 @@ int ase_awk_readextio (
* entire pattern-block matching and exeuction. */
if (x == 0)
{
p->in.eos = ase_true;
p->in.eos = ASE_TRUE;
return 0;
}
}
@ -245,7 +245,7 @@ int ase_awk_readextio (
if (n == 0)
{
p->in.eof = ase_true;
p->in.eof = ASE_TRUE;
if (ASE_STR_LEN(buf) == 0) ret = 0;
else if (rs_len >= 2)
@ -494,8 +494,8 @@ int ase_awk_writeextio_str (
p->next = ASE_NULL;
p->custom_data = run->extio.custom_data;
p->out.eof = ase_false;
p->out.eos = ase_false;
p->out.eof = ASE_FALSE;
p->out.eos = ASE_FALSE;
ase_awk_setrunerrnum (run, ASE_AWK_ENOERR);
n = handler (ASE_AWK_IO_OPEN, p, ASE_NULL, 0);
@ -521,7 +521,7 @@ int ase_awk_writeextio_str (
* entire pattern-block matching and exeuction. */
if (n == 0)
{
p->out.eos = ase_true;
p->out.eos = ASE_TRUE;
return 0;
}
}
@ -553,7 +553,7 @@ int ase_awk_writeextio_str (
if (n == 0)
{
p->out.eof = ase_true;
p->out.eof = ASE_TRUE;
return 0;
}
@ -571,7 +571,7 @@ int ase_awk_flushextio (
ase_awk_io_t handler;
int extio_type, /*extio_mode,*/ extio_mask;
ase_ssize_t n;
ase_bool_t ok = ase_false;
ase_bool_t ok = ASE_FALSE;
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_type_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mode_map));
@ -606,7 +606,7 @@ int ase_awk_flushextio (
return -1;
}
ok = ase_true;
ok = ASE_TRUE;
}
p = p->next;
@ -680,14 +680,14 @@ int ase_awk_nextextio_read (
/* the next stream cannot be opened.
* set the eos flags so that the next call to nextextio_read
* will return 0 without executing the handler */
p->in.eos = ase_true;
p->in.eos = ASE_TRUE;
return 0;
}
else
{
/* as the next stream has been opened successfully,
* the eof flag should be cleared if set */
p->in.eof = ase_false;
p->in.eof = ASE_FALSE;
/* also the previous input buffer must be reset */
p->in.pos = 0;
@ -758,14 +758,14 @@ int ase_awk_nextextio_write (
/* the next stream cannot be opened.
* set the eos flags so that the next call to nextextio_write
* will return 0 without executing the handler */
p->out.eos = ase_true;
p->out.eos = ASE_TRUE;
return 0;
}
else
{
/* as the next stream has been opened successfully,
* the eof flag should be cleared if set */
p->out.eof = ase_false;
p->out.eof = ASE_FALSE;
return 1;
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: parse.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -703,7 +703,7 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
awk->parse.id.block = PARSE_ACTION_BLOCK;
if (parse_pattern_block (
awk, ASE_NULL, ase_false) == ASE_NULL) return ASE_NULL;
awk, ASE_NULL, ASE_FALSE) == ASE_NULL) return ASE_NULL;
}
else
{
@ -756,7 +756,7 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
awk->parse.id.block = PARSE_ACTION_BLOCK;
if (parse_pattern_block (
awk, ptn, ase_true) == ASE_NULL)
awk, ptn, ASE_TRUE) == ASE_NULL)
{
ase_awk_clrpt (awk, ptn);
return ASE_NULL;
@ -795,7 +795,7 @@ static ase_awk_t* parse_progunit (ase_awk_t* awk)
awk->parse.id.block = PARSE_ACTION_BLOCK;
if (parse_pattern_block (
awk, ptn, ase_false) == ASE_NULL)
awk, ptn, ASE_FALSE) == ASE_NULL)
{
ase_awk_clrpt (awk, ptn);
return ASE_NULL;
@ -1047,7 +1047,7 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
awk->tree.cur_afn.len = name_len;
/* actual function body */
body = awk->parse.parse_block (awk, awk->token.prev.line, ase_true);
body = awk->parse.parse_block (awk, awk->token.prev.line, ASE_TRUE);
/* clear the current function name remembered */
awk->tree.cur_afn.ptr = ASE_NULL;
@ -1111,7 +1111,7 @@ static ase_awk_nde_t* parse_begin (ase_awk_t* awk)
ASE_ASSERT (MATCH(awk,TOKEN_LBRACE));
if (get_token(awk) == -1) return ASE_NULL;
nde = awk->parse.parse_block (awk, awk->token.prev.line, ase_true);
nde = awk->parse.parse_block (awk, awk->token.prev.line, ASE_TRUE);
if (nde == ASE_NULL) return ASE_NULL;
if (awk->tree.begin == ASE_NULL)
@ -1135,7 +1135,7 @@ static ase_awk_nde_t* parse_end (ase_awk_t* awk)
ASE_ASSERT (MATCH(awk,TOKEN_LBRACE));
if (get_token(awk) == -1) return ASE_NULL;
nde = awk->parse.parse_block (awk, awk->token.prev.line, ase_true);
nde = awk->parse.parse_block (awk, awk->token.prev.line, ASE_TRUE);
if (nde == ASE_NULL) return ASE_NULL;
if (awk->tree.end == ASE_NULL)
@ -1163,7 +1163,7 @@ static ase_awk_chain_t* parse_pattern_block (
{
ASE_ASSERT (MATCH(awk,TOKEN_LBRACE));
if (get_token(awk) == -1) return ASE_NULL;
nde = awk->parse.parse_block (awk, line, ase_true);
nde = awk->parse.parse_block (awk, line, ASE_TRUE);
if (nde == ASE_NULL) return ASE_NULL;
}
@ -1633,7 +1633,7 @@ static ase_awk_t* collect_locals (
#if 0
if (awk->option & ASE_AWK_UNIQUEFN)
{
ase_bool_t iscur = ase_false;
ase_bool_t iscur = ASE_FALSE;
#endif
/* check if it conflict with a builtin function name
@ -1787,7 +1787,7 @@ static ase_awk_nde_t* parse_statement (ase_awk_t* awk, ase_size_t line)
{
if (get_token(awk) == -1) return ASE_NULL;
nde = awk->parse.parse_block (
awk, awk->token.prev.line, ase_false);
awk, awk->token.prev.line, ASE_FALSE);
}
else
{
@ -2088,14 +2088,14 @@ static ase_awk_nde_t* parse_binary_expr (
while (1)
{
const binmap_t* p = binmap;
ase_bool_t matched = ase_false;
ase_bool_t matched = ASE_FALSE;
while (p->token != TOKEN_EOF)
{
if (MATCH(awk,p->token))
{
opcode = p->binop;
matched = ase_true;
matched = ASE_TRUE;
break;
}
p++;
@ -3271,7 +3271,7 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
if (awk->option & ASE_AWK_UNIQUEFN)
{
#endif
ase_bool_t iscur = ase_false;
ase_bool_t iscur = ASE_FALSE;
/* the name should not conflict with a function name */
/* check if it is a builtin function */
@ -3453,7 +3453,7 @@ static ase_awk_nde_t* parse_hashidx (
if (awk->option & ASE_AWK_UNIQUEFN)
{
#endif
ase_bool_t iscur = ase_false;
ase_bool_t iscur = ASE_FALSE;
/* check if it is a builtin function */
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
@ -5072,7 +5072,7 @@ static int get_charstr (ase_awk_t* awk)
* has been called */
ADD_TOKEN_CHAR (awk, awk->src.lex.curc);
}
return get_string (awk, ASE_T('\"'), ASE_T('\\'), ase_false);
return get_string (awk, ASE_T('\"'), ASE_T('\\'), ASE_FALSE);
}
static int get_rexstr (ase_awk_t* awk)
@ -5087,7 +5087,7 @@ static int get_rexstr (ase_awk_t* awk)
else
{
ADD_TOKEN_CHAR (awk, awk->src.lex.curc);
return get_string (awk, ASE_T('/'), ASE_T('\\'), ase_true);
return get_string (awk, ASE_T('/'), ASE_T('\\'), ASE_TRUE);
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: rec.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: rec.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -22,15 +22,15 @@ int ase_awk_setrec (
if (str == ASE_STR_BUF(&run->inrec.line) &&
len == ASE_STR_LEN(&run->inrec.line))
{
if (ase_awk_clrrec (run, ase_true) == -1) return -1;
if (ase_awk_clrrec (run, ASE_TRUE) == -1) return -1;
}
else
{
if (ase_awk_clrrec (run, ase_false) == -1) return -1;
if (ase_awk_clrrec (run, ASE_FALSE) == -1) return -1;
if (ase_str_ncpy (&run->inrec.line, str, len) == (ase_size_t)-1)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
@ -40,7 +40,7 @@ int ase_awk_setrec (
v = ase_awk_makestrval (run, str, len);
if (v == ASE_NULL)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
return -1;
}
@ -52,7 +52,7 @@ int ase_awk_setrec (
if (split_record (run) == -1)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
return -1;
}
}
@ -60,7 +60,7 @@ int ase_awk_setrec (
{
if (recomp_record_fields (run, idx, str, len) == -1)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
return -1;
}
@ -70,7 +70,7 @@ int ase_awk_setrec (
ASE_STR_LEN(&run->inrec.line));
if (v == ASE_NULL)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
return -1;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: run.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -927,7 +927,7 @@ static void deinit_run (ase_awk_run_t* run)
/* destroy input record. ase_awk_clrrec should be called
* before the run stack has been destroyed because it may try
* to change the value to ASE_AWK_GLOBAL_NF. */
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
if (run->inrec.flds != ASE_NULL)
{
ASE_AWK_FREE (run->awk, run->inrec.flds);
@ -955,19 +955,19 @@ static void deinit_run (ase_awk_run_t* run)
while (run->fcache_count > 0)
{
ase_awk_val_ref_t* tmp = run->fcache[--run->fcache_count];
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ase_false);
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ASE_FALSE);
}
/*while (run->scache32_count > 0)
{
ase_awk_val_str_t* tmp = run->scache32[--run->scache32_count];
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ase_false);
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ASE_FALSE);
}
while (run->scache64_count > 0)
{
ase_awk_val_str_t* tmp = run->scache64[--run->scache64_count];
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ase_false);
ase_awk_freeval (run, (ase_awk_val_t*)tmp, ASE_FALSE);
}*/
ase_awk_freevalchunk (run, run->vmgr.ichunk);
@ -1577,7 +1577,7 @@ static int run_pattern_blocks (ase_awk_run_t* run)
run->inrec.buf_pos = 0;
run->inrec.buf_len = 0;
run->inrec.eof = ase_false;
run->inrec.eof = ASE_FALSE;
/* run each pattern block */
while (run->exit_level < EXIT_GLOBAL)
@ -5101,7 +5101,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5123,7 +5123,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5163,7 +5163,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5185,7 +5185,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5211,7 +5211,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5233,7 +5233,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5273,7 +5273,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -5295,7 +5295,7 @@ static ase_awk_val_t* eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (res2 == ASE_NULL)
{
ase_awk_refdownval (run, left);
ase_awk_freeval (run, res, ase_true);
ase_awk_freeval (run, res, ASE_TRUE);
/* adjust error line */
run->errlin = nde->line;
return ASE_NULL;
@ -6318,13 +6318,13 @@ static int read_record (ase_awk_run_t* run)
{
ase_ssize_t n;
if (ase_awk_clrrec (run, ase_false) == -1) return -1;
if (ase_awk_clrrec (run, ASE_FALSE) == -1) return -1;
n = ase_awk_readextio (
run, ASE_AWK_IN_CONSOLE, ASE_T(""), &run->inrec.line);
if (n <= -1)
{
ase_awk_clrrec (run, ase_false);
ase_awk_clrrec (run, ASE_FALSE);
return -1;
}
@ -6602,7 +6602,7 @@ ase_char_t* ase_awk_format (
for (i = 0; i < fmt_len; i++)
{
ase_long_t width = -1, prec = -1;
ase_bool_t minus = ase_false;
ase_bool_t minus = ASE_FALSE;
if (ASE_STR_LEN(fbu) == 0)
{
@ -6616,7 +6616,7 @@ ase_char_t* ase_awk_format (
fmt[i] == ASE_T('0') || fmt[i] == ASE_T('+') ||
fmt[i] == ASE_T('-')))
{
if (fmt[i] == ASE_T('-')) minus = ase_true;
if (fmt[i] == ASE_T('-')) minus = ASE_TRUE;
FMT_CHAR (fmt[i]); i++;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: tab.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: tab.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -13,9 +13,9 @@ ase_awk_tab_t* ase_awk_tab_open (ase_awk_tab_t* tab, ase_awk_t* awk)
tab = (ase_awk_tab_t*) ASE_AWK_MALLOC (
awk, ASE_SIZEOF(ase_awk_tab_t));
if (tab == ASE_NULL) return ASE_NULL;
tab->__dynamic = ase_true;
tab->__dynamic = ASE_TRUE;
}
else tab->__dynamic = ase_false;
else tab->__dynamic = ASE_FALSE;
tab->awk = awk;
tab->buf = ASE_NULL;

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c 192 2008-06-06 10:33:44Z baconevi $
* $Id: val.c 197 2008-06-09 06:24:10Z baconevi $
*
* {License}
*/
@ -613,7 +613,7 @@ void ase_awk_refdownval (ase_awk_run_t* run, ase_awk_val_t* val)
val->ref--;
if (val->ref <= 0)
{
ase_awk_freeval(run, val, ase_true);
ase_awk_freeval(run, val, ASE_TRUE);
}
}
@ -638,12 +638,12 @@ void ase_awk_freevalchunk (ase_awk_run_t* run, ase_awk_val_chunk_t* chunk)
ase_bool_t ase_awk_valtobool (ase_awk_run_t* run, ase_awk_val_t* val)
{
if (val == ASE_NULL) return ase_false;
if (val == ASE_NULL) return ASE_FALSE;
switch (val->type)
{
case ASE_AWK_VAL_NIL:
return ase_false;
return ASE_FALSE;
case ASE_AWK_VAL_INT:
return ((ase_awk_val_int_t*)val)->val != 0;
case ASE_AWK_VAL_REAL:
@ -653,15 +653,15 @@ ase_bool_t ase_awk_valtobool (ase_awk_run_t* run, ase_awk_val_t* val)
case ASE_AWK_VAL_REX: /* TODO: is this correct? */
return ((ase_awk_val_rex_t*)val)->len > 0;
case ASE_AWK_VAL_MAP:
return ase_false; /* TODO: is this correct? */
return ASE_FALSE; /* TODO: is this correct? */
case ASE_AWK_VAL_REF:
return ase_false; /* TODO: is this correct? */
return ASE_FALSE; /* TODO: is this correct? */
}
ASE_ASSERTX (
!"should never happen - invalid value type",
"the type of a value should be one of ASE_AWK_VAL_XXX's defined in val.h");
return ase_false;
return ASE_FALSE;
}
ase_char_t* ase_awk_valtostr (