*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-22 10:31:24 +00:00
parent 6d9c29e011
commit a206062acc
5 changed files with 128 additions and 128 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.118 2007-03-12 12:55:57 bacon Exp $ * $Id: awk.c,v 1.119 2007-03-22 10:31:23 bacon Exp $
* *
* {License} * {License}
*/ */
@ -11,7 +11,7 @@
#include <ase/awk/awk_i.h> #include <ase/awk/awk_i.h>
static void __free_afn (void* awk, void* afn); static void free_afn (void* awk, void* afn);
ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data) ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
{ {
@ -62,7 +62,7 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
/* TODO: initial map size?? */ /* TODO: initial map size?? */
if (ase_awk_map_open ( if (ase_awk_map_open (
&awk->tree.afns, awk, 256, __free_afn, awk) == ASE_NULL) &awk->tree.afns, awk, 256, free_afn, awk) == ASE_NULL)
{ {
ase_str_close (&awk->token.name); ase_str_close (&awk->token.name);
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
@ -142,7 +142,7 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
return awk; return awk;
} }
static void __free_afn (void* owner, void* afn) static void free_afn (void* owner, void* afn)
{ {
ase_awk_afn_t* f = (ase_awk_afn_t*)afn; ase_awk_afn_t* f = (ase_awk_afn_t*)afn;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: err.c,v 1.96 2007-03-20 10:44:44 bacon Exp $ * $Id: err.c,v 1.97 2007-03-22 10:31:24 bacon Exp $
* *
* {License} * {License}
*/ */
@ -8,7 +8,7 @@
static const ase_char_t* __geterrstr (int errnum) static const ase_char_t* __geterrstr (int errnum)
{ {
static const ase_char_t* __errstr[] = static const ase_char_t* errstr[] =
{ {
ASE_T("no error"), ASE_T("no error"),
@ -147,9 +147,9 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("garbage after the regular expression") ASE_T("garbage after the regular expression")
}; };
if (errnum >= 0 && errnum < ASE_COUNTOF(__errstr)) if (errnum >= 0 && errnum < ASE_COUNTOF(errstr))
{ {
return __errstr[errnum]; return errstr[errnum];
} }
return ASE_T("unknown error"); return ASE_T("unknown error");

View File

@ -1,5 +1,5 @@
/* /*
* $Id: extio.c,v 1.78 2007-03-20 10:44:44 bacon Exp $ * $Id: extio.c,v 1.79 2007-03-22 10:31:24 bacon Exp $
* *
* {License} * {License}
*/ */
@ -8,14 +8,14 @@
enum enum
{ {
__MASK_READ = 0x0100, MASK_READ = 0x0100,
__MASK_WRITE = 0x0200, MASK_WRITE = 0x0200,
__MASK_RDWR = 0x0400, MASK_RDWR = 0x0400,
__MASK_CLEAR = 0x00FF MASK_CLEAR = 0x00FF
}; };
static int __in_type_map[] = static int in_type_map[] =
{ {
/* the order should match the order of the /* the order should match the order of the
* ASE_AWK_IN_XXX values in tree.h */ * ASE_AWK_IN_XXX values in tree.h */
@ -25,7 +25,7 @@ static int __in_type_map[] =
ASE_AWK_EXTIO_CONSOLE ASE_AWK_EXTIO_CONSOLE
}; };
static int __in_mode_map[] = static int in_mode_map[] =
{ {
/* the order should match the order of the /* the order should match the order of the
* ASE_AWK_IN_XXX values in tree.h */ * ASE_AWK_IN_XXX values in tree.h */
@ -35,15 +35,15 @@ static int __in_mode_map[] =
ASE_AWK_EXTIO_CONSOLE_READ ASE_AWK_EXTIO_CONSOLE_READ
}; };
static int __in_mask_map[] = static int in_mask_map[] =
{ {
__MASK_READ, MASK_READ,
__MASK_RDWR, MASK_RDWR,
__MASK_READ, MASK_READ,
__MASK_READ MASK_READ
}; };
static int __out_type_map[] = static int out_type_map[] =
{ {
/* the order should match the order of the /* the order should match the order of the
* ASE_AWK_OUT_XXX values in tree.h */ * ASE_AWK_OUT_XXX values in tree.h */
@ -54,7 +54,7 @@ static int __out_type_map[] =
ASE_AWK_EXTIO_CONSOLE ASE_AWK_EXTIO_CONSOLE
}; };
static int __out_mode_map[] = static int out_mode_map[] =
{ {
/* the order should match the order of the /* the order should match the order of the
* ASE_AWK_OUT_XXX values in tree.h */ * ASE_AWK_OUT_XXX values in tree.h */
@ -65,13 +65,13 @@ static int __out_mode_map[] =
ASE_AWK_EXTIO_CONSOLE_WRITE ASE_AWK_EXTIO_CONSOLE_WRITE
}; };
static int __out_mask_map[] = static int out_mask_map[] =
{ {
__MASK_WRITE, MASK_WRITE,
__MASK_RDWR, MASK_RDWR,
__MASK_WRITE, MASK_WRITE,
__MASK_WRITE, MASK_WRITE,
__MASK_WRITE MASK_WRITE
}; };
int ase_awk_readextio ( int ase_awk_readextio (
@ -87,14 +87,14 @@ int ase_awk_readextio (
ase_size_t line_len = 0; ase_size_t line_len = 0;
ase_char_t c = ASE_T('\0'), pc; ase_char_t c = ASE_T('\0'), pc;
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_type_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_type_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mode_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mode_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mask_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mask_map));
/* translate the in_type into the relevant extio type and mode */ /* translate the in_type into the relevant extio type and mode */
extio_type = __in_type_map[in_type]; extio_type = in_type_map[in_type];
extio_mode = __in_mode_map[in_type]; extio_mode = in_mode_map[in_type];
extio_mask = __in_mask_map[in_type]; extio_mask = in_mask_map[in_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -424,14 +424,14 @@ int ase_awk_writeextio_str (
ase_awk_io_t handler; ase_awk_io_t handler;
int extio_type, extio_mode, extio_mask, n; int extio_type, extio_mode, extio_mask, n;
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_type_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_type_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mode_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mode_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mask_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mask_map));
/* translate the out_type into the relevant extio type and mode */ /* translate the out_type into the relevant extio type and mode */
extio_type = __out_type_map[out_type]; extio_type = out_type_map[out_type];
extio_mode = __out_mode_map[out_type]; extio_mode = out_mode_map[out_type];
extio_mask = __out_mask_map[out_type]; extio_mask = out_mask_map[out_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -565,14 +565,14 @@ int ase_awk_flushextio (
int extio_type, /*extio_mode,*/ extio_mask, n; int extio_type, /*extio_mode,*/ extio_mask, n;
ase_bool_t ok = ase_false; ase_bool_t ok = ase_false;
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_type_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_type_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mode_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mode_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mask_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mask_map));
/* translate the out_type into the relevant extio type and mode */ /* translate the out_type into the relevant extio type and mode */
extio_type = __out_type_map[out_type]; extio_type = out_type_map[out_type];
/*extio_mode = __out_mode_map[out_type];*/ /*extio_mode = out_mode_map[out_type];*/
extio_mask = __out_mask_map[out_type]; extio_mask = out_mask_map[out_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -618,14 +618,14 @@ int ase_awk_nextextio_read (
ase_awk_io_t handler; ase_awk_io_t handler;
int extio_type, /*extio_mode,*/ extio_mask, n; int extio_type, /*extio_mode,*/ extio_mask, n;
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_type_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_type_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mode_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mode_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mask_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mask_map));
/* translate the in_type into the relevant extio type and mode */ /* translate the in_type into the relevant extio type and mode */
extio_type = __in_type_map[in_type]; extio_type = in_type_map[in_type];
/*extio_mode = __in_mode_map[in_type];*/ /*extio_mode = in_mode_map[in_type];*/
extio_mask = __in_mask_map[in_type]; extio_mask = in_mask_map[in_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -694,14 +694,14 @@ int ase_awk_nextextio_write (
ase_awk_io_t handler; ase_awk_io_t handler;
int extio_type, /*extio_mode,*/ extio_mask, n; int extio_type, /*extio_mode,*/ extio_mask, n;
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_type_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_type_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mode_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mode_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mask_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mask_map));
/* translate the out_type into the relevant extio type and mode */ /* translate the out_type into the relevant extio type and mode */
extio_type = __out_type_map[out_type]; extio_type = out_type_map[out_type];
/*extio_mode = __out_mode_map[out_type];*/ /*extio_mode = out_mode_map[out_type];*/
extio_mask = __out_mask_map[out_type]; extio_mask = out_mask_map[out_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -766,14 +766,14 @@ int ase_awk_closeextio_read (
ase_awk_io_t handler; ase_awk_io_t handler;
int extio_type, /*extio_mode,*/ extio_mask; int extio_type, /*extio_mode,*/ extio_mask;
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_type_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_type_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mode_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mode_map));
ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(__in_mask_map)); ASE_ASSERT (in_type >= 0 && in_type <= ASE_COUNTOF(in_mask_map));
/* translate the in_type into the relevant extio type and mode */ /* translate the in_type into the relevant extio type and mode */
extio_type = __in_type_map[in_type]; extio_type = in_type_map[in_type];
/*extio_mode = __in_mode_map[in_type];*/ /*extio_mode = in_mode_map[in_type];*/
extio_mask = __in_mask_map[in_type]; extio_mask = in_mask_map[in_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -790,7 +790,7 @@ int ase_awk_closeextio_read (
{ {
ase_awk_io_t handler; ase_awk_io_t handler;
handler = run->extio.handler[p->type & __MASK_CLEAR]; handler = run->extio.handler[p->type & MASK_CLEAR];
if (handler != ASE_NULL) if (handler != ASE_NULL)
{ {
if (handler (ASE_AWK_IO_CLOSE, p, ASE_NULL, 0) <= -1) if (handler (ASE_AWK_IO_CLOSE, p, ASE_NULL, 0) <= -1)
@ -825,14 +825,14 @@ int ase_awk_closeextio_write (
ase_awk_io_t handler; ase_awk_io_t handler;
int extio_type, /*extio_mode,*/ extio_mask; int extio_type, /*extio_mode,*/ extio_mask;
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_type_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_type_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mode_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mode_map));
ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(__out_mask_map)); ASE_ASSERT (out_type >= 0 && out_type <= ASE_COUNTOF(out_mask_map));
/* translate the out_type into the relevant extio type and mode */ /* translate the out_type into the relevant extio type and mode */
extio_type = __out_type_map[out_type]; extio_type = out_type_map[out_type];
/*extio_mode = __out_mode_map[out_type];*/ /*extio_mode = out_mode_map[out_type];*/
extio_mask = __out_mask_map[out_type]; extio_mask = out_mask_map[out_type];
handler = run->extio.handler[extio_type]; handler = run->extio.handler[extio_type];
if (handler == ASE_NULL) if (handler == ASE_NULL)
@ -849,7 +849,7 @@ int ase_awk_closeextio_write (
{ {
ase_awk_io_t handler; ase_awk_io_t handler;
handler = run->extio.handler[p->type & __MASK_CLEAR]; handler = run->extio.handler[p->type & MASK_CLEAR];
if (handler != ASE_NULL) if (handler != ASE_NULL)
{ {
ase_awk_setrunerrnum (run, ASE_AWK_ENOERR); ase_awk_setrunerrnum (run, ASE_AWK_ENOERR);
@ -889,7 +889,7 @@ int ase_awk_closeextio (ase_awk_run_t* run, const ase_char_t* name)
{ {
ase_awk_io_t handler; ase_awk_io_t handler;
handler = run->extio.handler[p->type & __MASK_CLEAR]; handler = run->extio.handler[p->type & MASK_CLEAR];
if (handler != ASE_NULL) if (handler != ASE_NULL)
{ {
ase_awk_setrunerrnum (run, ASE_AWK_ENOERR); ase_awk_setrunerrnum (run, ASE_AWK_ENOERR);
@ -928,7 +928,7 @@ void ase_awk_clearextio (ase_awk_run_t* run)
while (run->extio.chain != ASE_NULL) while (run->extio.chain != ASE_NULL)
{ {
handler = run->extio.handler[ handler = run->extio.handler[
run->extio.chain->type & __MASK_CLEAR]; run->extio.chain->type & MASK_CLEAR];
next = run->extio.chain->next; next = run->extio.chain->next;
if (handler != ASE_NULL) if (handler != ASE_NULL)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: map.c,v 1.37 2007-03-06 14:51:52 bacon Exp $ * $Id: map.c,v 1.38 2007-03-22 10:31:24 bacon Exp $
* *
* {License} * {License}
*/ */
@ -9,7 +9,7 @@
/* TODO: improve the entire map routines. /* TODO: improve the entire map routines.
support automatic bucket resizing and remaping, etc. */ support automatic bucket resizing and remaping, etc. */
static ase_size_t __hash (const ase_char_t* key, ase_size_t key_len); static ase_size_t hash (const ase_char_t* key, ase_size_t key_len);
#define FREE_PAIR(map,pair) \ #define FREE_PAIR(map,pair) \
do { \ do { \
@ -91,7 +91,7 @@ ase_awk_pair_t* ase_awk_map_get (
ase_awk_pair_t* pair; ase_awk_pair_t* pair;
ase_size_t hc; ase_size_t hc;
hc = __hash(key,key_len) % map->capa; hc = hash(key,key_len) % map->capa;
pair = map->buck[hc]; pair = map->buck[hc];
while (pair != ASE_NULL) while (pair != ASE_NULL)
@ -125,7 +125,7 @@ int ase_awk_map_putx (
ase_awk_pair_t* pair; ase_awk_pair_t* pair;
ase_size_t hc; ase_size_t hc;
hc = __hash(key,key_len) % map->capa; hc = hash(key,key_len) % map->capa;
pair = map->buck[hc]; pair = map->buck[hc];
while (pair != ASE_NULL) while (pair != ASE_NULL)
@ -173,7 +173,7 @@ ase_awk_pair_t* ase_awk_map_set (
ase_awk_pair_t* pair; ase_awk_pair_t* pair;
ase_size_t hc; ase_size_t hc;
hc = __hash(key,key_len) % map->capa; hc = hash(key,key_len) % map->capa;
pair = map->buck[hc]; pair = map->buck[hc];
while (pair != ASE_NULL) while (pair != ASE_NULL)
@ -222,7 +222,7 @@ int ase_awk_map_remove (ase_awk_map_t* map, ase_char_t* key, ase_size_t key_len)
ase_awk_pair_t* pair, * prev; ase_awk_pair_t* pair, * prev;
ase_size_t hc; ase_size_t hc;
hc = __hash(key,key_len) % map->capa; hc = hash(key,key_len) % map->capa;
pair = map->buck[hc]; pair = map->buck[hc];
prev = ASE_NULL; prev = ASE_NULL;
@ -269,7 +269,7 @@ int ase_awk_map_walk (ase_awk_map_t* map,
return 0; return 0;
} }
static ase_size_t __hash (const ase_char_t* key, ase_size_t key_len) static ase_size_t hash (const ase_char_t* key, ase_size_t key_len)
{ {
ase_size_t n = 0, i; ase_size_t n = 0, i;
const ase_char_t* end = key + key_len; const ase_char_t* end = key + key_len;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: val.c,v 1.115 2007-03-10 11:58:35 bacon Exp $ * $Id: val.c,v 1.116 2007-03-22 10:31:24 bacon Exp $
* *
* {License} * {License}
*/ */
@ -11,23 +11,23 @@
#endif #endif
static ase_char_t* __str_to_str ( static ase_char_t* str_to_str (
ase_awk_run_t* run, const ase_char_t* str, ase_size_t str_len, ase_awk_run_t* run, const ase_char_t* str, ase_size_t str_len,
int opt, ase_str_t* buf, ase_size_t* len); int opt, ase_str_t* buf, ase_size_t* len);
static ase_char_t* __val_int_to_str ( static ase_char_t* val_int_to_str (
ase_awk_run_t* run, ase_awk_val_int_t* v, ase_awk_run_t* run, ase_awk_val_int_t* v,
int opt, ase_str_t* buf, ase_size_t* len); int opt, ase_str_t* buf, ase_size_t* len);
static ase_char_t* __val_real_to_str ( static ase_char_t* val_real_to_str (
ase_awk_run_t* run, ase_awk_val_real_t* v, ase_awk_run_t* run, ase_awk_val_real_t* v,
int opt, ase_str_t* buf, ase_size_t* len); int opt, ase_str_t* buf, ase_size_t* len);
static ase_awk_val_nil_t __awk_nil = { ASE_AWK_VAL_NIL, 0 }; static ase_awk_val_nil_t awk_nil = { ASE_AWK_VAL_NIL, 0 };
static ase_awk_val_str_t __awk_zls = { ASE_AWK_VAL_STR, 0, ASE_T(""), 0 }; static ase_awk_val_str_t awk_zls = { ASE_AWK_VAL_STR, 0, ASE_T(""), 0 };
ase_awk_val_t* ase_awk_val_nil = (ase_awk_val_t*)&__awk_nil; ase_awk_val_t* ase_awk_val_nil = (ase_awk_val_t*)&awk_nil;
ase_awk_val_t* ase_awk_val_zls = (ase_awk_val_t*)&__awk_zls; ase_awk_val_t* ase_awk_val_zls = (ase_awk_val_t*)&awk_zls;
static ase_awk_val_int_t __awk_int[] = static ase_awk_val_int_t awk_int[] =
{ {
{ ASE_AWK_VAL_INT, 0, -1, ASE_NULL }, { ASE_AWK_VAL_INT, 0, -1, ASE_NULL },
{ ASE_AWK_VAL_INT, 0, 0, ASE_NULL }, { ASE_AWK_VAL_INT, 0, 0, ASE_NULL },
@ -53,18 +53,18 @@ static ase_awk_val_int_t __awk_int[] =
{ ASE_AWK_VAL_INT, 0, 20, ASE_NULL } { ASE_AWK_VAL_INT, 0, 20, ASE_NULL }
}; };
ase_awk_val_t* ase_awk_val_negone = (ase_awk_val_t*)&__awk_int[0]; ase_awk_val_t* ase_awk_val_negone = (ase_awk_val_t*)&awk_int[0];
ase_awk_val_t* ase_awk_val_zero = (ase_awk_val_t*)&__awk_int[1]; ase_awk_val_t* ase_awk_val_zero = (ase_awk_val_t*)&awk_int[1];
ase_awk_val_t* ase_awk_val_one = (ase_awk_val_t*)&__awk_int[2]; ase_awk_val_t* ase_awk_val_one = (ase_awk_val_t*)&awk_int[2];
ase_awk_val_t* ase_awk_makeintval (ase_awk_run_t* run, ase_long_t v) ase_awk_val_t* ase_awk_makeintval (ase_awk_run_t* run, ase_long_t v)
{ {
ase_awk_val_int_t* val; ase_awk_val_int_t* val;
if (v >= __awk_int[0].val && if (v >= awk_int[0].val &&
v <= __awk_int[ASE_COUNTOF(__awk_int)-1].val) v <= awk_int[ASE_COUNTOF(awk_int)-1].val)
{ {
return (ase_awk_val_t*)&__awk_int[v-__awk_int[0].val]; return (ase_awk_val_t*)&awk_int[v-awk_int[0].val];
} }
if (run->icache_count > 0) if (run->icache_count > 0)
@ -219,7 +219,7 @@ ase_awk_val_t* ase_awk_makerexval (
return (ase_awk_val_t*)val; return (ase_awk_val_t*)val;
} }
static void __free_map_val (void* run, void* v) static void free_map_val (void* run, void* v)
{ {
#ifdef DEBUG_VAL #ifdef DEBUG_VAL
ase_dprintf (ASE_T("refdown in map free...")); ase_dprintf (ASE_T("refdown in map free..."));
@ -241,7 +241,7 @@ ase_awk_val_t* ase_awk_makemapval (ase_awk_run_t* run)
val->type = ASE_AWK_VAL_MAP; val->type = ASE_AWK_VAL_MAP;
val->ref = 0; val->ref = 0;
val->map = ase_awk_map_open ( val->map = ase_awk_map_open (
ASE_NULL, run, 256, __free_map_val, run->awk); ASE_NULL, run, 256, free_map_val, run->awk);
if (val->map == ASE_NULL) if (val->map == ASE_NULL)
{ {
ASE_AWK_FREE (run->awk, val); ASE_AWK_FREE (run->awk, val);
@ -281,8 +281,8 @@ ase_bool_t ase_awk_isbuiltinval (ase_awk_val_t* val)
val == ase_awk_val_zls || val == ase_awk_val_zls ||
val == ase_awk_val_zero || val == ase_awk_val_zero ||
val == ase_awk_val_one || val == ase_awk_val_one ||
(val >= (ase_awk_val_t*)&__awk_int[0] && (val >= (ase_awk_val_t*)&awk_int[0] &&
val <= (ase_awk_val_t*)&__awk_int[ASE_COUNTOF(__awk_int)-1]); val <= (ase_awk_val_t*)&awk_int[ASE_COUNTOF(awk_int)-1]);
} }
void ase_awk_freeval (ase_awk_run_t* run, ase_awk_val_t* val, ase_bool_t cache) void ase_awk_freeval (ase_awk_run_t* run, ase_awk_val_t* val, ase_bool_t cache)
@ -429,7 +429,7 @@ ase_char_t* ase_awk_valtostr (
{ {
if (v->type == ASE_AWK_VAL_NIL) if (v->type == ASE_AWK_VAL_NIL)
{ {
return __str_to_str (run, ASE_T(""), 0, opt, buf, len); return str_to_str (run, ASE_T(""), 0, opt, buf, len);
} }
if (v->type == ASE_AWK_VAL_INT) if (v->type == ASE_AWK_VAL_INT)
@ -439,14 +439,14 @@ ase_char_t* ase_awk_valtostr (
/* /*
if (vi->nde != ASE_NULL && vi->nde->str != ASE_NULL) if (vi->nde != ASE_NULL && vi->nde->str != ASE_NULL)
{ {
return __str_to_str ( return str_to_str (
run, vi->nde->str, vi->nde->len, run, vi->nde->str, vi->nde->len,
opt, buf, len); opt, buf, len);
} }
else else
{ {
*/ */
return __val_int_to_str (run, vi, opt, buf, len); return val_int_to_str (run, vi, opt, buf, len);
/*}*/ /*}*/
} }
@ -457,13 +457,13 @@ ase_char_t* ase_awk_valtostr (
/* /*
if (vr->nde != ASE_NULL && vr->nde->str != ASE_NULL) if (vr->nde != ASE_NULL && vr->nde->str != ASE_NULL)
{ {
return __str_to_str ( return str_to_str (
run, vr->nde->str, vr->nde->len, run, vr->nde->str, vr->nde->len,
opt, buf, len); opt, buf, len);
} }
else else
{*/ {*/
return __val_real_to_str (run, vr, opt, buf, len); return val_real_to_str (run, vr, opt, buf, len);
/*}*/ /*}*/
} }
@ -471,7 +471,7 @@ ase_char_t* ase_awk_valtostr (
{ {
ase_awk_val_str_t* vs = (ase_awk_val_str_t*)v; ase_awk_val_str_t* vs = (ase_awk_val_str_t*)v;
return __str_to_str ( return str_to_str (
run, vs->buf, vs->len, opt, buf, len); run, vs->buf, vs->len, opt, buf, len);
} }
@ -485,7 +485,7 @@ ase_char_t* ase_awk_valtostr (
return ASE_NULL; return ASE_NULL;
} }
static ase_char_t* __str_to_str ( static ase_char_t* str_to_str (
ase_awk_run_t* run, const ase_char_t* str, ase_size_t str_len, ase_awk_run_t* run, const ase_char_t* str, ase_size_t str_len,
int opt, ase_str_t* buf, ase_size_t* len) int opt, ase_str_t* buf, ase_size_t* len)
{ {
@ -521,7 +521,7 @@ static ase_char_t* __str_to_str (
} }
} }
static ase_char_t* __val_int_to_str ( static ase_char_t* val_int_to_str (
ase_awk_run_t* run, ase_awk_val_int_t* v, ase_awk_run_t* run, ase_awk_val_int_t* v,
int opt, ase_str_t* buf, ase_size_t* len) int opt, ase_str_t* buf, ase_size_t* len)
{ {
@ -619,7 +619,7 @@ static ase_char_t* __val_int_to_str (
return tmp; return tmp;
} }
static ase_char_t* __val_real_to_str ( static ase_char_t* val_real_to_str (
ase_awk_run_t* run, ase_awk_val_real_t* v, ase_awk_run_t* run, ase_awk_val_real_t* v,
int opt, ase_str_t* buf, ase_size_t* len) int opt, ase_str_t* buf, ase_size_t* len)
{ {
@ -767,16 +767,16 @@ int ase_awk_strtonum (
} }
#define __DPRINTF run->awk->prmfns.misc.dprintf #define DPRINTF run->awk->prmfns.misc.dprintf
#define __DCUSTOM run->awk->prmfns.misc.custom_data #define DCUSTOM run->awk->prmfns.misc.custom_data
static int __print_pair (ase_awk_pair_t* pair, void* arg) static int print_pair (ase_awk_pair_t* pair, void* arg)
{ {
ase_awk_run_t* run = (ase_awk_run_t*)arg; ase_awk_run_t* run = (ase_awk_run_t*)arg;
__DPRINTF (__DCUSTOM, ASE_T(" %s=>"), pair->key); DPRINTF (DCUSTOM, ASE_T(" %s=>"), pair->key);
ase_awk_dprintval ((ase_awk_run_t*)arg, pair->val); ase_awk_dprintval ((ase_awk_run_t*)arg, pair->val);
__DPRINTF (__DCUSTOM, ASE_T(" ")); DPRINTF (DCUSTOM, ASE_T(" "));
return 0; return 0;
} }
@ -787,21 +787,21 @@ void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val)
switch (val->type) switch (val->type)
{ {
case ASE_AWK_VAL_NIL: case ASE_AWK_VAL_NIL:
__DPRINTF (__DCUSTOM, ASE_T("nil")); DPRINTF (DCUSTOM, ASE_T("nil"));
break; break;
case ASE_AWK_VAL_INT: case ASE_AWK_VAL_INT:
#if ASE_SIZEOF_LONG_LONG > 0 #if ASE_SIZEOF_LONG_LONG > 0
__DPRINTF (__DCUSTOM, ASE_T("%lld"), DPRINTF (DCUSTOM, ASE_T("%lld"),
(long long)((ase_awk_val_int_t*)val)->val); (long long)((ase_awk_val_int_t*)val)->val);
#elif ASE_SIZEOF___INT64 > 0 #elif ASE_SIZEOF___INT64 > 0
__DPRINTF (__DCUSTOM, ASE_T("%I64d"), DPRINTF (DCUSTOM, ASE_T("%I64d"),
(__int64)((ase_awk_val_int_t*)val)->val); (__int64)((ase_awk_val_int_t*)val)->val);
#elif ASE_SIZEOF_LONG > 0 #elif ASE_SIZEOF_LONG > 0
__DPRINTF (__DCUSTOM, ASE_T("%ld"), DPRINTF (DCUSTOM, ASE_T("%ld"),
(long)((ase_awk_val_int_t*)val)->val); (long)((ase_awk_val_int_t*)val)->val);
#elif ASE_SIZEOF_INT > 0 #elif ASE_SIZEOF_INT > 0
__DPRINTF (__DCUSTOM, ASE_T("%d"), DPRINTF (DCUSTOM, ASE_T("%d"),
(int)((ase_awk_val_int_t*)val)->val); (int)((ase_awk_val_int_t*)val)->val);
#else #else
#error unsupported size #error unsupported size
@ -809,31 +809,31 @@ void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val)
break; break;
case ASE_AWK_VAL_REAL: case ASE_AWK_VAL_REAL:
__DPRINTF (__DCUSTOM, ASE_T("%Lf"), DPRINTF (DCUSTOM, ASE_T("%Lf"),
(long double)((ase_awk_val_real_t*)val)->val); (long double)((ase_awk_val_real_t*)val)->val);
break; break;
case ASE_AWK_VAL_STR: case ASE_AWK_VAL_STR:
__DPRINTF (__DCUSTOM, ASE_T("%s"), ((ase_awk_val_str_t*)val)->buf); DPRINTF (DCUSTOM, ASE_T("%s"), ((ase_awk_val_str_t*)val)->buf);
break; break;
case ASE_AWK_VAL_REX: case ASE_AWK_VAL_REX:
__DPRINTF (__DCUSTOM, ASE_T("REX[%s]"), ((ase_awk_val_rex_t*)val)->buf); DPRINTF (DCUSTOM, ASE_T("REX[%s]"), ((ase_awk_val_rex_t*)val)->buf);
break; break;
case ASE_AWK_VAL_MAP: case ASE_AWK_VAL_MAP:
__DPRINTF (__DCUSTOM, ASE_T("MAP[")); DPRINTF (DCUSTOM, ASE_T("MAP["));
ase_awk_map_walk (((ase_awk_val_map_t*)val)->map, __print_pair, run); ase_awk_map_walk (((ase_awk_val_map_t*)val)->map, print_pair, run);
__DPRINTF (__DCUSTOM, ASE_T("]")); DPRINTF (DCUSTOM, ASE_T("]"));
break; break;
case ASE_AWK_VAL_REF: case ASE_AWK_VAL_REF:
__DPRINTF (__DCUSTOM, ASE_T("REF[id=%d,val="), ((ase_awk_val_ref_t*)val)->id); DPRINTF (DCUSTOM, ASE_T("REF[id=%d,val="), ((ase_awk_val_ref_t*)val)->id);
ase_awk_dprintval (run, *((ase_awk_val_ref_t*)val)->adr); ase_awk_dprintval (run, *((ase_awk_val_ref_t*)val)->adr);
__DPRINTF (__DCUSTOM, ASE_T("]")); DPRINTF (DCUSTOM, ASE_T("]"));
break; break;
default: default:
__DPRINTF (__DCUSTOM, ASE_T("**** INTERNAL ERROR - INVALID VALUE TYPE ****\n")); DPRINTF (DCUSTOM, ASE_T("**** INTERNAL ERROR - INVALID VALUE TYPE ****\n"));
} }
} }