*** empty log message ***
This commit is contained in:
parent
2b50e6dfb0
commit
bfa9edd9ab
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.86 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: awk.c,v 1.87 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
@ -140,7 +140,7 @@ int ase_awk_close (ase_awk_t* awk)
|
||||
{
|
||||
if (ase_awk_clear (awk) == -1) return -1;
|
||||
|
||||
ase_awk_assert (awk, awk->run.count == 0 && awk->run.ptr == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, awk->run.count == 0 && awk->run.ptr == ASE_NULL);
|
||||
|
||||
ase_awk_map_close (&awk->tree.afns);
|
||||
ase_awk_tab_close (&awk->parse.globals);
|
||||
@ -191,14 +191,14 @@ int ase_awk_clear (ase_awk_t* awk)
|
||||
|
||||
if (awk->tree.begin != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (awk, awk->tree.begin->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, awk->tree.begin->next == ASE_NULL);
|
||||
ase_awk_clrpt (awk, awk->tree.begin);
|
||||
awk->tree.begin = ASE_NULL;
|
||||
}
|
||||
|
||||
if (awk->tree.end != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (awk, awk->tree.end->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, awk->tree.end->next == ASE_NULL);
|
||||
ase_awk_clrpt (awk, awk->tree.end);
|
||||
awk->tree.end = ASE_NULL;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.134 2006-10-24 04:48:52 bacon Exp $
|
||||
* $Id: awk.h,v 1.135 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
@ -318,9 +318,9 @@ enum
|
||||
|
||||
/* assertion statement */
|
||||
#ifdef NDEBUG
|
||||
#define ase_awk_assert(awk,expr) ((void)0)
|
||||
#define ASE_AWK_ASSERT(awk,expr) ((void)0)
|
||||
#else
|
||||
#define ase_awk_assert(awk,expr) (void)((expr) || \
|
||||
#define ASE_AWK_ASSERT(awk,expr) (void)((expr) || \
|
||||
(ase_awk_assertfail (awk, ASE_T(#expr), ASE_T(__FILE__), __LINE__), 0))
|
||||
#endif
|
||||
|
||||
@ -419,7 +419,7 @@ ase_char_t* ase_awk_strxnstr (
|
||||
const ase_char_t* str, ase_size_t strsz,
|
||||
const ase_char_t* sub, ase_size_t subsz);
|
||||
|
||||
/* abort function for assertion. use ase_awk_assert instead */
|
||||
/* abort function for assertion. use ASE_AWK_ASSERT instead */
|
||||
int ase_awk_assertfail (ase_awk_t* awk,
|
||||
const ase_char_t* expr, const ase_char_t* file, int line);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: extio.c,v 1.56 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: extio.c,v 1.57 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -84,11 +84,11 @@ int ase_awk_readextio (
|
||||
ase_size_t rs_len;
|
||||
ase_size_t line_len = 0;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mask_map));
|
||||
|
||||
/* translate the in_type into the relevant extio type and mode */
|
||||
@ -284,7 +284,7 @@ int ase_awk_readextio (
|
||||
const ase_char_t* match_ptr;
|
||||
ase_size_t match_len;
|
||||
|
||||
ase_awk_assert (run->awk, run->global.rs != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, run->global.rs != ASE_NULL);
|
||||
|
||||
/* TODO: safematchrex */
|
||||
n = ase_awk_matchrex (
|
||||
@ -302,7 +302,7 @@ int ase_awk_readextio (
|
||||
{
|
||||
/* the match should be found at the end of
|
||||
* the current buffer */
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
ASE_AWK_STR_BUF(buf) + ASE_AWK_STR_LEN(buf) ==
|
||||
match_ptr + match_len);
|
||||
|
||||
@ -397,11 +397,11 @@ int ase_awk_writeextio_str (
|
||||
ase_awk_io_t handler;
|
||||
int extio_type, extio_mode, extio_mask, n;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mask_map));
|
||||
|
||||
/* translate the out_type into the relevant extio type and mode */
|
||||
@ -519,11 +519,11 @@ int ase_awk_flushextio (
|
||||
int extio_type, extio_mode, extio_mask, n;
|
||||
ase_bool_t ok = ase_false;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mask_map));
|
||||
|
||||
/* translate the out_type into the relevant extio type and mode */
|
||||
@ -582,11 +582,11 @@ int ase_awk_nextextio_read (
|
||||
ase_awk_io_t handler;
|
||||
int extio_type, extio_mode, extio_mask, n;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mask_map));
|
||||
|
||||
/* translate the in_type into the relevant extio type and mode */
|
||||
@ -634,11 +634,11 @@ int ase_awk_closeextio_read (
|
||||
ase_awk_io_t handler;
|
||||
int extio_type, extio_mode, extio_mask;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
in_type >= 0 && in_type <= ase_countof(__in_mask_map));
|
||||
|
||||
/* translate the in_type into the relevant extio type and mode */
|
||||
@ -697,11 +697,11 @@ int ase_awk_closeextio_write (
|
||||
ase_awk_io_t handler;
|
||||
int extio_type, extio_mode, extio_mask;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_type_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mode_map));
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
out_type >= 0 && out_type <= ase_countof(__out_mask_map));
|
||||
|
||||
/* translate the out_type into the relevant extio type and mode */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: func.c,v 1.69 2006-10-24 04:48:52 bacon Exp $
|
||||
* $Id: func.c,v 1.70 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -138,11 +138,11 @@ static int __bfn_close (ase_awk_run_t* run)
|
||||
ase_size_t len;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
/* TODO: support close (xxx, "to"/"from") like gawk */
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
ase_awk_assert (run->awk, a0 != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, a0 != ASE_NULL);
|
||||
|
||||
if (a0->type == ASE_AWK_VAL_STR)
|
||||
{
|
||||
@ -240,7 +240,7 @@ static int __bfn_fflush (ase_awk_run_t* run)
|
||||
int n;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs >= 0 && nargs <= 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs >= 0 && nargs <= 1);
|
||||
|
||||
if (nargs == 0)
|
||||
{
|
||||
@ -335,7 +335,7 @@ static int __bfn_index (ase_awk_run_t* run)
|
||||
ase_long_t idx;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 2);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 2);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
a1 = ase_awk_getarg (run, 1);
|
||||
@ -396,7 +396,7 @@ static int __bfn_length (ase_awk_run_t* run)
|
||||
ase_size_t len;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
|
||||
v = ase_awk_getarg (run, 0);
|
||||
if (v->type == ASE_AWK_VAL_STR)
|
||||
@ -433,7 +433,7 @@ static int __bfn_substr (ase_awk_run_t* run)
|
||||
int n;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs >= 2 && nargs <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, nargs >= 2 && nargs <= 3);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
a1 = ase_awk_getarg (run, 1);
|
||||
@ -508,13 +508,13 @@ static int __bfn_split (ase_awk_run_t* run)
|
||||
int errnum;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs >= 2 && nargs <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, nargs >= 2 && nargs <= 3);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
a1 = ase_awk_getarg (run, 1);
|
||||
a2 = (nargs >= 3)? ase_awk_getarg (run, 2): ASE_NULL;
|
||||
|
||||
ase_awk_assert (run->awk, a1->type == ASE_AWK_VAL_REF);
|
||||
ASE_AWK_ASSERT (run->awk, a1->type == ASE_AWK_VAL_REF);
|
||||
|
||||
if (((ase_awk_val_ref_t*)a1)->id >= ASE_AWK_VAL_REF_NAMEDIDX &&
|
||||
((ase_awk_val_ref_t*)a1)->id <= ASE_AWK_VAL_REF_ARGIDX)
|
||||
@ -678,7 +678,7 @@ static int __bfn_split (ase_awk_run_t* run)
|
||||
break;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(tok != ASE_NULL && tok_len > 0) || tok_len == 0);
|
||||
|
||||
/* create the field string */
|
||||
@ -698,7 +698,7 @@ static int __bfn_split (ase_awk_run_t* run)
|
||||
/* put it into the map */
|
||||
key_len = ase_awk_longtostr (
|
||||
num, 10, ASE_NULL, key, ase_countof(key));
|
||||
ase_awk_assert (run->awk, key_len != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (run->awk, key_len != (ase_size_t)-1);
|
||||
|
||||
/* don't forget to update the reference count when you
|
||||
* handle the assignment-like situation. anyway, it is
|
||||
@ -751,7 +751,7 @@ static int __bfn_tolower (ase_awk_run_t* run)
|
||||
ase_awk_val_t* a0, * r;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
|
||||
@ -790,7 +790,7 @@ static int __bfn_toupper (ase_awk_run_t* run)
|
||||
ase_awk_val_t* a0, * r;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
|
||||
@ -838,13 +838,13 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
ase_long_t sub_count;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs >= 2 && nargs <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, nargs >= 2 && nargs <= 3);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
a1 = ase_awk_getarg (run, 1);
|
||||
a2 = (nargs >= 3)? ase_awk_getarg (run, 2): ASE_NULL;
|
||||
|
||||
ase_awk_assert (run->awk, a2 == ASE_NULL || a2->type == ASE_AWK_VAL_REF);
|
||||
ASE_AWK_ASSERT (run->awk, a2 == ASE_NULL || a2->type == ASE_AWK_VAL_REF);
|
||||
|
||||
#define FREE_A_PTRS(awk) \
|
||||
do { \
|
||||
@ -1134,7 +1134,7 @@ static int __bfn_match (ase_awk_run_t* run)
|
||||
ase_size_t mat_len;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 2);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 2);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
a1 = ase_awk_getarg (run, 1);
|
||||
@ -1248,7 +1248,7 @@ static int __bfn_system (ase_awk_run_t* run)
|
||||
int n;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
|
||||
cmd = ase_awk_valtostr (
|
||||
run, ase_awk_getarg(run, 0),
|
||||
@ -1285,7 +1285,7 @@ static int __bfn_sin (ase_awk_run_t* run)
|
||||
ase_real_t rv;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ase_awk_assert (run->awk, nargs == 1);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 1);
|
||||
|
||||
n = ase_awk_valtonum (run, ase_awk_getarg(run, 0), &lv, &rv);
|
||||
if (n == -1)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.c,v 1.28 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: map.c,v 1.29 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -75,7 +75,7 @@ void ase_awk_map_clear (ase_awk_map_t* map)
|
||||
map->buck[i] = ASE_NULL;
|
||||
}
|
||||
|
||||
ase_awk_assert (map->awk, map->size == 0);
|
||||
ASE_AWK_ASSERT (map->awk, map->size == 0);
|
||||
}
|
||||
|
||||
ase_awk_pair_t* ase_awk_map_get (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.32 2006-10-24 04:48:52 bacon Exp $
|
||||
* $Id: misc.c,v 1.33 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -43,7 +43,7 @@ ase_long_t ase_awk_strxtolong (
|
||||
ase_size_t rem;
|
||||
int digit, negative = 0;
|
||||
|
||||
ase_awk_assert (awk, base < 37);
|
||||
ASE_AWK_ASSERT (awk, base < 37);
|
||||
|
||||
p = str;
|
||||
end = str + len;
|
||||
@ -995,7 +995,7 @@ ase_char_t* ase_awk_strxntokbyrex (
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, n == 1);
|
||||
ASE_AWK_ASSERT (run->awk, n == 1);
|
||||
|
||||
if (match_len == 0)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.194 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: parse.c,v 1.195 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -318,7 +318,7 @@ int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios)
|
||||
{
|
||||
int n = 0, op;
|
||||
|
||||
ase_awk_assert (awk, srcios != ASE_NULL && srcios->in != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, srcios != ASE_NULL && srcios->in != ASE_NULL);
|
||||
|
||||
ase_awk_clear (awk);
|
||||
awk->src.ios = srcios;
|
||||
@ -407,7 +407,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk)
|
||||
function name (parameter-list) { statement }
|
||||
*/
|
||||
|
||||
ase_awk_assert (awk, awk->parse.depth.loop == 0);
|
||||
ASE_AWK_ASSERT (awk, awk->parse.depth.loop == 0);
|
||||
|
||||
if ((awk->option & ASE_AWK_EXPLICIT) && MATCH(awk,TOKEN_GLOBAL))
|
||||
{
|
||||
@ -492,7 +492,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk)
|
||||
ptn = __parse_expression (awk);
|
||||
if (ptn == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_awk_assert (awk, ptn->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, ptn->next == ASE_NULL);
|
||||
|
||||
if (MATCH(awk,TOKEN_COMMA))
|
||||
{
|
||||
@ -567,7 +567,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
int n;
|
||||
|
||||
/* eat up the keyword 'function' and get the next token */
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_FUNCTION));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_FUNCTION));
|
||||
if (__get_token(awk) == -1) return ASE_NULL;
|
||||
|
||||
/* match a function name */
|
||||
@ -622,7 +622,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
}
|
||||
|
||||
/* make sure that parameter table is empty */
|
||||
ase_awk_assert (awk, ase_awk_tab_getsize(&awk->parse.params) == 0);
|
||||
ASE_AWK_ASSERT (awk, ase_awk_tab_getsize(&awk->parse.params) == 0);
|
||||
|
||||
/* read parameter list */
|
||||
if (MATCH(awk,TOKEN_RPAREN))
|
||||
@ -781,7 +781,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
}
|
||||
|
||||
/* duplicate functions should have been detected previously */
|
||||
ase_awk_assert (awk, n != 0);
|
||||
ASE_AWK_ASSERT (awk, n != 0);
|
||||
|
||||
afn->name = pair->key; /* do some trick to save a string. */
|
||||
afn->name_len = pair->key_len;
|
||||
@ -794,7 +794,7 @@ static ase_awk_nde_t* __parse_begin (ase_awk_t* awk)
|
||||
{
|
||||
ase_awk_nde_t* nde;
|
||||
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
|
||||
if (__get_token(awk) == -1) return ASE_NULL;
|
||||
nde = __parse_block(awk, ase_true);
|
||||
@ -808,7 +808,7 @@ static ase_awk_nde_t* __parse_end (ase_awk_t* awk)
|
||||
{
|
||||
ase_awk_nde_t* nde;
|
||||
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
|
||||
if (__get_token(awk) == -1) return ASE_NULL;
|
||||
nde = __parse_block(awk, ase_true);
|
||||
@ -827,7 +827,7 @@ static ase_awk_chain_t* __parse_pattern_block (
|
||||
if (blockless) nde = ASE_NULL;
|
||||
else
|
||||
{
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_LBRACE));
|
||||
if (__get_token(awk) == -1) return ASE_NULL;
|
||||
nde = __parse_block(awk, ase_true);
|
||||
if (nde == ASE_NULL) return ASE_NULL;
|
||||
@ -1295,7 +1295,7 @@ static ase_awk_nde_t* __parse_expression (ase_awk_t* awk)
|
||||
return x;
|
||||
}
|
||||
|
||||
ase_awk_assert (awk, x->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, x->next == ASE_NULL);
|
||||
if (!__is_var(x) && x->type != ASE_AWK_NDE_POS)
|
||||
{
|
||||
ase_awk_clrpt (awk, x);
|
||||
@ -1979,7 +1979,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
}
|
||||
nde->len = ASE_AWK_STR_LEN(&awk->token.name);
|
||||
|
||||
ase_awk_assert (awk,
|
||||
ASE_AWK_ASSERT (awk,
|
||||
ASE_AWK_STR_LEN(&awk->token.name) ==
|
||||
ase_awk_strlen(ASE_AWK_STR_BUF(&awk->token.name)));
|
||||
|
||||
@ -2015,7 +2015,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
}
|
||||
nde->len = ASE_AWK_STR_LEN(&awk->token.name);
|
||||
|
||||
ase_awk_assert (awk,
|
||||
ASE_AWK_ASSERT (awk,
|
||||
ASE_AWK_STR_LEN(&awk->token.name) ==
|
||||
ase_awk_strlen(ASE_AWK_STR_BUF(&awk->token.name)));
|
||||
|
||||
@ -2066,7 +2066,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
SET_TOKEN_TYPE (awk, TOKEN_REX);
|
||||
ase_awk_str_clear (&awk->token.name);
|
||||
if (__get_rexstr (awk) == -1) return ASE_NULL;
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_REX));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_REX));
|
||||
|
||||
nde = (ase_awk_nde_rex_t*) ASE_AWK_MALLOC (
|
||||
awk, ase_sizeof(ase_awk_nde_rex_t));
|
||||
@ -2146,7 +2146,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
|
||||
/* parse subsequent expressions separated by a comma, if any */
|
||||
last = nde;
|
||||
ase_awk_assert (awk, last->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, last->next == ASE_NULL);
|
||||
|
||||
while (MATCH(awk,TOKEN_COMMA))
|
||||
{
|
||||
@ -2165,7 +2165,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
ase_awk_assert (awk, tmp->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, tmp->next == ASE_NULL);
|
||||
last->next = tmp;
|
||||
last = tmp;
|
||||
}
|
||||
@ -2280,7 +2280,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk)
|
||||
ase_size_t name_len;
|
||||
ase_awk_bfn_t* bfn;
|
||||
|
||||
ase_awk_assert (awk, MATCH(awk,TOKEN_IDENT));
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_IDENT));
|
||||
|
||||
name_dup = ase_awk_strxdup (
|
||||
awk,
|
||||
@ -2437,7 +2437,7 @@ static ase_awk_nde_t* __parse_hashidx (
|
||||
|
||||
if (idx == ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (awk, last == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, last == ASE_NULL);
|
||||
idx = tmp; last = tmp;
|
||||
}
|
||||
else
|
||||
@ -2448,7 +2448,7 @@ static ase_awk_nde_t* __parse_hashidx (
|
||||
}
|
||||
while (MATCH(awk,TOKEN_COMMA));
|
||||
|
||||
ase_awk_assert (awk, idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, idx != ASE_NULL);
|
||||
|
||||
if (!MATCH(awk,TOKEN_RBRACK))
|
||||
{
|
||||
@ -3661,7 +3661,7 @@ static int __get_number (ase_awk_t* awk)
|
||||
{
|
||||
ase_cint_t c;
|
||||
|
||||
ase_awk_assert (awk, ASE_AWK_STR_LEN(&awk->token.name) == 0);
|
||||
ASE_AWK_ASSERT (awk, ASE_AWK_STR_LEN(&awk->token.name) == 0);
|
||||
SET_TOKEN_TYPE (awk, TOKEN_INT);
|
||||
|
||||
c = awk->src.lex.curc;
|
||||
@ -4147,7 +4147,7 @@ static int __deparse (ase_awk_t* awk)
|
||||
struct __deparse_func_t df;
|
||||
int n = 0, op;
|
||||
|
||||
ase_awk_assert (awk, awk->src.ios->out != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, awk->src.ios->out != ASE_NULL);
|
||||
|
||||
awk->src.shared.buf_len = 0;
|
||||
awk->src.shared.buf_pos = 0;
|
||||
@ -4184,7 +4184,7 @@ static int __deparse (ase_awk_t* awk)
|
||||
{
|
||||
ase_size_t i, len;
|
||||
|
||||
ase_awk_assert (awk, awk->tree.nglobals > 0);
|
||||
ASE_AWK_ASSERT (awk, awk->tree.nglobals > 0);
|
||||
if (ase_awk_putsrcstr (awk, ASE_T("global ")) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
|
||||
@ -4192,7 +4192,7 @@ static int __deparse (ase_awk_t* awk)
|
||||
{
|
||||
len = ase_awk_longtostr ((ase_long_t)i,
|
||||
10, ASE_T("__global"), tmp, ase_countof(tmp));
|
||||
ase_awk_assert (awk, len != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, len != (ase_size_t)-1);
|
||||
if (ase_awk_putsrcstrx (awk, tmp, len) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
if (ase_awk_putsrcstr (awk, ASE_T(", ")) == -1)
|
||||
@ -4201,7 +4201,7 @@ static int __deparse (ase_awk_t* awk)
|
||||
|
||||
len = ase_awk_longtostr ((ase_long_t)i,
|
||||
10, ASE_T("__global"), tmp, ase_countof(tmp));
|
||||
ase_awk_assert (awk, len != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, len != (ase_size_t)-1);
|
||||
if (ase_awk_putsrcstrx (awk, tmp, len) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
if (ase_awk_putsrcstr (awk, ASE_T(";\n\n")) == -1)
|
||||
@ -4286,7 +4286,7 @@ static int __deparse_func (ase_awk_pair_t* pair, void* arg)
|
||||
ase_awk_afn_t* afn = (ase_awk_afn_t*)pair->val;
|
||||
ase_size_t i, n;
|
||||
|
||||
ase_awk_assert (df->awk, ase_awk_strxncmp (
|
||||
ASE_AWK_ASSERT (df->awk, ase_awk_strxncmp (
|
||||
pair->key, pair->key_len, afn->name, afn->name_len) == 0);
|
||||
|
||||
if (ase_awk_putsrcstr (df->awk, ASE_T("function ")) == -1) return -1;
|
||||
@ -4297,7 +4297,7 @@ static int __deparse_func (ase_awk_pair_t* pair, void* arg)
|
||||
{
|
||||
n = ase_awk_longtostr (i++, 10,
|
||||
ASE_T("__param"), df->tmp, df->tmp_len);
|
||||
ase_awk_assert (df->awk, n != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (df->awk, n != (ase_size_t)-1);
|
||||
if (ase_awk_putsrcstrx (df->awk, df->tmp, n) == -1) return -1;
|
||||
if (i >= afn->nargs) break;
|
||||
if (ase_awk_putsrcstr (df->awk, ASE_T(", ")) == -1) return -1;
|
||||
@ -4325,7 +4325,7 @@ static int __flush (ase_awk_t* awk)
|
||||
{
|
||||
ase_ssize_t n;
|
||||
|
||||
ase_awk_assert (awk, awk->src.ios->out != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, awk->src.ios->out != ASE_NULL);
|
||||
|
||||
while (awk->src.shared.buf_pos < awk->src.shared.buf_len)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: rec.c,v 1.5 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: rec.c,v 1.6 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -42,7 +42,7 @@ int ase_awk_setrec (
|
||||
return -1;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, run->inrec.d0->type == ASE_AWK_VAL_NIL);
|
||||
ASE_AWK_ASSERT (run->awk, run->inrec.d0->type == ASE_AWK_VAL_NIL);
|
||||
/* d0 should be cleared before the next line is reached
|
||||
* as it doesn't call ase_awk_refdownval on run->inrec.d0 */
|
||||
run->inrec.d0 = v;
|
||||
@ -95,7 +95,7 @@ static int __split_record (ase_awk_run_t* run)
|
||||
int errnum;
|
||||
|
||||
/* inrec should be cleared before __split_record is called */
|
||||
ase_awk_assert (run->awk, run->inrec.nflds == 0);
|
||||
ASE_AWK_ASSERT (run->awk, run->inrec.nflds == 0);
|
||||
|
||||
/* get FS */
|
||||
fs = ase_awk_getglobal (run, ASE_AWK_GLOBAL_FS);
|
||||
@ -152,7 +152,7 @@ static int __split_record (ase_awk_run_t* run)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(tok != ASE_NULL && tok_len > 0) || tok_len == 0);
|
||||
|
||||
nflds++;
|
||||
@ -202,7 +202,7 @@ static int __split_record (ase_awk_run_t* run)
|
||||
}
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(tok != ASE_NULL && tok_len > 0) || tok_len == 0);
|
||||
|
||||
run->inrec.flds[run->inrec.nflds].ptr = tok;
|
||||
@ -236,7 +236,7 @@ static int __split_record (ase_awk_run_t* run)
|
||||
|
||||
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, v) == -1) return -1;
|
||||
|
||||
ase_awk_assert (run->awk, nflds == run->inrec.nflds);
|
||||
ASE_AWK_ASSERT (run->awk, nflds == run->inrec.nflds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -253,11 +253,11 @@ int ase_awk_clrrec (ase_awk_run_t* run, ase_bool_t skip_inrec_line)
|
||||
|
||||
if (run->inrec.nflds > 0)
|
||||
{
|
||||
ase_awk_assert (run->awk, run->inrec.flds != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, run->inrec.flds != ASE_NULL);
|
||||
|
||||
for (i = 0; i < run->inrec.nflds; i++)
|
||||
{
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
run->inrec.flds[i].val != ASE_NULL);
|
||||
ase_awk_refdownval (run, run->inrec.flds[i].val);
|
||||
}
|
||||
@ -273,7 +273,7 @@ int ase_awk_clrrec (ase_awk_run_t* run, ase_bool_t skip_inrec_line)
|
||||
}
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, run->inrec.nflds == 0);
|
||||
ASE_AWK_ASSERT (run->awk, run->inrec.nflds == 0);
|
||||
if (!skip_inrec_line) ase_awk_str_clear (&run->inrec.line);
|
||||
|
||||
return n;
|
||||
@ -289,7 +289,7 @@ static int __recomp_record_fields (
|
||||
/* recomposes the record and the fields when $N has been assigned
|
||||
* a new value and recomputes NF accordingly */
|
||||
|
||||
ase_awk_assert (run->awk, lv > 0);
|
||||
ASE_AWK_ASSERT (run->awk, lv > 0);
|
||||
max = (lv > run->inrec.nflds)? lv: run->inrec.nflds;
|
||||
|
||||
nflds = run->inrec.nflds;
|
||||
@ -424,7 +424,7 @@ static int __recomp_record_fields (
|
||||
}
|
||||
|
||||
v = ase_awk_getglobal (run, ASE_AWK_GLOBAL_NF);
|
||||
ase_awk_assert (run->awk, v->type == ASE_AWK_VAL_INT);
|
||||
ASE_AWK_ASSERT (run->awk, v->type == ASE_AWK_VAL_INT);
|
||||
if (((ase_awk_val_int_t*)v)->val != max)
|
||||
{
|
||||
v = ase_awk_makeintval (run, (ase_long_t)max);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: rex.c,v 1.39 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: rex.c,v 1.40 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -384,7 +384,7 @@ int ase_awk_matchrex (
|
||||
|
||||
void ase_awk_freerex (ase_awk_t* awk, void* code)
|
||||
{
|
||||
ase_awk_assert (awk, code != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, code != ASE_NULL);
|
||||
ASE_AWK_FREE (awk, code);
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ ase_bool_t ase_awk_isemptyrex (ase_awk_t* awk, void* code)
|
||||
const ase_byte_t* p = code;
|
||||
ase_size_t nb, el;
|
||||
|
||||
ase_awk_assert (awk, p != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, p != ASE_NULL);
|
||||
|
||||
nb = *(ase_size_t*)p; p += ase_sizeof(nb);
|
||||
el = *(ase_size_t*)p; p += ase_sizeof(el);
|
||||
@ -598,7 +598,7 @@ static int __build_atom (__builder_t* builder)
|
||||
n = __build_charset (builder, cmd);
|
||||
if (n == -1) return -1;
|
||||
|
||||
ase_awk_assert (builder->awk, n != 0);
|
||||
ASE_AWK_ASSERT (builder->awk, n != 0);
|
||||
|
||||
if (builder->ptn.curc.type != CT_SPECIAL ||
|
||||
builder->ptn.curc.value != ASE_T(']'))
|
||||
@ -615,7 +615,7 @@ static int __build_atom (__builder_t* builder)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (builder->awk, builder->ptn.curc.type == CT_NORMAL);
|
||||
ASE_AWK_ASSERT (builder->awk, builder->ptn.curc.type == CT_NORMAL);
|
||||
|
||||
tmp.cmd = CMD_ORD_CHAR;
|
||||
tmp.negate = 0;
|
||||
@ -1145,7 +1145,7 @@ static const ase_byte_t* __match_atom (
|
||||
__match_group
|
||||
};
|
||||
|
||||
ase_awk_assert (matcher->awk,
|
||||
ASE_AWK_ASSERT (matcher->awk,
|
||||
((struct __code_t*)base)->cmd >= 0 &&
|
||||
((struct __code_t*)base)->cmd < ase_countof(matchers));
|
||||
|
||||
@ -1159,7 +1159,7 @@ static const ase_byte_t* __match_bol (
|
||||
const struct __code_t* cp;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_BOL);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_BOL);
|
||||
|
||||
mat->matched = (mat->match_ptr == matcher->match.str.ptr ||
|
||||
(cp->lbound == cp->ubound && cp->lbound == 0));
|
||||
@ -1175,7 +1175,7 @@ static const ase_byte_t* __match_eol (
|
||||
const struct __code_t* cp;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_EOL);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_EOL);
|
||||
|
||||
mat->matched = (mat->match_ptr == matcher->match.str.end ||
|
||||
(cp->lbound == cp->ubound && cp->lbound == 0));
|
||||
@ -1192,7 +1192,7 @@ static const ase_byte_t* __match_any_char (
|
||||
ase_size_t si = 0, lbound, ubound;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_ANY_CHAR);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_ANY_CHAR);
|
||||
|
||||
lbound = cp->lbound;
|
||||
ubound = cp->ubound;
|
||||
@ -1242,7 +1242,7 @@ static const ase_byte_t* __match_ord_char (
|
||||
ase_char_t cc;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_ORD_CHAR);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_ORD_CHAR);
|
||||
|
||||
lbound = cp->lbound;
|
||||
ubound = cp->ubound;
|
||||
@ -1330,7 +1330,7 @@ static const ase_byte_t* __match_charset (
|
||||
ase_char_t c;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_CHARSET);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_CHARSET);
|
||||
|
||||
lbound = cp->lbound;
|
||||
ubound = cp->ubound;
|
||||
@ -1374,7 +1374,7 @@ static const ase_byte_t* __match_group (
|
||||
ase_size_t si = 0, grp_len_static[16], * grp_len;
|
||||
|
||||
cp = (const struct __code_t*)p; p += ase_sizeof(*cp);
|
||||
ase_awk_assert (matcher->awk, cp->cmd == CMD_GROUP);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->cmd == CMD_GROUP);
|
||||
|
||||
mat->matched = ase_false;
|
||||
mat->match_len = 0;
|
||||
@ -1455,7 +1455,7 @@ static const ase_byte_t* __match_group (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (matcher->awk, cp->ubound > cp->lbound);
|
||||
ASE_AWK_ASSERT (matcher->awk, cp->ubound > cp->lbound);
|
||||
|
||||
do
|
||||
{
|
||||
@ -1500,7 +1500,7 @@ static const ase_byte_t* __match_occurrences (
|
||||
__matcher_t* matcher, ase_size_t si, const ase_byte_t* p,
|
||||
ase_size_t lbound, ase_size_t ubound, __match_t* mat)
|
||||
{
|
||||
ase_awk_assert (matcher->awk, si >= lbound && si <= ubound);
|
||||
ASE_AWK_ASSERT (matcher->awk, si >= lbound && si <= ubound);
|
||||
/* the match has been found */
|
||||
|
||||
if (lbound == ubound || p >= mat->branch_end)
|
||||
@ -1553,7 +1553,7 @@ static const ase_byte_t* __match_occurrences (
|
||||
* lbound in the implementation below, though)
|
||||
*/
|
||||
|
||||
ase_awk_assert (matcher->awk, ubound > lbound);
|
||||
ASE_AWK_ASSERT (matcher->awk, ubound > lbound);
|
||||
|
||||
do
|
||||
{
|
||||
@ -1625,7 +1625,7 @@ ase_bool_t __test_charset (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (matcher->awk,
|
||||
ASE_AWK_ASSERT (matcher->awk,
|
||||
!"should never happen - invalid charset code");
|
||||
break;
|
||||
}
|
||||
|
200
ase/awk/run.c
200
ase/awk/run.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.243 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: run.c,v 1.244 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -185,7 +185,7 @@ static ase_awk_val_t* __eval_getline (ase_awk_run_t* run, ase_awk_nde_t* nde);
|
||||
static int __raw_push (ase_awk_run_t* run, void* val);
|
||||
#define __raw_pop(run) \
|
||||
do { \
|
||||
ase_awk_assert (run->awk, (run)->stack_top > (run)->stack_base); \
|
||||
ASE_AWK_ASSERT (run->awk, (run)->stack_top > (run)->stack_base); \
|
||||
(run)->stack_top--; \
|
||||
} while (0)
|
||||
static void __raw_pop_times (ase_awk_run_t* run, ase_size_t times);
|
||||
@ -271,7 +271,7 @@ int ase_awk_setglobal (ase_awk_run_t* run, ase_size_t idx, ase_awk_val_t* val)
|
||||
{
|
||||
/* due to the expression evaluation rule, the
|
||||
* regular expression can not be an assigned value */
|
||||
ase_awk_assert (run->awk, val->type != ASE_AWK_VAL_REX);
|
||||
ASE_AWK_ASSERT (run->awk, val->type != ASE_AWK_VAL_REX);
|
||||
|
||||
fs_ptr = ase_awk_valtostr (
|
||||
run, val, ASE_AWK_VALTOSTR_CLEAR, ASE_NULL, &fs_len);
|
||||
@ -389,7 +389,7 @@ int ase_awk_setglobal (ase_awk_run_t* run, ase_size_t idx, ase_awk_val_t* val)
|
||||
{
|
||||
/* due to the expression evaluation rule, the
|
||||
* regular expression can not be an assigned value */
|
||||
ase_awk_assert (run->awk, val->type != ASE_AWK_VAL_REX);
|
||||
ASE_AWK_ASSERT (run->awk, val->type != ASE_AWK_VAL_REX);
|
||||
|
||||
rs_ptr = ase_awk_valtostr (
|
||||
run, val, ASE_AWK_VALTOSTR_CLEAR, ASE_NULL, &rs_len);
|
||||
@ -555,7 +555,7 @@ int ase_awk_stop (ase_awk_t* awk, ase_awk_run_t* run)
|
||||
{
|
||||
if (r == run)
|
||||
{
|
||||
ase_awk_assert (run->awk, r->awk == awk);
|
||||
ASE_AWK_ASSERT (run->awk, r->awk == awk);
|
||||
r->exit_level = EXIT_ABORT;
|
||||
break;
|
||||
}
|
||||
@ -611,7 +611,7 @@ static void __del_run (ase_awk_t* awk, ase_awk_run_t* run)
|
||||
{
|
||||
ASE_AWK_LOCK (awk);
|
||||
|
||||
ase_awk_assert (run->awk, awk->run.ptr != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, awk->run.ptr != ASE_NULL);
|
||||
|
||||
if (run->prev == ASE_NULL)
|
||||
{
|
||||
@ -700,7 +700,7 @@ static void __deinit_run (ase_awk_run_t* run)
|
||||
/* close all pending eio's */
|
||||
/* TODO: what if this operation fails? */
|
||||
ase_awk_clearextio (run);
|
||||
ase_awk_assert (run->awk, run->extio.chain == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, run->extio.chain == ASE_NULL);
|
||||
|
||||
if (run->global.rs != ASE_NULL)
|
||||
{
|
||||
@ -768,7 +768,7 @@ static void __deinit_run (ase_awk_run_t* run)
|
||||
/* destroy run stack */
|
||||
if (run->stack != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (run->awk, run->stack_top == 0);
|
||||
ASE_AWK_ASSERT (run->awk, run->stack_top == 0);
|
||||
|
||||
ASE_AWK_FREE (run->awk, run->stack);
|
||||
run->stack = ASE_NULL;
|
||||
@ -833,7 +833,7 @@ static int __build_runarg (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
|
||||
key_len = ase_awk_longtostr (
|
||||
argc, 10, ASE_NULL, key, ase_countof(key));
|
||||
ase_awk_assert (run->awk, key_len != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (run->awk, key_len != (ase_size_t)-1);
|
||||
|
||||
/* increment reference count of v_tmp in advance as if
|
||||
* it has successfully been assigned into ARGV. */
|
||||
@ -867,7 +867,7 @@ static int __build_runarg (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
|
||||
ase_awk_refupval (v_argc);
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
STACK_GLOBAL(run,ASE_AWK_GLOBAL_ARGC) == ase_awk_val_nil);
|
||||
|
||||
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_ARGC, v_argc) == -1)
|
||||
@ -958,7 +958,7 @@ static int __set_globals_to_default (ase_awk_run_t* run)
|
||||
|
||||
ase_awk_refupval (tmp);
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
STACK_GLOBAL(run,gtab[i].idx) == ase_awk_val_nil);
|
||||
|
||||
if (ase_awk_setglobal (run, gtab[i].idx, tmp) == -1)
|
||||
@ -986,7 +986,7 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
ase_awk_val_t* v;
|
||||
int n;
|
||||
|
||||
ase_awk_assert (run->awk, run->stack_base == 0 && run->stack_top == 0);
|
||||
ASE_AWK_ASSERT (run->awk, run->stack_base == 0 && run->stack_top == 0);
|
||||
|
||||
/* secure space for global variables */
|
||||
saved_stack_top = run->stack_top;
|
||||
@ -1110,7 +1110,7 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
ase_awk_nde_blk_t* blk;
|
||||
|
||||
blk = (ase_awk_nde_blk_t*)run->awk->tree.begin;
|
||||
ase_awk_assert (run->awk, blk->type == ASE_AWK_NDE_BLK);
|
||||
ASE_AWK_ASSERT (run->awk, blk->type == ASE_AWK_NDE_BLK);
|
||||
|
||||
run->active_block = blk;
|
||||
run->exit_level = EXIT_NONE;
|
||||
@ -1131,7 +1131,7 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
ase_awk_nde_blk_t* blk;
|
||||
|
||||
blk = (ase_awk_nde_blk_t*)run->awk->tree.end;
|
||||
ase_awk_assert (run->awk, blk->type == ASE_AWK_NDE_BLK);
|
||||
ASE_AWK_ASSERT (run->awk, blk->type == ASE_AWK_NDE_BLK);
|
||||
|
||||
run->active_block = blk;
|
||||
run->exit_level = EXIT_NONE;
|
||||
@ -1140,7 +1140,7 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
|
||||
/* restore stack */
|
||||
nargs = (ase_size_t)STACK_NARGS(run);
|
||||
ase_awk_assert (run->awk, nargs == 0);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == 0);
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
ase_awk_refdownval (run, STACK_ARG(run,i));
|
||||
@ -1313,7 +1313,7 @@ static int __run_pattern_block (
|
||||
else
|
||||
{
|
||||
/* pattern, pattern { ... } */
|
||||
ase_awk_assert (run->awk, ptn->next->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, ptn->next->next == ASE_NULL);
|
||||
|
||||
if (run->pattern_range_state[block_no] == 0)
|
||||
{
|
||||
@ -1394,7 +1394,7 @@ static int __run_block (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, nde->type == ASE_AWK_NDE_BLK);
|
||||
ASE_AWK_ASSERT (run->awk, nde->type == ASE_AWK_NDE_BLK);
|
||||
|
||||
p = nde->body;
|
||||
nlocals = nde->nlocals;
|
||||
@ -1567,7 +1567,7 @@ static int __run_if (ase_awk_run_t* run, ase_awk_nde_if_t* nde)
|
||||
/* the test expression for the if statement cannot have
|
||||
* chained expressions. this should not be allowed by the
|
||||
* parser first of all */
|
||||
ase_awk_assert (run->awk, nde->test->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->test->next == ASE_NULL);
|
||||
|
||||
test = __eval_expression (run, nde->test);
|
||||
if (test == ASE_NULL) return -1;
|
||||
@ -1594,7 +1594,7 @@ static int __run_while (ase_awk_run_t* run, ase_awk_nde_while_t* nde)
|
||||
{
|
||||
/* no chained expressions are allowed for the test
|
||||
* expression of the while statement */
|
||||
ase_awk_assert (run->awk, nde->test->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->test->next == ASE_NULL);
|
||||
|
||||
/* TODO: handle run-time abortion... */
|
||||
while (1)
|
||||
@ -1636,7 +1636,7 @@ static int __run_while (ase_awk_run_t* run, ase_awk_nde_while_t* nde)
|
||||
{
|
||||
/* no chained expressions are allowed for the test
|
||||
* expression of the while statement */
|
||||
ase_awk_assert (run->awk, nde->test->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->test->next == ASE_NULL);
|
||||
|
||||
/* TODO: handle run-time abortion... */
|
||||
do
|
||||
@ -1679,7 +1679,7 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde)
|
||||
|
||||
if (nde->init != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (run->awk, nde->init->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->init->next == ASE_NULL);
|
||||
val = __eval_expression(run,nde->init);
|
||||
if (val == ASE_NULL) return -1;
|
||||
|
||||
@ -1695,7 +1695,7 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde)
|
||||
|
||||
/* no chained expressions for the test expression of
|
||||
* the for statement are allowed */
|
||||
ase_awk_assert (run->awk, nde->test->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->test->next == ASE_NULL);
|
||||
|
||||
test = __eval_expression (run, nde->test);
|
||||
if (test == ASE_NULL) return -1;
|
||||
@ -1738,7 +1738,7 @@ static int __run_for (ase_awk_run_t* run, ase_awk_nde_for_t* nde)
|
||||
|
||||
if (nde->incr != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (run->awk, nde->incr->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->incr->next == ASE_NULL);
|
||||
val = __eval_expression(run,nde->incr);
|
||||
if (val == ASE_NULL) return -1;
|
||||
|
||||
@ -1792,12 +1792,12 @@ static int __run_foreach (ase_awk_run_t* run, ase_awk_nde_foreach_t* nde)
|
||||
struct __foreach_walker_t walker;
|
||||
|
||||
test = (ase_awk_nde_exp_t*)nde->test;
|
||||
ase_awk_assert (run->awk, test->type == ASE_AWK_NDE_EXP_BIN &&
|
||||
ASE_AWK_ASSERT (run->awk, test->type == ASE_AWK_NDE_EXP_BIN &&
|
||||
test->opcode == ASE_AWK_BINOP_IN);
|
||||
|
||||
/* chained expressions should not be allowed
|
||||
* by the parser first of all */
|
||||
ase_awk_assert (run->awk, test->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, test->right->next == ASE_NULL);
|
||||
|
||||
rv = __eval_expression (run, test->right);
|
||||
if (rv == ASE_NULL) return -1;
|
||||
@ -1839,7 +1839,7 @@ static int __run_return (ase_awk_run_t* run, ase_awk_nde_return_t* nde)
|
||||
|
||||
/* chained expressions should not be allowed
|
||||
* by the parser first of all */
|
||||
ase_awk_assert (run->awk, nde->val->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->val->next == ASE_NULL);
|
||||
|
||||
/*xp_printf (ASE_T("returning....\n"));*/
|
||||
val = __eval_expression (run, nde->val);
|
||||
@ -1863,7 +1863,7 @@ static int __run_exit (ase_awk_run_t* run, ase_awk_nde_exit_t* nde)
|
||||
|
||||
/* chained expressions should not be allowed
|
||||
* by the parser first of all */
|
||||
ase_awk_assert (run->awk, nde->val->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->val->next == ASE_NULL);
|
||||
|
||||
val = __eval_expression (run, nde->val);
|
||||
if (val == ASE_NULL) return -1;
|
||||
@ -1941,7 +1941,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
{
|
||||
ase_awk_pair_t* pair;
|
||||
|
||||
ase_awk_assert (run->awk, (var->type == ASE_AWK_NDE_NAMED &&
|
||||
ASE_AWK_ASSERT (run->awk, (var->type == ASE_AWK_NDE_NAMED &&
|
||||
var->idx == ASE_NULL) ||
|
||||
(var->type == ASE_AWK_NDE_NAMEDIDX &&
|
||||
var->idx != ASE_NULL));
|
||||
@ -1974,7 +1974,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
ase_awk_map_t* map;
|
||||
|
||||
val = (ase_awk_val_t*)pair->val;
|
||||
ase_awk_assert (run->awk, val != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, val != ASE_NULL);
|
||||
|
||||
if (val->type != ASE_AWK_VAL_MAP)
|
||||
PANIC_I (run, ASE_AWK_ENOTDELETABLE);
|
||||
@ -1986,7 +1986,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
ase_size_t key_len;
|
||||
ase_awk_val_t* idx;
|
||||
|
||||
ase_awk_assert (run->awk, var->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, var->idx != ASE_NULL);
|
||||
|
||||
idx = __eval_expression (run, var->idx);
|
||||
if (idx == ASE_NULL) return -1;
|
||||
@ -2024,7 +2024,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
val = STACK_LOCAL (run,var->id.idxa);
|
||||
else val = STACK_ARG (run,var->id.idxa);
|
||||
|
||||
ase_awk_assert (run->awk, val != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, val != ASE_NULL);
|
||||
|
||||
if (val->type == ASE_AWK_VAL_NIL)
|
||||
{
|
||||
@ -2077,7 +2077,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
ase_size_t key_len;
|
||||
ase_awk_val_t* idx;
|
||||
|
||||
ase_awk_assert (run->awk, var->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, var->idx != ASE_NULL);
|
||||
|
||||
idx = __eval_expression (run, var->idx);
|
||||
if (idx == ASE_NULL) return -1;
|
||||
@ -2100,7 +2100,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, !"should never happen - wrong variable type for delete");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - wrong variable type for delete");
|
||||
PANIC_I (run, ASE_AWK_EINTERNAL);
|
||||
}
|
||||
|
||||
@ -2116,7 +2116,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
ase_awk_nde_t* np;
|
||||
int n;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(p->out_type == ASE_AWK_OUT_PIPE && p->out != ASE_NULL) ||
|
||||
(p->out_type == ASE_AWK_OUT_COPROC && p->out != ASE_NULL) ||
|
||||
(p->out_type == ASE_AWK_OUT_FILE && p->out != ASE_NULL) ||
|
||||
@ -2276,7 +2276,7 @@ static ase_awk_val_t* __eval_expression (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, run->inrec.d0->type == ASE_AWK_VAL_STR);
|
||||
ASE_AWK_ASSERT (run->awk, run->inrec.d0->type == ASE_AWK_VAL_STR);
|
||||
|
||||
n = ase_awk_matchrex (
|
||||
((ase_awk_run_t*)run)->awk,
|
||||
@ -2333,7 +2333,7 @@ static ase_awk_val_t* __eval_expression0 (ase_awk_run_t* run, ase_awk_nde_t* nde
|
||||
__eval_getline
|
||||
};
|
||||
|
||||
ase_awk_assert (run->awk, nde->type >= ASE_AWK_NDE_GRP &&
|
||||
ASE_AWK_ASSERT (run->awk, nde->type >= ASE_AWK_NDE_GRP &&
|
||||
(nde->type - ASE_AWK_NDE_GRP) < ase_countof(__eval_func));
|
||||
|
||||
return __eval_func[nde->type-ASE_AWK_NDE_GRP] (run, nde);
|
||||
@ -2343,7 +2343,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_ASSERT (run->awk, !"should never happen - NDE_GRP only for in");
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
return ASE_NULL;
|
||||
}
|
||||
@ -2353,9 +2353,9 @@ static ase_awk_val_t* __eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_val_t* val, * ret;
|
||||
ase_awk_nde_ass_t* ass = (ase_awk_nde_ass_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, ass->left != ASE_NULL && ass->right != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, ass->left != ASE_NULL && ass->right != ASE_NULL);
|
||||
|
||||
ase_awk_assert (run->awk, ass->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, ass->right->next == ASE_NULL);
|
||||
val = __eval_expression (run, ass->right);
|
||||
if (val == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -2365,7 +2365,7 @@ static ase_awk_val_t* __eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
{
|
||||
ase_awk_val_t* val2, * tmp;
|
||||
|
||||
ase_awk_assert (run->awk, ass->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, ass->left->next == ASE_NULL);
|
||||
val2 = __eval_expression (run, ass->left);
|
||||
if (val2 == ASE_NULL)
|
||||
{
|
||||
@ -2401,7 +2401,7 @@ static ase_awk_val_t* __eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, !"should never happen - invalid assignment opcode");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid assignment opcode");
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
}
|
||||
|
||||
@ -2454,7 +2454,7 @@ static ase_awk_val_t* __do_assignment (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, !"should never happen - invalid variable type");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid variable type");
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
}
|
||||
|
||||
@ -2464,13 +2464,13 @@ static ase_awk_val_t* __do_assignment (
|
||||
static ase_awk_val_t* __do_assignment_scalar (
|
||||
ase_awk_run_t* run, ase_awk_nde_var_t* var, ase_awk_val_t* val)
|
||||
{
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(var->type == ASE_AWK_NDE_NAMED ||
|
||||
var->type == ASE_AWK_NDE_GLOBAL ||
|
||||
var->type == ASE_AWK_NDE_LOCAL ||
|
||||
var->type == ASE_AWK_NDE_ARG) && var->idx == ASE_NULL);
|
||||
|
||||
ase_awk_assert (run->awk, val->type != ASE_AWK_VAL_MAP);
|
||||
ASE_AWK_ASSERT (run->awk, val->type != ASE_AWK_VAL_MAP);
|
||||
|
||||
if (var->type == ASE_AWK_NDE_NAMED)
|
||||
{
|
||||
@ -2538,12 +2538,12 @@ static ase_awk_val_t* __do_assignment_map (
|
||||
ase_size_t len;
|
||||
int n;
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
(var->type == ASE_AWK_NDE_NAMEDIDX ||
|
||||
var->type == ASE_AWK_NDE_GLOBALIDX ||
|
||||
var->type == ASE_AWK_NDE_LOCALIDX ||
|
||||
var->type == ASE_AWK_NDE_ARGIDX) && var->idx != ASE_NULL);
|
||||
ase_awk_assert (run->awk, val->type != ASE_AWK_VAL_MAP);
|
||||
ASE_AWK_ASSERT (run->awk, val->type != ASE_AWK_VAL_MAP);
|
||||
|
||||
if (var->type == ASE_AWK_NDE_NAMEDIDX)
|
||||
{
|
||||
@ -2714,7 +2714,7 @@ static ase_awk_val_t* __eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_nde_exp_t* exp = (ase_awk_nde_exp_t*)nde;
|
||||
ase_awk_val_t* left, * right, * res;
|
||||
|
||||
ase_awk_assert (run->awk, exp->type == ASE_AWK_NDE_EXP_BIN);
|
||||
ASE_AWK_ASSERT (run->awk, exp->type == ASE_AWK_NDE_EXP_BIN);
|
||||
|
||||
if (exp->opcode == ASE_AWK_BINOP_LAND)
|
||||
{
|
||||
@ -2739,13 +2739,13 @@ static ase_awk_val_t* __eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, exp->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left->next == ASE_NULL);
|
||||
left = __eval_expression (run, exp->left);
|
||||
if (left == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_awk_refupval (left);
|
||||
|
||||
ase_awk_assert (run->awk, exp->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->right->next == ASE_NULL);
|
||||
right = __eval_expression (run, exp->right);
|
||||
if (right == ASE_NULL)
|
||||
{
|
||||
@ -2755,9 +2755,9 @@ static ase_awk_val_t* __eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
|
||||
ase_awk_refupval (right);
|
||||
|
||||
ase_awk_assert (run->awk, exp->opcode >= 0 &&
|
||||
ASE_AWK_ASSERT (run->awk, exp->opcode >= 0 &&
|
||||
exp->opcode < ase_countof(__binop_func));
|
||||
ase_awk_assert (run->awk, __binop_func[exp->opcode] != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, __binop_func[exp->opcode] != ASE_NULL);
|
||||
|
||||
res = __binop_func[exp->opcode] (run, left, right);
|
||||
|
||||
@ -2784,7 +2784,7 @@ static ase_awk_val_t* __eval_binop_lor (
|
||||
/* short-circuit evaluation required special treatment */
|
||||
ase_awk_val_t* lv, * rv, * res;
|
||||
|
||||
ase_awk_assert (run->awk, left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, left->next == ASE_NULL);
|
||||
lv = __eval_expression (run, left);
|
||||
if (lv == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -2796,7 +2796,7 @@ static ase_awk_val_t* __eval_binop_lor (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, right->next == ASE_NULL);
|
||||
rv = __eval_expression (run, right);
|
||||
if (rv == ASE_NULL)
|
||||
{
|
||||
@ -2832,7 +2832,7 @@ static ase_awk_val_t* __eval_binop_land (
|
||||
/* short-circuit evaluation required special treatment */
|
||||
ase_awk_val_t* lv, * rv, * res;
|
||||
|
||||
ase_awk_assert (run->awk, left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, left->next == ASE_NULL);
|
||||
lv = __eval_expression (run, left);
|
||||
if (lv == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -2844,7 +2844,7 @@ static ase_awk_val_t* __eval_binop_land (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, right->next == ASE_NULL);
|
||||
rv = __eval_expression (run, right);
|
||||
if (rv == ASE_NULL)
|
||||
{
|
||||
@ -2877,7 +2877,7 @@ static ase_awk_val_t* __eval_binop_in (
|
||||
right->type != ASE_AWK_NDE_NAMED)
|
||||
{
|
||||
/* the compiler should have handled this case */
|
||||
ase_awk_assert (run->awk, !"should never happen - in needs a plain variable");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - in needs a plain variable");
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
return ASE_NULL;
|
||||
}
|
||||
@ -2889,7 +2889,7 @@ static ase_awk_val_t* __eval_binop_in (
|
||||
if (str == ASE_NULL) return ASE_NULL;
|
||||
|
||||
/* evaluate the right-hand side of the operator */
|
||||
ase_awk_assert (run->awk, right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, right->next == ASE_NULL);
|
||||
rv = __eval_expression (run, right);
|
||||
if (rv == ASE_NULL)
|
||||
{
|
||||
@ -3254,10 +3254,10 @@ static int __cmp_val (
|
||||
return CMP_ERROR;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
left->type >= ASE_AWK_VAL_NIL &&
|
||||
left->type <= ASE_AWK_VAL_STR);
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
right->type >= ASE_AWK_VAL_NIL &&
|
||||
right->type <= ASE_AWK_VAL_STR);
|
||||
|
||||
@ -3382,7 +3382,7 @@ static ase_awk_val_t* __eval_binop_plus (
|
||||
1 1 = 3
|
||||
*/
|
||||
n3 = n1 + (n2 << 1);
|
||||
ase_awk_assert (run->awk, n3 >= 0 && n3 <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, n3 >= 0 && n3 <= 3);
|
||||
res = (n3 == 0)? ase_awk_makeintval(run,(ase_long_t)l1+(ase_long_t)l2):
|
||||
(n3 == 1)? ase_awk_makerealval(run,(ase_real_t)r1+(ase_real_t)l2):
|
||||
(n3 == 2)? ase_awk_makerealval(run,(ase_real_t)l1+(ase_real_t)r2):
|
||||
@ -3406,7 +3406,7 @@ static ase_awk_val_t* __eval_binop_minus (
|
||||
if (n1 == -1 || n2 == -1) PANIC (run, ASE_AWK_EOPERAND);
|
||||
|
||||
n3 = n1 + (n2 << 1);
|
||||
ase_awk_assert (run->awk, n3 >= 0 && n3 <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, n3 >= 0 && n3 <= 3);
|
||||
res = (n3 == 0)? ase_awk_makeintval(run,(ase_long_t)l1-(ase_long_t)l2):
|
||||
(n3 == 1)? ase_awk_makerealval(run,(ase_real_t)r1-(ase_real_t)l2):
|
||||
(n3 == 2)? ase_awk_makerealval(run,(ase_real_t)l1-(ase_real_t)r2):
|
||||
@ -3430,7 +3430,7 @@ static ase_awk_val_t* __eval_binop_mul (
|
||||
if (n1 == -1 || n2 == -1) PANIC (run, ASE_AWK_EOPERAND);
|
||||
|
||||
n3 = n1 + (n2 << 1);
|
||||
ase_awk_assert (run->awk, n3 >= 0 && n3 <= 3);
|
||||
ASE_AWK_ASSERT (run->awk, n3 >= 0 && n3 <= 3);
|
||||
res = (n3 == 0)? ase_awk_makeintval(run,(ase_long_t)l1*(ase_long_t)l2):
|
||||
(n3 == 1)? ase_awk_makerealval(run,(ase_real_t)r1*(ase_real_t)l2):
|
||||
(n3 == 2)? ase_awk_makerealval(run,(ase_real_t)l1*(ase_real_t)r2):
|
||||
@ -3469,7 +3469,7 @@ static ase_awk_val_t* __eval_binop_div (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, n3 == 3);
|
||||
ASE_AWK_ASSERT (run->awk, n3 == 3);
|
||||
res = ase_awk_makerealval (run, (ase_real_t)r1 / (ase_real_t)r2);
|
||||
}
|
||||
|
||||
@ -3537,7 +3537,7 @@ static ase_awk_val_t* __eval_binop_exp (
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, n3 == 3);
|
||||
ASE_AWK_ASSERT (run->awk, n3 == 3);
|
||||
res = ase_awk_makerealval (
|
||||
run, pow((ase_real_t)r1,(ase_real_t)r2));
|
||||
}
|
||||
@ -3584,8 +3584,8 @@ static ase_awk_val_t* __eval_binop_ma (
|
||||
{
|
||||
ase_awk_val_t* lv, * rv, * res;
|
||||
|
||||
ase_awk_assert (run->awk, left->next == ASE_NULL);
|
||||
ase_awk_assert (run->awk, right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, right->next == ASE_NULL);
|
||||
|
||||
lv = __eval_expression (run, left);
|
||||
if (lv == ASE_NULL)
|
||||
@ -3617,8 +3617,8 @@ static ase_awk_val_t* __eval_binop_nm (
|
||||
{
|
||||
ase_awk_val_t* lv, * rv, * res;
|
||||
|
||||
ase_awk_assert (run->awk, left->next == ASE_NULL);
|
||||
ase_awk_assert (run->awk, right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, right->next == ASE_NULL);
|
||||
|
||||
lv = __eval_expression (run, left);
|
||||
if (lv == ASE_NULL) return ASE_NULL;
|
||||
@ -3747,10 +3747,10 @@ static ase_awk_val_t* __eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_val_t* left, * res = ASE_NULL;
|
||||
ase_awk_nde_exp_t* exp = (ase_awk_nde_exp_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, exp->type == ASE_AWK_NDE_EXP_UNR);
|
||||
ase_awk_assert (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->type == ASE_AWK_NDE_EXP_UNR);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
|
||||
ase_awk_assert (run->awk, exp->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left->next == ASE_NULL);
|
||||
left = __eval_expression (run, exp->left);
|
||||
if (left == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -3839,8 +3839,8 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_val_t* left, * res;
|
||||
ase_awk_nde_exp_t* exp = (ase_awk_nde_exp_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, exp->type == ASE_AWK_NDE_EXP_INCPRE);
|
||||
ase_awk_assert (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->type == ASE_AWK_NDE_EXP_INCPRE);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
|
||||
/* this way of checking if the l-value is assignable is
|
||||
* ugly as it is dependent of the values defined in tree.h.
|
||||
@ -3851,7 +3851,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
PANIC (run, ASE_AWK_EOPERAND);
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, exp->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left->next == ASE_NULL);
|
||||
left = __eval_expression (run, exp->left);
|
||||
if (left == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -3898,7 +3898,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else /* if (n == 1) */
|
||||
{
|
||||
ase_awk_assert (run->awk, n == 1);
|
||||
ASE_AWK_ASSERT (run->awk, n == 1);
|
||||
res = ase_awk_makerealval (run, v2 + 1.0);
|
||||
}
|
||||
|
||||
@ -3950,7 +3950,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else /* if (n == 1) */
|
||||
{
|
||||
ase_awk_assert (run->awk, n == 1);
|
||||
ASE_AWK_ASSERT (run->awk, n == 1);
|
||||
res = ase_awk_makerealval (run, v2 - 1.0);
|
||||
}
|
||||
|
||||
@ -3963,7 +3963,7 @@ static ase_awk_val_t* __eval_incpre (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, !"should never happen - invalid opcode");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid opcode");
|
||||
ase_awk_refdownval (run, left);
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
}
|
||||
@ -3983,8 +3983,8 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_val_t* left, * res, * res2;
|
||||
ase_awk_nde_exp_t* exp = (ase_awk_nde_exp_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, exp->type == ASE_AWK_NDE_EXP_INCPST);
|
||||
ase_awk_assert (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->type == ASE_AWK_NDE_EXP_INCPST);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left != ASE_NULL && exp->right == ASE_NULL);
|
||||
|
||||
/* this way of checking if the l-value is assignable is
|
||||
* ugly as it is dependent of the values defined in tree.h.
|
||||
@ -3995,7 +3995,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
PANIC (run, ASE_AWK_EOPERAND);
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, exp->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, exp->left->next == ASE_NULL);
|
||||
left = __eval_expression (run, exp->left);
|
||||
if (left == ASE_NULL) return ASE_NULL;
|
||||
|
||||
@ -4071,7 +4071,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else /* if (n == 1) */
|
||||
{
|
||||
ase_awk_assert (run->awk, n == 1);
|
||||
ASE_AWK_ASSERT (run->awk, n == 1);
|
||||
res = ase_awk_makerealval (run, v2);
|
||||
if (res == ASE_NULL)
|
||||
{
|
||||
@ -4159,7 +4159,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else /* if (n == 1) */
|
||||
{
|
||||
ase_awk_assert (run->awk, n == 1);
|
||||
ASE_AWK_ASSERT (run->awk, n == 1);
|
||||
res = ase_awk_makerealval (run, v2);
|
||||
if (res == ASE_NULL)
|
||||
{
|
||||
@ -4179,7 +4179,7 @@ static ase_awk_val_t* __eval_incpst (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk, !"should never happen - invalid opcode");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid opcode");
|
||||
ase_awk_refdownval (run, left);
|
||||
PANIC (run, ASE_AWK_EINTERNAL);
|
||||
}
|
||||
@ -4199,13 +4199,13 @@ static ase_awk_val_t* __eval_cnd (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
ase_awk_val_t* tv, * v;
|
||||
ase_awk_nde_cnd_t* cnd = (ase_awk_nde_cnd_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, cnd->test->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, cnd->test->next == ASE_NULL);
|
||||
tv = __eval_expression (run, cnd->test);
|
||||
if (tv == ASE_NULL) return ASE_NULL;
|
||||
|
||||
ase_awk_refupval (tv);
|
||||
|
||||
ase_awk_assert (run->awk, cnd->left->next == ASE_NULL &&
|
||||
ASE_AWK_ASSERT (run->awk, cnd->left->next == ASE_NULL &&
|
||||
cnd->right->next == ASE_NULL);
|
||||
v = (ase_awk_valtobool (run, tv))?
|
||||
__eval_expression (run, cnd->left):
|
||||
@ -4244,7 +4244,7 @@ static ase_awk_val_t* __eval_afn (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
if (pair == ASE_NULL) PANIC (run, ASE_AWK_ENOSUCHFUNC);
|
||||
|
||||
afn = (ase_awk_afn_t*)pair->val;
|
||||
ase_awk_assert (run->awk, afn != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, afn != ASE_NULL);
|
||||
|
||||
if (call->nargs > afn->nargs)
|
||||
{
|
||||
@ -4324,8 +4324,8 @@ static ase_awk_val_t* __eval_call (
|
||||
* ---------------------
|
||||
*/
|
||||
|
||||
ase_awk_assert (run->awk, ase_sizeof(void*) >= ase_sizeof(run->stack_top));
|
||||
ase_awk_assert (run->awk, ase_sizeof(void*) >= ase_sizeof(run->stack_base));
|
||||
ASE_AWK_ASSERT (run->awk, ase_sizeof(void*) >= ase_sizeof(run->stack_top));
|
||||
ASE_AWK_ASSERT (run->awk, ase_sizeof(void*) >= ase_sizeof(run->stack_base));
|
||||
|
||||
saved_stack_top = run->stack_top;
|
||||
|
||||
@ -4362,7 +4362,7 @@ static ase_awk_val_t* __eval_call (
|
||||
p = call->args;
|
||||
while (p != ASE_NULL)
|
||||
{
|
||||
ase_awk_assert (run->awk, bfn_arg_spec == ASE_NULL ||
|
||||
ASE_AWK_ASSERT (run->awk, bfn_arg_spec == ASE_NULL ||
|
||||
(bfn_arg_spec != ASE_NULL &&
|
||||
ase_awk_strlen(bfn_arg_spec) > nargs));
|
||||
|
||||
@ -4455,7 +4455,7 @@ static ase_awk_val_t* __eval_call (
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, nargs == call->nargs);
|
||||
ASE_AWK_ASSERT (run->awk, nargs == call->nargs);
|
||||
|
||||
if (afn != ASE_NULL)
|
||||
{
|
||||
@ -4482,7 +4482,7 @@ static ase_awk_val_t* __eval_call (
|
||||
if (afn != ASE_NULL)
|
||||
{
|
||||
/* normal awk function */
|
||||
ase_awk_assert (run->awk, afn->body->type == ASE_AWK_NDE_BLK);
|
||||
ASE_AWK_ASSERT (run->awk, afn->body->type == ASE_AWK_NDE_BLK);
|
||||
n = __run_block(run,(ase_awk_nde_blk_t*)afn->body);
|
||||
}
|
||||
else
|
||||
@ -4490,7 +4490,7 @@ static ase_awk_val_t* __eval_call (
|
||||
n = 0;
|
||||
|
||||
/* built-in function */
|
||||
ase_awk_assert (run->awk, call->nargs >= call->what.bfn.min_args &&
|
||||
ASE_AWK_ASSERT (run->awk, call->nargs >= call->what.bfn.min_args &&
|
||||
call->nargs <= call->what.bfn.max_args);
|
||||
|
||||
if (call->what.bfn.handler != ASE_NULL)
|
||||
@ -4650,7 +4650,7 @@ static ase_awk_val_t** __get_reference_indexed (
|
||||
ase_char_t* str;
|
||||
ase_size_t len;
|
||||
|
||||
ase_awk_assert (run->awk, val != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, val != ASE_NULL);
|
||||
|
||||
if ((*val)->type == ASE_AWK_VAL_NIL)
|
||||
{
|
||||
@ -4668,7 +4668,7 @@ static ase_awk_val_t** __get_reference_indexed (
|
||||
PANIC (run, ASE_AWK_ENOTINDEXABLE);
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, nde->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->idx != ASE_NULL);
|
||||
|
||||
str = __idxnde_to_str (run, nde->idx, &len);
|
||||
if (str == ASE_NULL) return ASE_NULL;
|
||||
@ -4772,7 +4772,7 @@ static ase_awk_val_t* __eval_indexed (
|
||||
ase_char_t* str;
|
||||
ase_size_t len;
|
||||
|
||||
ase_awk_assert (run->awk, val != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, val != ASE_NULL);
|
||||
|
||||
if ((*val)->type == ASE_AWK_VAL_NIL)
|
||||
{
|
||||
@ -4790,7 +4790,7 @@ static ase_awk_val_t* __eval_indexed (
|
||||
PANIC (run, ASE_AWK_ENOTINDEXABLE);
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, nde->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde->idx != ASE_NULL);
|
||||
|
||||
str = __idxnde_to_str (run, nde->idx, &len);
|
||||
if (str == ASE_NULL) return ASE_NULL;
|
||||
@ -4875,7 +4875,7 @@ static ase_awk_val_t* __eval_getline (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
|
||||
p = (ase_awk_nde_getline_t*)nde;
|
||||
|
||||
ase_awk_assert (run->awk, (p->in_type == ASE_AWK_IN_PIPE && p->in != ASE_NULL) ||
|
||||
ASE_AWK_ASSERT (run->awk, (p->in_type == ASE_AWK_IN_PIPE && p->in != ASE_NULL) ||
|
||||
(p->in_type == ASE_AWK_IN_COPROC && p->in != ASE_NULL) ||
|
||||
(p->in_type == ASE_AWK_IN_FILE && p->in != ASE_NULL) ||
|
||||
(p->in_type == ASE_AWK_IN_CONSOLE && p->in == ASE_NULL));
|
||||
@ -5063,7 +5063,7 @@ xp_printf (ASE_T("len = %d str=[%s]\n"),
|
||||
*/
|
||||
if (n == 0)
|
||||
{
|
||||
ase_awk_assert (run->awk, ASE_AWK_STR_LEN(&run->inrec.line) == 0);
|
||||
ASE_AWK_ASSERT (run->awk, ASE_AWK_STR_LEN(&run->inrec.line) == 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5081,7 +5081,7 @@ static int __shorten_record (ase_awk_run_t* run, ase_size_t nflds)
|
||||
ase_size_t ofs_len, i;
|
||||
ase_awk_str_t tmp;
|
||||
|
||||
ase_awk_assert (run->awk, nflds <= run->inrec.nflds);
|
||||
ASE_AWK_ASSERT (run->awk, nflds <= run->inrec.nflds);
|
||||
|
||||
if (nflds > 1)
|
||||
{
|
||||
@ -5172,7 +5172,7 @@ static ase_char_t* __idxnde_to_str (
|
||||
ase_char_t* str;
|
||||
ase_awk_val_t* idx;
|
||||
|
||||
ase_awk_assert (run->awk, nde != ASE_NULL);
|
||||
ASE_AWK_ASSERT (run->awk, nde != ASE_NULL);
|
||||
|
||||
if (nde->next == ASE_NULL)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tab.c,v 1.23 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: tab.c,v 1.24 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -53,7 +53,7 @@ ase_awk_tab_t* ase_awk_tab_setcapa (ase_awk_tab_t* tab, ase_size_t capa)
|
||||
if (tab->size > capa)
|
||||
{
|
||||
ase_awk_tab_remove (tab, capa, tab->size - capa);
|
||||
ase_awk_assert (tab->awk, tab->size <= capa);
|
||||
ASE_AWK_ASSERT (tab->awk, tab->size <= capa);
|
||||
}
|
||||
|
||||
if (capa > 0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.c,v 1.83 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: tree.c,v 1.84 2006-10-26 09:27:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -144,7 +144,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
PUT_SRCSTR (awk, ASE_T(" "));
|
||||
PRINT_EXPRESSION (awk, px->right);
|
||||
|
||||
ase_awk_assert (awk, px->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right->next == ASE_NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
|
||||
PUT_SRCSTR (awk, ASE_T("("));
|
||||
PRINT_EXPRESSION (awk, px->left);
|
||||
ase_awk_assert (awk, px->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->left->next == ASE_NULL);
|
||||
|
||||
PUT_SRCSTR (awk, ASE_T(" "));
|
||||
PUT_SRCSTR (awk, __binop_str[px->opcode]);
|
||||
@ -165,7 +165,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
PRINT_EXPRESSION (awk, px->right);
|
||||
if (px->right->type == ASE_AWK_NDE_ASS)
|
||||
PUT_SRCSTR (awk, ASE_T(")"));
|
||||
ase_awk_assert (awk, px->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right->next == ASE_NULL);
|
||||
PUT_SRCSTR (awk, ASE_T(")"));
|
||||
break;
|
||||
}
|
||||
@ -173,7 +173,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
case ASE_AWK_NDE_EXP_UNR:
|
||||
{
|
||||
ase_awk_nde_exp_t* px = (ase_awk_nde_exp_t*)nde;
|
||||
ase_awk_assert (awk, px->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right == ASE_NULL);
|
||||
|
||||
PUT_SRCSTR (awk, __unrop_str[px->opcode]);
|
||||
PUT_SRCSTR (awk, ASE_T("("));
|
||||
@ -185,7 +185,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
case ASE_AWK_NDE_EXP_INCPRE:
|
||||
{
|
||||
ase_awk_nde_exp_t* px = (ase_awk_nde_exp_t*)nde;
|
||||
ase_awk_assert (awk, px->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right == ASE_NULL);
|
||||
|
||||
PUT_SRCSTR (awk, __incop_str[px->opcode]);
|
||||
PUT_SRCSTR (awk, ASE_T("("));
|
||||
@ -197,7 +197,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
case ASE_AWK_NDE_EXP_INCPST:
|
||||
{
|
||||
ase_awk_nde_exp_t* px = (ase_awk_nde_exp_t*)nde;
|
||||
ase_awk_assert (awk, px->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right == ASE_NULL);
|
||||
|
||||
PUT_SRCSTR (awk, ASE_T("("));
|
||||
PRINT_EXPRESSION (awk, px->left);
|
||||
@ -296,7 +296,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
ase_char_t tmp[ase_sizeof(ase_long_t)*8+2];
|
||||
ase_size_t n;
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde;
|
||||
ase_awk_assert (awk, px->id.idxa != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, px->id.idxa != (ase_size_t)-1);
|
||||
|
||||
n = ase_awk_longtostr (
|
||||
px->id.idxa, 10, ASE_NULL, tmp, ase_countof(tmp));
|
||||
@ -304,7 +304,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
PUT_SRCSTR (awk, ASE_T("__param"));
|
||||
PUT_SRCSTRX (awk, tmp, n);
|
||||
|
||||
ase_awk_assert (awk, px->idx == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx == ASE_NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -313,8 +313,8 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
ase_char_t tmp[ase_sizeof(ase_long_t)*8+2];
|
||||
ase_size_t n;
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde;
|
||||
ase_awk_assert (awk, px->id.idxa != (ase_size_t)-1);
|
||||
ase_awk_assert (awk, px->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->id.idxa != (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, px->idx != ASE_NULL);
|
||||
|
||||
PUT_SRCSTR (awk, ASE_T("__param"));
|
||||
n = ase_awk_longtostr (
|
||||
@ -329,8 +329,8 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
case ASE_AWK_NDE_NAMED:
|
||||
{
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde;
|
||||
ase_awk_assert (awk, px->id.idxa == (ase_size_t)-1);
|
||||
ase_awk_assert (awk, px->idx == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->id.idxa == (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, px->idx == ASE_NULL);
|
||||
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
break;
|
||||
@ -339,8 +339,8 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
case ASE_AWK_NDE_NAMEDIDX:
|
||||
{
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde;
|
||||
ase_awk_assert (awk, px->id.idxa == (ase_size_t)-1);
|
||||
ase_awk_assert (awk, px->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->id.idxa == (ase_size_t)-1);
|
||||
ASE_AWK_ASSERT (awk, px->idx != ASE_NULL);
|
||||
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
PUT_SRCSTR (awk, ASE_T("["));
|
||||
@ -367,7 +367,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
{
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
}
|
||||
ase_awk_assert (awk, px->idx == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx == ASE_NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
PUT_SRCSTR (awk, ASE_T("["));
|
||||
}
|
||||
ase_awk_assert (awk, px->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx != ASE_NULL);
|
||||
PRINT_EXPRESSION_LIST (awk, px->idx);
|
||||
PUT_SRCSTR (awk, ASE_T("]"));
|
||||
break;
|
||||
@ -415,7 +415,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
{
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
}
|
||||
ase_awk_assert (awk, px->idx == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx == ASE_NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
PUT_SRCSTR (awk, ASE_T("["));
|
||||
}
|
||||
ase_awk_assert (awk, px->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx != ASE_NULL);
|
||||
PRINT_EXPRESSION_LIST (awk, px->idx);
|
||||
PUT_SRCSTR (awk, ASE_T("]"));
|
||||
break;
|
||||
@ -591,7 +591,7 @@ static int __print_statements (ase_awk_t* awk, ase_awk_nde_t* tree, int depth)
|
||||
PRINT_EXPRESSION (awk, px->test);
|
||||
PUT_SRCSTR (awk, ASE_T(")\n"));
|
||||
|
||||
ase_awk_assert (awk, px->then_part != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->then_part != ASE_NULL);
|
||||
if (px->then_part->type == ASE_AWK_NDE_BLK)
|
||||
PRINT_STATEMENTS (awk, px->then_part, depth);
|
||||
else
|
||||
@ -726,7 +726,7 @@ static int __print_statements (ase_awk_t* awk, ase_awk_nde_t* tree, int depth)
|
||||
else
|
||||
{
|
||||
PUT_SRCSTR (awk, ASE_T("return "));
|
||||
ase_awk_assert (awk, ((ase_awk_nde_return_t*)p)->val->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, ((ase_awk_nde_return_t*)p)->val->next == ASE_NULL);
|
||||
|
||||
PRINT_EXPRESSION (awk, ((ase_awk_nde_return_t*)p)->val);
|
||||
PUT_SRCSTR (awk, ASE_T(";\n"));
|
||||
@ -746,7 +746,7 @@ static int __print_statements (ase_awk_t* awk, ase_awk_nde_t* tree, int depth)
|
||||
else
|
||||
{
|
||||
PUT_SRCSTR (awk, ASE_T("exit "));
|
||||
ase_awk_assert (awk, px->val->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->val->next == ASE_NULL);
|
||||
PRINT_EXPRESSION (awk, px->val);
|
||||
PUT_SRCSTR (awk, ASE_T(";\n"));
|
||||
}
|
||||
@ -978,8 +978,8 @@ void ase_awk_clrpt (ase_awk_t* awk, ase_awk_nde_t* tree)
|
||||
case ASE_AWK_NDE_EXP_BIN:
|
||||
{
|
||||
ase_awk_nde_exp_t* px = (ase_awk_nde_exp_t*)p;
|
||||
ase_awk_assert (awk, px->left->next == ASE_NULL);
|
||||
ase_awk_assert (awk, px->right->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->left->next == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right->next == ASE_NULL);
|
||||
|
||||
ase_awk_clrpt (awk, px->left);
|
||||
ase_awk_clrpt (awk, px->right);
|
||||
@ -992,7 +992,7 @@ void ase_awk_clrpt (ase_awk_t* awk, ase_awk_nde_t* tree)
|
||||
case ASE_AWK_NDE_EXP_INCPST:
|
||||
{
|
||||
ase_awk_nde_exp_t* px = (ase_awk_nde_exp_t*)p;
|
||||
ase_awk_assert (awk, px->right == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->right == ASE_NULL);
|
||||
ase_awk_clrpt (awk, px->left);
|
||||
ASE_AWK_FREE (awk, p);
|
||||
break;
|
||||
@ -1044,7 +1044,7 @@ void ase_awk_clrpt (ase_awk_t* awk, ase_awk_nde_t* tree)
|
||||
case ASE_AWK_NDE_ARG:
|
||||
{
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)p;
|
||||
ase_awk_assert (awk, px->idx == ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx == ASE_NULL);
|
||||
if (px->id.name != ASE_NULL)
|
||||
ASE_AWK_FREE (awk, px->id.name);
|
||||
ASE_AWK_FREE (awk, p);
|
||||
@ -1057,7 +1057,7 @@ void ase_awk_clrpt (ase_awk_t* awk, ase_awk_nde_t* tree)
|
||||
case ASE_AWK_NDE_ARGIDX:
|
||||
{
|
||||
ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)p;
|
||||
ase_awk_assert (awk, px->idx != ASE_NULL);
|
||||
ASE_AWK_ASSERT (awk, px->idx != ASE_NULL);
|
||||
ase_awk_clrpt (awk, px->idx);
|
||||
if (px->id.name != ASE_NULL)
|
||||
ASE_AWK_FREE (awk, px->id.name);
|
||||
@ -1104,7 +1104,7 @@ void ase_awk_clrpt (ase_awk_t* awk, ase_awk_nde_t* tree)
|
||||
|
||||
default:
|
||||
{
|
||||
ase_awk_assert (awk, !"should never happen - invalid node type");
|
||||
ASE_AWK_ASSERT (awk, !"should never happen - invalid node type");
|
||||
ASE_AWK_FREE (awk, p);
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.76 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: val.c,v 1.77 2006-10-26 09:27:16 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -298,7 +298,7 @@ xp_printf (ASE_T("\n"));*/
|
||||
}
|
||||
else
|
||||
{
|
||||
ase_awk_assert (run->awk,
|
||||
ASE_AWK_ASSERT (run->awk,
|
||||
!"should never happen - invalid value type");
|
||||
}
|
||||
}
|
||||
@ -325,7 +325,7 @@ ase_awk_printval (val);
|
||||
xp_printf (ASE_T("\n"));
|
||||
*/
|
||||
|
||||
ase_awk_assert (run->awk, val->ref > 0);
|
||||
ASE_AWK_ASSERT (run->awk, val->ref > 0);
|
||||
val->ref--;
|
||||
if (val->ref <= 0)
|
||||
{
|
||||
@ -342,7 +342,7 @@ void ase_awk_refdownval_nofree (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
{
|
||||
if (ase_awk_isbuiltinval(val)) return;
|
||||
|
||||
ase_awk_assert (run->awk, val->ref > 0);
|
||||
ASE_AWK_ASSERT (run->awk, val->ref > 0);
|
||||
val->ref--;
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ ase_bool_t ase_awk_valtobool (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
return ase_false; /* TODO: is this correct? */
|
||||
}
|
||||
|
||||
ase_awk_assert (run->awk, !"should never happen - invalid value type");
|
||||
ASE_AWK_ASSERT (run->awk, !"should never happen - invalid value type");
|
||||
return ase_false;
|
||||
}
|
||||
|
||||
|
@ -1,78 +1,78 @@
|
||||
/* Big Endian */
|
||||
#undef SSE_ENDIAN_BIG
|
||||
#undef ASE_ENDIAN_BIG
|
||||
|
||||
/* Little Endian */
|
||||
#undef SSE_ENDIAN_LITTLE
|
||||
#undef ASE_ENDIAN_LITTLE
|
||||
|
||||
/* Unknown Endian */
|
||||
#undef SSE_ENDIAN_UNKNOWN
|
||||
#undef ASE_ENDIAN_UNKNOWN
|
||||
|
||||
/* long long */
|
||||
#undef SSE_HAVE_LONG_LONG
|
||||
#undef ASE_HAVE_LONG_LONG
|
||||
|
||||
/* long double */
|
||||
#undef SSE_HAVE_LONG_DOUBLE
|
||||
#undef ASE_HAVE_LONG_DOUBLE
|
||||
|
||||
/* data type size */
|
||||
#define SSE_SIZEOF_CHAR 0
|
||||
#define SSE_SIZEOF_SHORT 0
|
||||
#define SSE_SIZEOF_INT 0
|
||||
#define SSE_SIZEOF_LONG 0
|
||||
#define SSE_SIZEOF_LONG_LONG 0
|
||||
#define SSE_SIZEOF___INT8 0
|
||||
#define SSE_SIZEOF___INT16 0
|
||||
#define SSE_SIZEOF___INT32 0
|
||||
#define SSE_SIZEOF___INT64 0
|
||||
#define SSE_SIZEOF___INT128 0
|
||||
#define SSE_SIZEOF_VOID_P 0
|
||||
#define SSE_SIZEOF_FLOAT 0
|
||||
#define SSE_SIZEOF_DOUBLE 0
|
||||
#define SSE_SIZEOF_LONG_DOUBLE 0
|
||||
#define SSE_SIZEOF_PID_T 0
|
||||
#define SSE_SIZEOF_WCHAR_T 0
|
||||
#define ASE_SIZEOF_CHAR 0
|
||||
#define ASE_SIZEOF_SHORT 0
|
||||
#define ASE_SIZEOF_INT 0
|
||||
#define ASE_SIZEOF_LONG 0
|
||||
#define ASE_SIZEOF_LONG_LONG 0
|
||||
#define ASE_SIZEOF___INT8 0
|
||||
#define ASE_SIZEOF___INT16 0
|
||||
#define ASE_SIZEOF___INT32 0
|
||||
#define ASE_SIZEOF___INT64 0
|
||||
#define ASE_SIZEOF___INT128 0
|
||||
#define ASE_SIZEOF_VOID_P 0
|
||||
#define ASE_SIZEOF_FLOAT 0
|
||||
#define ASE_SIZEOF_DOUBLE 0
|
||||
#define ASE_SIZEOF_LONG_DOUBLE 0
|
||||
#define ASE_SIZEOF_PID_T 0
|
||||
#define ASE_SIZEOF_WCHAR_T 0
|
||||
|
||||
/* fcntl.h */
|
||||
#undef SSE_HAVE_FCNTL_H
|
||||
#undef ASE_HAVE_FCNTL_H
|
||||
|
||||
/* limits.h */
|
||||
#undef SSE_HAVE_LIMITS_H
|
||||
#undef ASE_HAVE_LIMITS_H
|
||||
|
||||
/* stdarg.h */
|
||||
#undef SSE_HAVE_STDARG_H
|
||||
#undef ASE_HAVE_STDARG_H
|
||||
|
||||
/* stddef.h */
|
||||
#undef SSE_HAVE_STDDEF_H
|
||||
#undef ASE_HAVE_STDDEF_H
|
||||
|
||||
/* unistd.h */
|
||||
#undef SSE_HAVE_UNISTD_H
|
||||
#undef ASE_HAVE_UNISTD_H
|
||||
|
||||
/* wchar.h */
|
||||
#undef SSE_HAVE_WCHAR_H
|
||||
#undef ASE_HAVE_WCHAR_H
|
||||
|
||||
/* poll.h */
|
||||
#undef SSE_HAVE_POLL_H
|
||||
#undef ASE_HAVE_POLL_H
|
||||
|
||||
/* sys/poll.h */
|
||||
#undef SSE_HAVE_SYS_EPOLL_H
|
||||
#undef ASE_HAVE_SYS_EPOLL_H
|
||||
|
||||
/* pthread.h */
|
||||
#undef SSE_HAVE_PTHREAD_H
|
||||
#undef ASE_HAVE_PTHREAD_H
|
||||
|
||||
/* sys/sysinfo.h */
|
||||
#undef SSE_HAVE_SYS_SYSINFO_H
|
||||
#undef ASE_HAVE_SYS_SYSINFO_H
|
||||
|
||||
/* sys/sysinfo.mem_unit */
|
||||
#undef SSE_HAVE_SYS_SYSINFO_MEM_UNIT
|
||||
#undef ASE_HAVE_SYS_SYSINFO_MEM_UNIT
|
||||
|
||||
/* in6.scope_id */
|
||||
#undef SSE_HAVE_IN6_SCOPE_ID
|
||||
#undef ASE_HAVE_IN6_SCOPE_ID
|
||||
|
||||
/* sockaddr_storage.ss_family */
|
||||
#undef SSE_HAVE_SS_FAMILY
|
||||
#undef ASE_HAVE_SS_FAMILY
|
||||
|
||||
/* char is wchar */
|
||||
#undef SSE_CHAR_IS_WCHAR
|
||||
#undef ASE_CHAR_IS_WCHAR
|
||||
|
||||
/* char is mchar */
|
||||
#undef SSE_CHAR_IS_MCHAR
|
||||
#undef ASE_CHAR_IS_MCHAR
|
||||
|
||||
|
78
ase/configure
vendored
78
ase/configure
vendored
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac Revision: 1.69 .
|
||||
# From configure.ac Revision: 1.70 .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59 for ase deb-0.1.0.
|
||||
#
|
||||
@ -3612,7 +3612,7 @@ fi
|
||||
if test $ac_cv_header_unistd_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_UNISTD_H
|
||||
#define ASE_HAVE_UNISTD_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -3758,7 +3758,7 @@ fi
|
||||
if test $ac_cv_header_fcntl_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_FCNTL_H
|
||||
#define ASE_HAVE_FCNTL_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -3904,7 +3904,7 @@ fi
|
||||
if test $ac_cv_header_stdarg_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_STDARG_H
|
||||
#define ASE_HAVE_STDARG_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4050,7 +4050,7 @@ fi
|
||||
if test $ac_cv_header_stddef_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_STDDEF_H
|
||||
#define ASE_HAVE_STDDEF_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4196,7 +4196,7 @@ fi
|
||||
if test $ac_cv_header_limits_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_LIMITS_H
|
||||
#define ASE_HAVE_LIMITS_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4342,7 +4342,7 @@ fi
|
||||
if test $ac_cv_header_wchar_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_WCHAR_H
|
||||
#define ASE_HAVE_WCHAR_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4488,7 +4488,7 @@ fi
|
||||
if test $ac_cv_header_poll_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_POLL_H
|
||||
#define ASE_HAVE_POLL_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4634,7 +4634,7 @@ fi
|
||||
if test $ac_cv_header_sys_epoll_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_SYS_EPOLL_H
|
||||
#define ASE_HAVE_SYS_EPOLL_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4780,7 +4780,7 @@ fi
|
||||
if test $ac_cv_header_pthread_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_PTHREAD_H
|
||||
#define ASE_HAVE_PTHREAD_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -4927,7 +4927,7 @@ fi
|
||||
if test $ac_cv_header_sys_sysinfo_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_SYS_SYSINFO_H
|
||||
#define ASE_HAVE_SYS_SYSINFO_H
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -5180,7 +5180,7 @@ echo "${ECHO_T}$ac_cv_member_struct_sysinfo_mem_unit" >&6
|
||||
if test $ac_cv_member_struct_sysinfo_mem_unit = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_SYS_SYSINFO_MEM_UNIT
|
||||
#define ASE_HAVE_SYS_SYSINFO_MEM_UNIT
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -5299,7 +5299,7 @@ echo "${ECHO_T}$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&6
|
||||
if test $ac_cv_member_struct_sockaddr_in6_sin6_scope_id = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_IN6_SCOPE_ID
|
||||
#define ASE_HAVE_IN6_SCOPE_ID
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -5415,7 +5415,7 @@ echo "${ECHO_T}$ac_cv_member_struct_sockaddr_storage_ss_family" >&6
|
||||
if test $ac_cv_member_struct_sockaddr_storage_ss_family = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_SS_FAMILY
|
||||
#define ASE_HAVE_SS_FAMILY
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -5639,19 +5639,19 @@ case $ac_cv_c_bigendian in
|
||||
yes)
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_ENDIAN_BIG
|
||||
#define ASE_ENDIAN_BIG
|
||||
_ACEOF
|
||||
;;
|
||||
no)
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_ENDIAN_LITTLE
|
||||
#define ASE_ENDIAN_LITTLE
|
||||
_ACEOF
|
||||
;;
|
||||
*)
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_ENDIAN_UNKNOWN
|
||||
#define ASE_ENDIAN_UNKNOWN
|
||||
_ACEOF
|
||||
;;
|
||||
esac
|
||||
@ -5717,7 +5717,7 @@ echo "${ECHO_T}$ac_cv_type_long_long" >&6
|
||||
if test $ac_cv_type_long_long = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_LONG_LONG
|
||||
#define ASE_HAVE_LONG_LONG
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -5781,7 +5781,7 @@ echo "${ECHO_T}$ac_cv_type_long_double" >&6
|
||||
if test $ac_cv_type_long_double = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_HAVE_LONG_DOUBLE
|
||||
#define ASE_HAVE_LONG_DOUBLE
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -12827,75 +12827,75 @@ _ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_CHAR ${ac_cv_sizeof_char}
|
||||
#define ASE_SIZEOF_CHAR ${ac_cv_sizeof_char}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_SHORT ${ac_cv_sizeof_short}
|
||||
#define ASE_SIZEOF_SHORT ${ac_cv_sizeof_short}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_INT ${ac_cv_sizeof_int}
|
||||
#define ASE_SIZEOF_INT ${ac_cv_sizeof_int}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_LONG ${ac_cv_sizeof_long}
|
||||
#define ASE_SIZEOF_LONG ${ac_cv_sizeof_long}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_LONG_LONG ${ac_cv_sizeof_long_long}
|
||||
#define ASE_SIZEOF_LONG_LONG ${ac_cv_sizeof_long_long}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT8 ${ac_cv_sizeof___int8}
|
||||
#define ASE_SIZEOF___INT8 ${ac_cv_sizeof___int8}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT16 ${ac_cv_sizeof___int16}
|
||||
#define ASE_SIZEOF___INT16 ${ac_cv_sizeof___int16}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT32 ${ac_cv_sizeof___int32}
|
||||
#define ASE_SIZEOF___INT32 ${ac_cv_sizeof___int32}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT64 ${ac_cv_sizeof___int64}
|
||||
#define ASE_SIZEOF___INT64 ${ac_cv_sizeof___int64}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT96 ${ac_cv_sizeof___int96}
|
||||
#define ASE_SIZEOF___INT96 ${ac_cv_sizeof___int96}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF___INT128 ${ac_cv_sizeof___int128}
|
||||
#define ASE_SIZEOF___INT128 ${ac_cv_sizeof___int128}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_VOID_P ${ac_cv_sizeof_void_p}
|
||||
#define ASE_SIZEOF_VOID_P ${ac_cv_sizeof_void_p}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_FLOAT ${ac_cv_sizeof_float}
|
||||
#define ASE_SIZEOF_FLOAT ${ac_cv_sizeof_float}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_DOUBLE ${ac_cv_sizeof_double}
|
||||
#define ASE_SIZEOF_DOUBLE ${ac_cv_sizeof_double}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_LONG_DOUBLE ${ac_cv_sizeof_long_double}
|
||||
#define ASE_SIZEOF_LONG_DOUBLE ${ac_cv_sizeof_long_double}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_PID_T ${ac_cv_sizeof_pid_t}
|
||||
#define ASE_SIZEOF_PID_T ${ac_cv_sizeof_pid_t}
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SSE_SIZEOF_WCHAR_T ${ac_cv_sizeof_wchar_t}
|
||||
#define ASE_SIZEOF_WCHAR_T ${ac_cv_sizeof_wchar_t}
|
||||
_ACEOF
|
||||
|
||||
|
||||
#AC_CHECK_FUNC(nanosleep,[AC_DEFINE([SSE_HAVE_NANOSLEEP])],
|
||||
#AC_CHECK_FUNC(nanosleep,[AC_DEFINE([ASE_HAVE_NANOSLEEP])],
|
||||
# [AC_CHECK_LIB(rt,nanosleep, LIBS="${LIBS} -lrt",
|
||||
# [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4")])])
|
||||
|
||||
@ -12915,13 +12915,13 @@ if test "$enable_wchar_is" = "yes"
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_CHAR_IS_WCHAR
|
||||
#define ASE_CHAR_IS_WCHAR
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define SSE_CHAR_IS_MCHAR
|
||||
#define ASE_CHAR_IS_MCHAR
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
AC_PREREQ(2.53)
|
||||
AC_INIT([ase], [deb-0.1.0])
|
||||
AC_REVISION([$Revision: 1.70 $])
|
||||
AC_REVISION([$Revision: 1.71 $])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
@ -16,35 +16,35 @@ AC_CHECK_LIB(rt, nanosleep)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADER([unistd.h], [AC_DEFINE([SSE_HAVE_UNISTD_H],[],[unistd.h])])
|
||||
AC_CHECK_HEADER([fcntl.h], [AC_DEFINE([SSE_HAVE_FCNTL_H],[],[fcntl.h])])
|
||||
AC_CHECK_HEADER([stdarg.h], [AC_DEFINE([SSE_HAVE_STDARG_H],[],[stdarg.h])])
|
||||
AC_CHECK_HEADER([stddef.h], [AC_DEFINE([SSE_HAVE_STDDEF_H],[],[stddef.h])])
|
||||
AC_CHECK_HEADER([limits.h], [AC_DEFINE([SSE_HAVE_LIMITS_H],[],[limits.h])])
|
||||
AC_CHECK_HEADER([wchar.h], [AC_DEFINE([SSE_HAVE_WCHAR_H],[],[wchar.h])])
|
||||
AC_CHECK_HEADER([poll.h], [AC_DEFINE([SSE_HAVE_POLL_H],[],[poll.h])])
|
||||
AC_CHECK_HEADER([sys/epoll.h], [AC_DEFINE([SSE_HAVE_SYS_EPOLL_H],[],[sys/epoll.h])])
|
||||
AC_CHECK_HEADER([pthread.h], [AC_DEFINE([SSE_HAVE_PTHREAD_H],[],[pthread.h])])
|
||||
AC_CHECK_HEADER([unistd.h], [AC_DEFINE([ASE_HAVE_UNISTD_H],[],[unistd.h])])
|
||||
AC_CHECK_HEADER([fcntl.h], [AC_DEFINE([ASE_HAVE_FCNTL_H],[],[fcntl.h])])
|
||||
AC_CHECK_HEADER([stdarg.h], [AC_DEFINE([ASE_HAVE_STDARG_H],[],[stdarg.h])])
|
||||
AC_CHECK_HEADER([stddef.h], [AC_DEFINE([ASE_HAVE_STDDEF_H],[],[stddef.h])])
|
||||
AC_CHECK_HEADER([limits.h], [AC_DEFINE([ASE_HAVE_LIMITS_H],[],[limits.h])])
|
||||
AC_CHECK_HEADER([wchar.h], [AC_DEFINE([ASE_HAVE_WCHAR_H],[],[wchar.h])])
|
||||
AC_CHECK_HEADER([poll.h], [AC_DEFINE([ASE_HAVE_POLL_H],[],[poll.h])])
|
||||
AC_CHECK_HEADER([sys/epoll.h], [AC_DEFINE([ASE_HAVE_SYS_EPOLL_H],[],[sys/epoll.h])])
|
||||
AC_CHECK_HEADER([pthread.h], [AC_DEFINE([ASE_HAVE_PTHREAD_H],[],[pthread.h])])
|
||||
|
||||
AC_CHECK_HEADER([sys/sysinfo.h],
|
||||
[AC_DEFINE([SSE_HAVE_SYS_SYSINFO_H],[],[sys/sysinfo.h])])
|
||||
[AC_DEFINE([ASE_HAVE_SYS_SYSINFO_H],[],[sys/sysinfo.h])])
|
||||
|
||||
# Checks for structure members
|
||||
AC_CHECK_HEADER([sys/sysinfo.h], [
|
||||
AC_CHECK_MEMBER(struct sysinfo.mem_unit,
|
||||
[AC_DEFINE([SSE_HAVE_SYS_SYSINFO_MEM_UNIT],[],[sys/sysinfo.mem_unit])],
|
||||
[AC_DEFINE([ASE_HAVE_SYS_SYSINFO_MEM_UNIT],[],[sys/sysinfo.mem_unit])],
|
||||
[],
|
||||
[#include <sys/sysinfo.h>])])
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
|
||||
[AC_DEFINE([SSE_HAVE_IN6_SCOPE_ID],[],[in6.scope_id])],
|
||||
[AC_DEFINE([ASE_HAVE_IN6_SCOPE_ID],[],[in6.scope_id])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr_storage.ss_family,
|
||||
[AC_DEFINE([SSE_HAVE_SS_FAMILY],[],[sockaddr_storage.ss_family])],
|
||||
[AC_DEFINE([ASE_HAVE_SS_FAMILY],[],[sockaddr_storage.ss_family])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -52,13 +52,13 @@ AC_CHECK_MEMBER(struct sockaddr_storage.ss_family,
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_BIGENDIAN(
|
||||
[AC_DEFINE([SSE_ENDIAN_BIG],[],[Big Endian])],
|
||||
[AC_DEFINE([SSE_ENDIAN_LITTLE],[],[Little Endian])],
|
||||
[AC_DEFINE([SSE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
|
||||
[AC_DEFINE([ASE_ENDIAN_BIG],[],[Big Endian])],
|
||||
[AC_DEFINE([ASE_ENDIAN_LITTLE],[],[Little Endian])],
|
||||
[AC_DEFINE([ASE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
|
||||
|
||||
# Checks for data types
|
||||
AC_CHECK_TYPE(long long, [AC_DEFINE([SSE_HAVE_LONG_LONG],[],[long long])])
|
||||
AC_CHECK_TYPE(long double, [AC_DEFINE([SSE_HAVE_LONG_DOUBLE],[],[long double])])
|
||||
AC_CHECK_TYPE(long long, [AC_DEFINE([ASE_HAVE_LONG_LONG],[],[long long])])
|
||||
AC_CHECK_TYPE(long double, [AC_DEFINE([ASE_HAVE_LONG_DOUBLE],[],[long double])])
|
||||
|
||||
AC_CHECK_SIZEOF(char)
|
||||
AC_CHECK_SIZEOF(short)
|
||||
@ -78,25 +78,25 @@ AC_CHECK_SIZEOF(long double)
|
||||
AC_CHECK_SIZEOF(pid_t)
|
||||
AC_CHECK_SIZEOF(wchar_t)
|
||||
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_CHAR,${ac_cv_sizeof_char})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_SHORT,${ac_cv_sizeof_short})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_INT,${ac_cv_sizeof_int})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_LONG,${ac_cv_sizeof_long})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_LONG_LONG,${ac_cv_sizeof_long_long})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT8,${ac_cv_sizeof___int8})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT16,${ac_cv_sizeof___int16})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT32,${ac_cv_sizeof___int32})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT64,${ac_cv_sizeof___int64})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT96,${ac_cv_sizeof___int96})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF___INT128,${ac_cv_sizeof___int128})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_VOID_P,${ac_cv_sizeof_void_p})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_FLOAT,${ac_cv_sizeof_float})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_DOUBLE,${ac_cv_sizeof_double})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_LONG_DOUBLE,${ac_cv_sizeof_long_double})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_PID_T,${ac_cv_sizeof_pid_t})
|
||||
AC_DEFINE_UNQUOTED(SSE_SIZEOF_WCHAR_T,${ac_cv_sizeof_wchar_t})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_CHAR,${ac_cv_sizeof_char})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_SHORT,${ac_cv_sizeof_short})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_INT,${ac_cv_sizeof_int})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG,${ac_cv_sizeof_long})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG_LONG,${ac_cv_sizeof_long_long})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT8,${ac_cv_sizeof___int8})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT16,${ac_cv_sizeof___int16})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT32,${ac_cv_sizeof___int32})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT64,${ac_cv_sizeof___int64})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT96,${ac_cv_sizeof___int96})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT128,${ac_cv_sizeof___int128})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_VOID_P,${ac_cv_sizeof_void_p})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_FLOAT,${ac_cv_sizeof_float})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_DOUBLE,${ac_cv_sizeof_double})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG_DOUBLE,${ac_cv_sizeof_long_double})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_PID_T,${ac_cv_sizeof_pid_t})
|
||||
AC_DEFINE_UNQUOTED(ASE_SIZEOF_WCHAR_T,${ac_cv_sizeof_wchar_t})
|
||||
|
||||
#AC_CHECK_FUNC(nanosleep,[AC_DEFINE([SSE_HAVE_NANOSLEEP])],
|
||||
#AC_CHECK_FUNC(nanosleep,[AC_DEFINE([ASE_HAVE_NANOSLEEP])],
|
||||
# [AC_CHECK_LIB(rt,nanosleep, LIBS="${LIBS} -lrt",
|
||||
# [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4")])])
|
||||
|
||||
@ -110,9 +110,9 @@ AC_ARG_ENABLE([wchar], [AC_HELP_STRING([--enable-wchar],
|
||||
enable_wchar_is=$enableval,enable_wchar_is=yes)
|
||||
if test "$enable_wchar_is" = "yes"
|
||||
then
|
||||
AC_DEFINE([SSE_CHAR_IS_WCHAR],[],[char is wchar])
|
||||
AC_DEFINE([ASE_CHAR_IS_WCHAR],[],[char is wchar])
|
||||
else
|
||||
AC_DEFINE([SSE_CHAR_IS_MCHAR],[],[char is mchar])
|
||||
AC_DEFINE([ASE_CHAR_IS_MCHAR],[],[char is mchar])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([reentrant], [AC_HELP_STRING([--enable-reentrant],
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: env.c,v 1.12 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: env.c,v 1.13 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -59,7 +59,7 @@ ase_lsp_assoc_t* ase_lsp_lookupinframe (
|
||||
{
|
||||
ase_lsp_assoc_t* assoc;
|
||||
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
|
||||
assoc = frame->assoc;
|
||||
while (assoc != ASE_NULL)
|
||||
@ -76,7 +76,7 @@ ase_lsp_assoc_t* ase_lsp_insertvalueintoframe (
|
||||
{
|
||||
ase_lsp_assoc_t* assoc;
|
||||
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
|
||||
assoc = __new_assoc (lsp, name, value, ASE_NULL);
|
||||
if (assoc == ASE_NULL) return ASE_NULL;
|
||||
@ -91,7 +91,7 @@ ase_lsp_assoc_t* ase_lsp_insertfuncintoframe (
|
||||
{
|
||||
ase_lsp_assoc_t* assoc;
|
||||
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
|
||||
assoc = __new_assoc (lsp, name, ASE_NULL, func);
|
||||
if (assoc == ASE_NULL) return ASE_NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: eval.c,v 1.17 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: eval.c,v 1.18 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -91,7 +91,7 @@ static ase_lsp_obj_t* eval_cons (ase_lsp_t* lsp, ase_lsp_obj_t* cons)
|
||||
{
|
||||
ase_lsp_obj_t* car, * cdr;
|
||||
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(cons) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(cons) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
car = ASE_LSP_CAR(cons);
|
||||
cdr = ASE_LSP_CDR(cons);
|
||||
@ -173,11 +173,11 @@ static ase_lsp_obj_t* apply (
|
||||
ase_lsp_obj_t* value;
|
||||
ase_lsp_mem_t* mem;
|
||||
|
||||
ase_lsp_assert (lsp,
|
||||
ASE_LSP_ASSERT (lsp,
|
||||
ASE_LSP_TYPE(func) == ASE_LSP_OBJ_FUNC ||
|
||||
ASE_LSP_TYPE(func) == ASE_LSP_OBJ_MACRO);
|
||||
|
||||
ase_lsp_assert (lsp,
|
||||
ASE_LSP_ASSERT (lsp,
|
||||
ASE_LSP_TYPE(ASE_LSP_CDR(func)) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
mem = lsp->mem;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lsp.c,v 1.9 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: lsp.c,v 1.10 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
@ -110,7 +110,7 @@ int ase_lsp_attach_input (ase_lsp_t* lsp, ase_lsp_io_t input, void* arg)
|
||||
{
|
||||
if (ase_lsp_detach_input(lsp) == -1) return -1;
|
||||
|
||||
ase_lsp_assert (lsp, lsp->input_func == ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, lsp->input_func == ASE_NULL);
|
||||
|
||||
if (input(ASE_LSP_IO_OPEN, arg, ASE_NULL, 0) == -1) {
|
||||
/* TODO: set error number */
|
||||
@ -142,7 +142,7 @@ int ase_lsp_attach_output (ase_lsp_t* lsp, ase_lsp_io_t output, void* arg)
|
||||
{
|
||||
if (ase_lsp_detach_output(lsp) == -1) return -1;
|
||||
|
||||
ase_lsp_assert (lsp, lsp->output_func == ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, lsp->output_func == ASE_NULL);
|
||||
|
||||
if (output(ASE_LSP_IO_OPEN, arg, ASE_NULL, 0) == -1) {
|
||||
/* TODO: set error number */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lsp.h,v 1.26 2006-10-25 13:42:31 bacon Exp $
|
||||
* $Id: lsp.h,v 1.27 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_LSP_LSP_H_
|
||||
@ -93,6 +93,14 @@ enum
|
||||
|
||||
typedef ase_lsp_obj_t* (*ase_lsp_prim_t) (ase_lsp_t* lsp, ase_lsp_obj_t* obj);
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ASE_LSP_ASSERT(lsp,expr) ((void)0)
|
||||
#else
|
||||
#define ASE_LSP_ASSERT(lsp,expr) (void)((expr) || \
|
||||
(ase_lsp_assertfail(lsp, ASE_T(#expr), ASE_T(__FILE__), __LINE__), 0))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -145,6 +153,11 @@ ase_char_t* ase_lsp_strxnstr (
|
||||
const ase_char_t* str, ase_size_t strsz,
|
||||
const ase_char_t* sub, ase_size_t subsz);
|
||||
|
||||
|
||||
/* abort function for assertion. use ASE_LSP_ASSERT instead */
|
||||
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
||||
const ase_char_t* expr, const ase_char_t* file, int line);
|
||||
|
||||
const ase_char_t* ase_lsp_geterrstr (int errnum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lsp_i.h,v 1.2 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: lsp_i.h,v 1.3 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_LSP_LSPI_H_
|
||||
@ -13,13 +13,6 @@
|
||||
#include <ase/lsp/prim.h>
|
||||
#include <ase/lsp/name.h>
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ase_lsp_assert(lsp,expr) ((void)0)
|
||||
#else
|
||||
#define ase_lsp_assert(lsp,expr) (void)((expr) || \
|
||||
(ase_lsp_abort(lsp, ASE_T(#expr), ASE_T(__FILE__), __LINE__), 0))
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable: 4996)
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mem.c,v 1.15 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: mem.c,v 1.16 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -192,8 +192,8 @@ ase_lsp_obj_t* ase_lsp_alloc (ase_lsp_mem_t* mem, int type, ase_size_t size)
|
||||
void ase_lsp_dispose (
|
||||
ase_lsp_mem_t* mem, ase_lsp_obj_t* prev, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_lsp_assert (mem->lsp, obj != ASE_NULL);
|
||||
ase_lsp_assert (mem->lsp, mem->count > 0);
|
||||
ASE_LSP_ASSERT (mem->lsp, obj != ASE_NULL);
|
||||
ASE_LSP_ASSERT (mem->lsp, mem->count > 0);
|
||||
|
||||
// TODO: push the object to the free list for more
|
||||
// efficient memory management
|
||||
@ -230,7 +230,7 @@ void ase_lsp_dispose_all (ase_lsp_mem_t* mem)
|
||||
|
||||
static void __mark_obj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_lsp_assert (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
||||
|
||||
// TODO:....
|
||||
// can it be recursive?
|
||||
@ -260,20 +260,20 @@ static void __mark_obj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||
*/
|
||||
void ase_lsp_lockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_lsp_assert (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_LOCK(obj) = 1;
|
||||
//ASE_LSP_MARK(obj) = 1;
|
||||
}
|
||||
|
||||
void ase_lsp_unlockobj (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_lsp_assert (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_LOCK(obj) = 0;
|
||||
}
|
||||
|
||||
void ase_lsp_unlockallobjs (ase_lsp_t* lsp, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_lsp_assert (lsp, obj != ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, obj != ASE_NULL);
|
||||
|
||||
ASE_LSP_LOCK(obj) = 0;
|
||||
|
||||
@ -559,7 +559,7 @@ ase_lsp_assoc_t* ase_lsp_lookup (ase_lsp_mem_t* mem, ase_lsp_obj_t* name)
|
||||
ase_lsp_frame_t* frame;
|
||||
ase_lsp_assoc_t* assoc;
|
||||
|
||||
ase_lsp_assert (mem->lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
ASE_LSP_ASSERT (mem->lsp, ASE_LSP_TYPE(name) == ASE_LSP_OBJ_SYM);
|
||||
|
||||
frame = mem->frame;
|
||||
|
||||
@ -611,7 +611,7 @@ ase_size_t ase_lsp_cons_len (ase_lsp_mem_t* mem, ase_lsp_obj_t* obj)
|
||||
{
|
||||
ase_size_t count;
|
||||
|
||||
ase_lsp_assert (mem->lsp,
|
||||
ASE_LSP_ASSERT (mem->lsp,
|
||||
obj == mem->nil || ASE_LSP_TYPE(obj) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
count = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.2 2006-10-24 04:22:39 bacon Exp $
|
||||
* $Id: misc.c,v 1.3 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -43,7 +43,7 @@ ase_long_t ase_lsp_strxtolong (
|
||||
ase_size_t rem;
|
||||
int digit, negative = 0;
|
||||
|
||||
ase_lsp_assert (lsp, base < 37);
|
||||
ASE_LSP_ASSERT (lsp, base < 37);
|
||||
|
||||
p = str;
|
||||
end = str + len;
|
||||
@ -750,7 +750,7 @@ ase_char_t* ase_lsp_strxnstr (
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
int ase_lsp_abort (ase_lsp_t* lsp,
|
||||
int ase_lsp_assertfail (ase_lsp_t* lsp,
|
||||
const ase_char_t* expr, const ase_char_t* file, int line)
|
||||
{
|
||||
lsp->syscas.dprintf (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.h,v 1.2 2006-10-24 04:22:39 bacon Exp $
|
||||
* $Id: misc.h,v 1.3 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_LSP_MISC_H_
|
||||
@ -16,9 +16,6 @@ extern "C" {
|
||||
void* ase_lsp_memcpy (void* dst, const void* src, ase_size_t n);
|
||||
void* ase_lsp_memset (void* dst, int val, ase_size_t n);
|
||||
|
||||
int ase_lsp_abort (ase_lsp_t* lsp,
|
||||
const ase_char_t* expr, const ase_char_t* file, int line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: name.c,v 1.8 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: name.c,v 1.9 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -46,7 +46,7 @@ void ase_lsp_name_close (ase_lsp_name_t* name)
|
||||
{
|
||||
if (name->capa >= ase_countof(name->static_buf))
|
||||
{
|
||||
ase_lsp_assert (name->lsp, name->buf != name->static_buf);
|
||||
ASE_LSP_ASSERT (name->lsp, name->buf != name->static_buf);
|
||||
ASE_LSP_FREE (name->lsp, name->buf);
|
||||
}
|
||||
if (name->__dynamic) ASE_LSP_FREE (name->lsp, name);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: obj.h,v 1.9 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: obj.h,v 1.10 2006-10-26 09:25:03 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_LSP_OBJ_H_
|
||||
@ -27,7 +27,6 @@ enum
|
||||
};
|
||||
|
||||
typedef struct ase_lsp_objhdr_t ase_lsp_objhdr_t;
|
||||
typedef struct ase_lsp_obj_t ase_lsp_obj_t;
|
||||
typedef struct ase_lsp_obj_nil_t ase_lsp_obj_nil_t;
|
||||
typedef struct ase_lsp_obj_true_t ase_lsp_obj_true_t;
|
||||
typedef struct ase_lsp_obj_int_t ase_lsp_obj_int_t;
|
||||
@ -96,22 +95,22 @@ struct ase_lsp_obj_str_t
|
||||
struct ase_lsp_obj_cons_t
|
||||
{
|
||||
ase_lsp_objhdr_t hdr;
|
||||
struct ase_lsp_obj_t* car;
|
||||
struct ase_lsp_obj_t* cdr;
|
||||
ase_lsp_obj_t* car;
|
||||
ase_lsp_obj_t* cdr;
|
||||
};
|
||||
|
||||
struct ase_lsp_obj_func_t
|
||||
{
|
||||
ase_lsp_objhdr_t hdr;
|
||||
struct ase_lsp_obj_t* formal;
|
||||
struct ase_lsp_obj_t* body;
|
||||
ase_lsp_obj_t* formal;
|
||||
ase_lsp_obj_t* body;
|
||||
};
|
||||
|
||||
struct ase_lsp_obj_macro_t
|
||||
{
|
||||
ase_lsp_objhdr_t hdr;
|
||||
struct ase_lsp_obj_t* formal;
|
||||
struct ase_lsp_obj_t* body;
|
||||
ase_lsp_obj_t* formal;
|
||||
ase_lsp_obj_t* body;
|
||||
};
|
||||
|
||||
struct ase_lsp_obj_prim_t
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: prim.c,v 1.12 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: prim.c,v 1.13 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -51,7 +51,7 @@ ase_lsp_obj_t* ase_lsp_prim_eval (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* tmp;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, 1);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
tmp = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
@ -118,7 +118,7 @@ ase_lsp_obj_t* ase_lsp_prim_if (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* tmp;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
tmp = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
@ -157,7 +157,7 @@ ase_lsp_obj_t* ase_lsp_prim_while (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* tmp;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
for (;;) {
|
||||
tmp = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
@ -189,7 +189,7 @@ ase_lsp_obj_t* ase_lsp_prim_car (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* tmp;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, 1);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
tmp = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
@ -212,7 +212,7 @@ ase_lsp_obj_t* ase_lsp_prim_cdr (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* tmp;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, 1);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
tmp = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (tmp == ASE_NULL) return ASE_NULL;
|
||||
@ -236,7 +236,7 @@ ase_lsp_obj_t* ase_lsp_prim_cons (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* car, * cdr, * cons;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
car = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (car == ASE_NULL) return ASE_NULL;
|
||||
@ -265,7 +265,7 @@ ase_lsp_obj_t* ase_lsp_prim_set (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* p1, * p2;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -296,7 +296,7 @@ ase_lsp_obj_t* ase_lsp_prim_setq (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_lsp_obj_t* p = args, * p1, * p2 = lsp->mem->nil;
|
||||
|
||||
while (p != lsp->mem->nil) {
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(p) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(p) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ASE_LSP_CAR(p);
|
||||
if (ASE_LSP_TYPE(p1) != ASE_LSP_OBJ_SYM) {
|
||||
@ -330,7 +330,7 @@ ase_lsp_obj_t* ase_lsp_prim_quote (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
*/
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, 1);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
return ASE_LSP_CAR(args);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: prim_compar.c,v 1.6 2006-10-26 08:17:37 bacon Exp $
|
||||
* $Id: prim_compar.c,v 1.7 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -10,7 +10,7 @@ ase_lsp_obj_t* ase_lsp_prim_eq (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -93,7 +93,7 @@ ase_lsp_obj_t* ase_lsp_prim_ne (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -177,7 +177,7 @@ ase_lsp_obj_t* ase_lsp_prim_gt (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -261,7 +261,7 @@ ase_lsp_obj_t* ase_lsp_prim_lt (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -344,7 +344,7 @@ ase_lsp_obj_t* ase_lsp_prim_ge (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
@ -427,7 +427,7 @@ ase_lsp_obj_t* ase_lsp_prim_le (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
int res;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
|
||||
if (p1 == ASE_NULL) return ASE_NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: prim_math.c,v 1.10 2006-10-26 08:17:38 bacon Exp $
|
||||
* $Id: prim_math.c,v 1.11 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -12,7 +12,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_bool_t realnum = ase_false;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
body = args;
|
||||
//while (body != lsp->mem->nil) {
|
||||
@ -25,7 +25,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
|
||||
if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_INT) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
ivalue = ASE_LSP_IVALUE(tmp);
|
||||
}
|
||||
else {
|
||||
@ -37,7 +37,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
}
|
||||
else if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_REAL) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
realnum = ase_true;
|
||||
rvalue = ASE_LSP_RVALUE(tmp);
|
||||
}
|
||||
@ -58,7 +58,7 @@ ase_lsp_obj_t* ase_lsp_prim_plus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
body = ASE_LSP_CDR(body);
|
||||
}
|
||||
|
||||
ase_lsp_assert (lsp, body == lsp->mem->nil);
|
||||
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil);
|
||||
|
||||
tmp = (realnum)?
|
||||
ase_lsp_makerealobj (lsp->mem, rvalue):
|
||||
@ -79,7 +79,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_bool_t realnum = ase_false;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
body = args;
|
||||
//while (body != lsp->mem->nil) {
|
||||
@ -90,7 +90,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
|
||||
if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_INT) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
ivalue = ASE_LSP_IVALUE(tmp);
|
||||
}
|
||||
else {
|
||||
@ -102,7 +102,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
}
|
||||
else if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_REAL) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
realnum = ase_true;
|
||||
rvalue = ASE_LSP_RVALUE(tmp);
|
||||
}
|
||||
@ -123,7 +123,7 @@ ase_lsp_obj_t* ase_lsp_prim_minus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
body = ASE_LSP_CDR(body);
|
||||
}
|
||||
|
||||
ase_lsp_assert (lsp, body == lsp->mem->nil);
|
||||
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil);
|
||||
|
||||
tmp = (realnum)?
|
||||
ase_lsp_makerealobj (lsp->mem, rvalue):
|
||||
@ -144,7 +144,7 @@ ase_lsp_obj_t* ase_lsp_prim_multiply (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_bool_t realnum = ase_false;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
body = args;
|
||||
//while (body != lsp->mem->nil) {
|
||||
@ -155,7 +155,7 @@ ase_lsp_obj_t* ase_lsp_prim_multiply (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
|
||||
if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_INT) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
ivalue = ASE_LSP_IVALUE(tmp);
|
||||
}
|
||||
else {
|
||||
@ -167,7 +167,7 @@ ase_lsp_obj_t* ase_lsp_prim_multiply (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
}
|
||||
else if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_REAL) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
realnum = ase_true;
|
||||
rvalue = ASE_LSP_RVALUE(tmp);
|
||||
}
|
||||
@ -188,7 +188,7 @@ ase_lsp_obj_t* ase_lsp_prim_multiply (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
body = ASE_LSP_CDR(body);
|
||||
}
|
||||
|
||||
ase_lsp_assert (lsp, body == lsp->mem->nil);
|
||||
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil);
|
||||
|
||||
tmp = (realnum)?
|
||||
ase_lsp_makerealobj (lsp->mem, rvalue):
|
||||
@ -209,7 +209,7 @@ ase_lsp_obj_t* ase_lsp_prim_divide (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_bool_t realnum = ase_false;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
body = args;
|
||||
//while (body != lsp->mem->nil) {
|
||||
@ -220,7 +220,7 @@ ase_lsp_obj_t* ase_lsp_prim_divide (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
|
||||
if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_INT) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
ivalue = ASE_LSP_IVALUE(tmp);
|
||||
}
|
||||
else {
|
||||
@ -237,7 +237,7 @@ ase_lsp_obj_t* ase_lsp_prim_divide (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
}
|
||||
else if (ASE_LSP_TYPE(tmp) == ASE_LSP_OBJ_REAL) {
|
||||
if (body == args) {
|
||||
ase_lsp_assert (lsp, realnum == ase_false);
|
||||
ASE_LSP_ASSERT (lsp, realnum == ase_false);
|
||||
realnum = ase_true;
|
||||
rvalue = ASE_LSP_RVALUE(tmp);
|
||||
}
|
||||
@ -258,7 +258,7 @@ ase_lsp_obj_t* ase_lsp_prim_divide (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
body = ASE_LSP_CDR(body);
|
||||
}
|
||||
|
||||
ase_lsp_assert (lsp, body == lsp->mem->nil);
|
||||
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil);
|
||||
|
||||
tmp = (realnum)?
|
||||
ase_lsp_makerealobj (lsp->mem, rvalue):
|
||||
@ -278,7 +278,7 @@ ase_lsp_obj_t* ase_lsp_prim_modulus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
ase_long_t ivalue = 0;
|
||||
|
||||
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 1, ASE_LSP_PRIM_MAX_ARG_COUNT);
|
||||
ase_lsp_assert (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
ASE_LSP_ASSERT (lsp, ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
|
||||
|
||||
body = args;
|
||||
//while (body != lsp->mem->nil) {
|
||||
@ -320,7 +320,7 @@ ase_lsp_obj_t* ase_lsp_prim_modulus (ase_lsp_t* lsp, ase_lsp_obj_t* args)
|
||||
body = ASE_LSP_CDR(body);
|
||||
}
|
||||
|
||||
ase_lsp_assert (lsp, body == lsp->mem->nil);
|
||||
ASE_LSP_ASSERT (lsp, body == lsp->mem->nil);
|
||||
|
||||
tmp = ase_lsp_makeintobj (lsp->mem, ivalue);
|
||||
if (tmp == ASE_NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: read.c,v 1.23 2006-10-26 08:17:38 bacon Exp $
|
||||
* $Id: read.c,v 1.24 2006-10-26 09:31:28 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/lsp/lsp_i.h>
|
||||
@ -105,7 +105,7 @@ static ase_lsp_obj_t* read_obj (ase_lsp_t* lsp)
|
||||
ase_lsp_lockobj (lsp, obj);
|
||||
return obj;
|
||||
case TOKEN_IDENT:
|
||||
ase_lsp_assert (lsp,
|
||||
ASE_LSP_ASSERT (lsp,
|
||||
lsp->mem->nil != ASE_NULL && lsp->mem->t != ASE_NULL);
|
||||
if (TOKEN_COMPARE(lsp,ASE_T("nil")) == 0) obj = lsp->mem->nil;
|
||||
else if (TOKEN_COMPARE(lsp,ASE_T("t")) == 0) obj = lsp->mem->t;
|
||||
@ -255,7 +255,7 @@ static int read_char (ase_lsp_t* lsp)
|
||||
|
||||
static int read_token (ase_lsp_t* lsp)
|
||||
{
|
||||
ase_lsp_assert (lsp, lsp->input_func != ASE_NULL);
|
||||
ASE_LSP_ASSERT (lsp, lsp->input_func != ASE_NULL);
|
||||
|
||||
TOKEN_CLEAR (lsp);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS=awk
|
||||
SUBDIRS=awk lsp
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); \
|
||||
|
@ -5,6 +5,10 @@
|
||||
#include <xp/bas/locale.h>
|
||||
#include <xp/bas/sio.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <wctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __linux
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
|
@ -2,8 +2,8 @@ SRCS = lsp.c
|
||||
OUTS = $(SRCS:.c=.x)
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
|
||||
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/lsp
|
||||
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/.. -I$(XPKIT)
|
||||
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/lsp -L$(XPKIT)/xp/bas
|
||||
LIBS = @LIBS@ -lxpbas -laselsp
|
||||
|
||||
all: $(OUTS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user