fixed minor bugs
This commit is contained in:
parent
f675b072d6
commit
44717bbb4f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c 478 2008-12-12 09:42:32Z baconevi $
|
||||
* $Id: awk.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -34,35 +34,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define SRCIO_FILE 1
|
||||
#define SRCIO_STR 2
|
||||
|
||||
typedef struct srcio_data_t
|
||||
{
|
||||
int type; /* file or string */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ase_char_t* ptr;
|
||||
ase_char_t* cur;
|
||||
} str;
|
||||
struct
|
||||
{
|
||||
ase_sll_t* sll;
|
||||
ase_sll_node_t* cur;
|
||||
FILE* handle;
|
||||
} file;
|
||||
} data;
|
||||
} srcio_data_t;
|
||||
|
||||
typedef struct runio_data_t
|
||||
{
|
||||
ase_char_t** icf;
|
||||
ase_size_t icf_no;
|
||||
} runio_data_t;
|
||||
|
||||
static void dprint (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -71,57 +42,6 @@ static void dprint (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
/* custom memory management function */
|
||||
static void* custom_awk_malloc (void* custom, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return HeapAlloc ((HANDLE)custom, 0, n);
|
||||
#else
|
||||
return malloc (n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* custom_awk_realloc (void* custom, void* ptr, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* HeapReAlloc behaves differently from realloc */
|
||||
return (ptr == NULL)?
|
||||
HeapAlloc ((HANDLE)custom, 0, n):
|
||||
HeapReAlloc ((HANDLE)custom, 0, ptr, n);
|
||||
#else
|
||||
return realloc (ptr, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void custom_awk_free (void* custom, void* ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapFree ((HANDLE)custom, 0, ptr);
|
||||
#else
|
||||
free (ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* custom miscellaneous functions */
|
||||
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static int custom_awk_sprintf (
|
||||
void* custom, ase_char_t* buf, ase_size_t size,
|
||||
const ase_char_t* fmt, ...)
|
||||
{
|
||||
int n;
|
||||
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
n = ase_vsprintf (buf, size, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ase_awk_t* app_awk = NULL;
|
||||
ase_awk_run_t* app_run = NULL;
|
||||
|
||||
@ -187,15 +107,22 @@ static void on_run_return (
|
||||
ase_size_t len;
|
||||
ase_char_t* str;
|
||||
|
||||
str = ase_awk_valtostr (run, ret, 0, ASE_NULL, &len);
|
||||
if (str == ASE_NULL)
|
||||
if (ret == ase_awk_val_nil)
|
||||
{
|
||||
dprint (ASE_T("[RETURN] - ***OUT OF MEMORY***\n"));
|
||||
dprint (ASE_T("[RETURN] - ***nil***\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dprint (ASE_T("[RETURN] - %.*s\n"), (int)len, str);
|
||||
ase_awk_free (ase_awk_getrunawk(run), str);
|
||||
str = ase_awk_valtostr (run, ret, 0, ASE_NULL, &len);
|
||||
if (str == ASE_NULL)
|
||||
{
|
||||
dprint (ASE_T("[RETURN] - ***OUT OF MEMORY***\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dprint (ASE_T("[RETURN] - [%.*s]\n"), (int)len, str);
|
||||
ase_awk_free (ase_awk_getrunawk(run), str);
|
||||
}
|
||||
}
|
||||
|
||||
dprint (ASE_T("[NAMED VARIABLES]\n"));
|
||||
@ -304,7 +231,7 @@ static void out_of_memory (void)
|
||||
|
||||
struct argout_t
|
||||
{
|
||||
void* isp; /* input source files or string */
|
||||
void* isp; /* input source files or string */
|
||||
int ist; /* input source type */
|
||||
ase_size_t isfl; /* the number of input source files */
|
||||
ase_char_t* osf; /* output source file */
|
||||
@ -366,14 +293,14 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (isf == ASE_NULL)
|
||||
{
|
||||
out_of_memory ();
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
vm = ase_map_open (ASE_NULL, 0, 30, 70);
|
||||
if (vm == ASE_NULL)
|
||||
{
|
||||
out_of_memory ();
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
ase_map_setcopier (vm, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setcopier (vm, ASE_MAP_VAL, ASE_MAP_COPIER_INLINE);
|
||||
@ -403,7 +330,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (tmp == ASE_NULL)
|
||||
{
|
||||
out_of_memory ();
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
isf = tmp;
|
||||
@ -432,7 +359,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (eq == ASE_NULL)
|
||||
{
|
||||
/* INVALID VALUE... */
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
*eq = ASE_T('\0');
|
||||
@ -440,7 +367,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (ase_map_upsert (vm, opt.arg, ase_strlen(opt.arg)+1, eq, ase_strlen(eq)+1) == ASE_NULL)
|
||||
{
|
||||
out_of_memory ();
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -456,7 +383,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
ase_printf (ASE_T("Error: illegal option - %c\n"), opt.opt);
|
||||
}
|
||||
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
case ASE_T(':'):
|
||||
@ -470,11 +397,11 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
ase_printf (ASE_T("Error: bad argument for %c\n"), opt.opt);
|
||||
}
|
||||
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
default:
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,7 +412,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (opt.ind >= argc)
|
||||
{
|
||||
/* no source code specified */
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
/* the source code is the string, not from the file */
|
||||
@ -504,7 +431,7 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
if (icf == ASE_NULL)
|
||||
{
|
||||
out_of_memory ();
|
||||
ABORT (on_error);
|
||||
ABORT (oops);
|
||||
}
|
||||
|
||||
if (opt.ind >= argc)
|
||||
@ -526,72 +453,24 @@ static int handle_args (int argc, ase_char_t* argv[], struct argout_t* ao)
|
||||
|
||||
return 0;
|
||||
|
||||
on_error:
|
||||
oops:
|
||||
if (vm != ASE_NULL) ase_map_close (vm);
|
||||
if (icf != ASE_NULL) free (icf);
|
||||
if (isf != ASE_NULL) free (isf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
typedef struct extension_t
|
||||
{
|
||||
ase_mmgr_t mmgr;
|
||||
ase_awk_prmfns_t prmfns;
|
||||
}
|
||||
extension_t;
|
||||
|
||||
static void init_awk_extension (ase_awk_t* awk)
|
||||
{
|
||||
extension_t* ext = (extension_t*) ase_awk_getextension(awk);
|
||||
|
||||
ext->mmgr = *ase_awk_getmmgr(awk);
|
||||
ase_awk_setmmgr (awk, &ext->mmgr);
|
||||
ase_awk_setccls (awk, ASE_CCLS_GETDFL());
|
||||
|
||||
ext->prmfns.pow = custom_awk_pow;
|
||||
ext->prmfns.sprintf = custom_awk_sprintf;
|
||||
ext->prmfns.data = ASE_NULL;
|
||||
|
||||
ase_awk_setprmfns (awk, &ext->prmfns);
|
||||
}
|
||||
|
||||
static ase_awk_t* open_awk (void)
|
||||
{
|
||||
ase_awk_t* awk;
|
||||
ase_mmgr_t mmgr;
|
||||
|
||||
memset (&mmgr, 0, ASE_SIZEOF(mmgr));
|
||||
mmgr.alloc = custom_awk_malloc;
|
||||
mmgr.realloc = custom_awk_realloc;
|
||||
mmgr.free = custom_awk_free;
|
||||
|
||||
#ifdef _WIN32
|
||||
mmgr.data = (void*)HeapCreate (0, 1000000, 1000000); /* TODO: get size from xxxx */
|
||||
if (mmgr.data == NULL)
|
||||
{
|
||||
ase_printf (ASE_T("Error: cannot create an awk heap\n"));
|
||||
return ASE_NULL;
|
||||
}
|
||||
#else
|
||||
mmgr.data = ASE_NULL;
|
||||
#endif
|
||||
|
||||
awk = ase_awk_open (&mmgr, ASE_SIZEOF(extension_t));
|
||||
awk = ase_awk_opensimple (0);
|
||||
if (awk == ASE_NULL)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapDestroy ((HANDLE)mmgr.data);
|
||||
#endif
|
||||
ase_printf (ASE_T("ERROR: cannot open awk\n"));
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
init_awk_extension (awk);
|
||||
|
||||
ase_awk_setoption (awk,
|
||||
ASE_AWK_IMPLICIT | ASE_AWK_EXTIO | ASE_AWK_NEWLINE |
|
||||
ASE_AWK_BASEONE | ASE_AWK_PABLOCK);
|
||||
|
||||
/* TODO: get depth from command line */
|
||||
ase_awk_setmaxdepth (
|
||||
awk, ASE_AWK_DEPTH_BLOCK_PARSE | ASE_AWK_DEPTH_EXPR_PARSE, 50);
|
||||
@ -611,9 +490,6 @@ static ase_awk_t* open_awk (void)
|
||||
1, 1, ASE_NULL, bfn_sleep) == ASE_NULL)
|
||||
{
|
||||
ase_awk_close (awk);
|
||||
#ifdef _WIN32
|
||||
HeapDestroy ((HANDLE)mmgr.data);
|
||||
#endif
|
||||
ase_printf (ASE_T("ERROR: cannot add function 'sleep'\n"));
|
||||
return ASE_NULL;
|
||||
}
|
||||
@ -621,26 +497,12 @@ static ase_awk_t* open_awk (void)
|
||||
return awk;
|
||||
}
|
||||
|
||||
static void close_awk (ase_awk_t* awk)
|
||||
{
|
||||
extension_t* ext = (extension_t*)ase_awk_getextension(awk);
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE heap = (HANDLE)ext->mmgr.data;
|
||||
#endif
|
||||
|
||||
ase_awk_close (awk);
|
||||
|
||||
#ifdef _WIN32
|
||||
HeapDestroy (heap);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int awk_main (int argc, ase_char_t* argv[])
|
||||
{
|
||||
ase_awk_t* awk;
|
||||
|
||||
ase_awk_srcios_t srcios;
|
||||
ase_awk_runcbs_t runcbs;
|
||||
|
||||
int i, file_count = 0;
|
||||
const ase_char_t* mfn = ASE_NULL;
|
||||
int mode = 0;
|
||||
@ -676,18 +538,23 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
ase_awk_geterrmsg(awk)
|
||||
);
|
||||
|
||||
close_awk (awk);
|
||||
ase_awk_close (awk);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
SetConsoleCtrlHandler (stop_run, TRUE);
|
||||
#else
|
||||
signal (SIGINT, stop_run);
|
||||
#endif
|
||||
|
||||
if (ase_awk_runsimple (awk, ao.icf) == -1)
|
||||
runcbs.on_start = on_run_start;
|
||||
runcbs.on_statement = on_run_statement;
|
||||
runcbs.on_return = on_run_return;
|
||||
runcbs.on_end = on_run_end;
|
||||
runcbs.data = ASE_NULL;
|
||||
|
||||
if (ase_awk_runsimple (awk, ao.icf, &runcbs) == -1)
|
||||
{
|
||||
ase_printf (
|
||||
ASE_T("RUN ERROR: CODE [%d] LINE [%u] %s\n"),
|
||||
@ -696,11 +563,11 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
ase_awk_geterrmsg(awk)
|
||||
);
|
||||
|
||||
close_awk (awk);
|
||||
ase_awk_close (awk);
|
||||
return -1;
|
||||
}
|
||||
|
||||
close_awk (awk);
|
||||
ase_awk_close (awk);
|
||||
|
||||
if (ao.ist == ASE_AWK_PARSE_FILES && ao.isp != ASE_NULL) free (ao.isp);
|
||||
if (ao.osf != ASE_NULL) free (ao.osf);
|
||||
|
@ -28,5 +28,6 @@ BEGIN {
|
||||
print "wide characteter 넓은 문자";
|
||||
|
||||
print fflush ("abc");
|
||||
return "x.awk";
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h 478 2008-12-12 09:42:32Z baconevi $
|
||||
* $Id: awk.h 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -606,8 +606,8 @@ extern ase_awk_val_t* ase_awk_val_one;
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_awk_t* ase_awk_open (
|
||||
ase_mmgr_t* mmgr /* a memory manager */,
|
||||
ase_size_t ext /* size of extension area in bytes */
|
||||
ase_mmgr_t* mmgr /* a memory manager */,
|
||||
ase_size_t xtnsize /* size of extension area in bytes */
|
||||
);
|
||||
/******/
|
||||
|
||||
@ -648,19 +648,19 @@ void ase_awk_setmmgr (
|
||||
ase_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
/****f* ase.awk/ase_awk_getextension
|
||||
/****f* ase.awk/ase_awk_getxtn
|
||||
* NAME
|
||||
* ase_awk_getextension - get the extension
|
||||
* ase_awk_getxtn - get the extension
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The extension area is allocated in the ase_awk_open() function when it is
|
||||
* given a positive extension size. The pointer to the beginning of the area
|
||||
* can be acquired using the ase_awk_getextension() function and be utilized
|
||||
* can be acquired using the ase_awk_getxtn() function and be utilized
|
||||
* for various purposes.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
void* ase_awk_getextension (
|
||||
void* ase_awk_getxtn (
|
||||
ase_awk_t* awk /* an awk object */
|
||||
);
|
||||
/******/
|
||||
@ -832,7 +832,9 @@ int ase_awk_parse (
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_awk_t* ase_awk_opensimple (void);
|
||||
ase_awk_t* ase_awk_opensimple (
|
||||
ase_size_t xtnsize /* size of extension area in bytes */
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* ase.awk/ase_awk_parsesimple
|
||||
@ -856,8 +858,9 @@ int ase_awk_parsesimple (
|
||||
* SYNOPSIS
|
||||
*/
|
||||
int ase_awk_runsimple (
|
||||
ase_awk_t* awk,
|
||||
ase_char_t** icf /* input console files */
|
||||
ase_awk_t* awk,
|
||||
ase_char_t** icf /* input console files */,
|
||||
ase_awk_runcbs_t* cbs /* callbacks */
|
||||
);
|
||||
/******/
|
||||
|
||||
@ -1155,36 +1158,4 @@ int ase_awk_strtonum (
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ase_ns_awk_t
|
||||
{
|
||||
ase_awk_t* (*open) (ase_mmgr_t*, ase_size_t ext);
|
||||
int (*close) (ase_awk_t*);
|
||||
|
||||
ase_mmgr_t* (*getmmgr) (ase_awk_t*);
|
||||
void (*setmmgr) (ase_awk_t*, ase_mmgr_t*);
|
||||
void* (*getextension) (ase_awk_t*);
|
||||
|
||||
ase_ccls_t* (*getccls) (ase_awk_t*);
|
||||
void (*setccls) (ase_awk_t*, ase_ccls_t*);
|
||||
|
||||
ase_awk_prmfns_t* (*getprmfns) (ase_awk_t*);
|
||||
void (*setprmfns) (ase_awk_t*, ase_awk_prmfns_t*);
|
||||
|
||||
int (*parse) (ase_awk_t*, ase_awk_srcios_t*);
|
||||
};
|
||||
|
||||
#define ase_ns_awk_d \
|
||||
{ \
|
||||
ase_awk_open, \
|
||||
ase_awk_close, \
|
||||
ase_awk_getmmgr, \
|
||||
ase_awk_setmmgr, \
|
||||
ase_awk_getextension, \
|
||||
ase_awk_getccls, \
|
||||
ase_awk_setccls, \
|
||||
ase_awk_getprmfns, \
|
||||
ase_awk_setprmfns, \
|
||||
ase_awk_parse \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -148,7 +148,7 @@ ase_dll_freeer_t ase_dll_getfreeer (
|
||||
* NAME Gets the pointer to the extension area
|
||||
* RETURN the pointer to the extension area
|
||||
*/
|
||||
void* ase_dll_getextension (
|
||||
void* ase_dll_getxtn (
|
||||
ase_dll_t* dll /* a singly linked list */
|
||||
);
|
||||
|
||||
|
@ -43,13 +43,14 @@ typedef enum ase_lda_walk_t ase_lda_walk_t;
|
||||
#define ASE_LDA_DLEN(lda,index) ((lda)->node[index]->dlen)
|
||||
|
||||
#define ASE_LDA_MMGR(lda) ((lda)->mmgr)
|
||||
#define ASE_LDA_XTN(lda) ((void*)(((ase_lda_t*)lda) + 1))
|
||||
|
||||
#define ASE_LDA_COPIER(lda) ((lda)->copier)
|
||||
#define ASE_LDA_FREEER(lda) ((lda)->freeer)
|
||||
#define ASE_LDA_COMPER(lda) ((lda)->comper)
|
||||
#define ASE_LDA_KEEPER(lda) ((lda)->keeper)
|
||||
#define ASE_LDA_SIZER(lda) ((lda)->sizer)
|
||||
|
||||
#define ASE_LDA_EXTENSION(lda) ((void*)(((ase_lda_t*)lda) + 1))
|
||||
|
||||
|
||||
/****b* ase.cmn.lda/ase_lda_copier_t
|
||||
@ -244,16 +245,16 @@ void ase_lda_fini (
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* ase.cmn.lda/ase_lda_getextension
|
||||
/****f* ase.cmn.lda/ase_lda_getxtn
|
||||
* NAME
|
||||
* ase_lda_getextension - get the pointer to the extension
|
||||
* ase_lda_getxtn - get the pointer to the extension
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The ase_lda_getextension() function returns the pointer to the extension.
|
||||
* The ase_lda_getxtn() function returns the pointer to the extension.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
void* ase_lda_getextension (
|
||||
void* ase_lda_getxtn (
|
||||
ase_lda_t* lda /* a linear dynamic array */
|
||||
);
|
||||
/******/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.h 483 2008-12-14 13:25:42Z baconevi $
|
||||
* $Id: map.h 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -223,6 +223,8 @@ struct ase_map_t
|
||||
/*****/
|
||||
|
||||
#define ASE_MAP_MMGR(m) ((m)->mmgr)
|
||||
#define ASE_MAP_XTN(m) ((void*)(((ase_map_t*)m) + 1))
|
||||
|
||||
#define ASE_MAP_KCOPIER(m) ((m)->copier[ASE_MAP_KEY])
|
||||
#define ASE_MAP_VCOPIER(m) ((m)->copier[ASE_MAP_VAL])
|
||||
#define ASE_MAP_KFREEER(m) ((m)->freeer[ASE_MAP_KEY])
|
||||
@ -231,7 +233,6 @@ struct ase_map_t
|
||||
#define ASE_MAP_COMPER(m) ((m)->comper)
|
||||
#define ASE_MAP_KEEPER(m) ((m)->keeper)
|
||||
#define ASE_MAP_SIZER(m) ((m)->sizer)
|
||||
#define ASE_MAP_EXTENSION(m) ((void*)(((ase_map_t*)m) + 1))
|
||||
|
||||
#define ASE_MAP_FACTOR(m) ((m)->factor)
|
||||
#define ASE_MAP_KSCALE(m) ((m)->scale[ASE_MAP_KEY])
|
||||
@ -257,7 +258,7 @@ extern "C" {
|
||||
* than 0. The load factor should be between 0 and 100 inclusive and the load
|
||||
* factor of 0 disables bucket resizing. If you need extra space associated
|
||||
* with a map, you may pass a non-zero value as the second parameter.
|
||||
* The ASE_MAP_EXTENSION() macro and the ase_map_getextension() function
|
||||
* The ASE_MAP_XTN() macro and the ase_map_getxtn() function
|
||||
* return the pointer to the beginning of the extension.
|
||||
*
|
||||
* RETURN
|
||||
@ -265,7 +266,7 @@ extern "C" {
|
||||
* ASE_NULL on failure.
|
||||
*
|
||||
* SEE ALSO
|
||||
* ASE_MAP_EXTENSION, ase_map_getextension
|
||||
* ASE_MAP_XTN, ase_map_getxtn
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
@ -303,7 +304,7 @@ void ase_map_fini (
|
||||
ase_map_t* map
|
||||
);
|
||||
|
||||
void* ase_map_getextension (
|
||||
void* ase_map_getxtn (
|
||||
ase_map_t* map
|
||||
);
|
||||
|
||||
|
@ -166,6 +166,7 @@ struct ase_sll_node_t
|
||||
#define ASE_SLL_COPIER_INLINE ((ase_sll_copier_t)2)
|
||||
|
||||
#define ASE_SLL_MMGR(sll) ((sll)->mmgr)
|
||||
#define ASE_SLL_XTN(s) ((void*)(((ase_sll_t*)s) + 1))
|
||||
#define ASE_SLL_COPIER(sll) ((sll)->copier)
|
||||
#define ASE_SLL_FREEER(sll) ((sll)->freeer)
|
||||
#define ASE_SLL_COMPER(sll) ((sll)->comper)
|
||||
@ -261,16 +262,16 @@ void ase_sll_fini (
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* ase.cmn.sll/ase_sll_getextension
|
||||
/****f* ase.cmn.sll/ase_sll_getxtn
|
||||
* NAME
|
||||
* ase_sll_getextension - get the pointer to the extension
|
||||
* ase_sll_getxtn - get the pointer to the extension
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The ase_sll_getextension() function returns the pointer to the extension.
|
||||
* The ase_sll_getxtn() function returns the pointer to the extension.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
void* ase_sll_getextension (
|
||||
void* ase_sll_getxtn (
|
||||
ase_sll_t* sll /* a singly linked list */
|
||||
);
|
||||
/******/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str.h 455 2008-11-26 09:05:00Z baconevi $
|
||||
* $Id: str.h 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -34,8 +34,8 @@
|
||||
#define ASE_STR_CHAR(s,idx) ((s)->ptr[idx])
|
||||
|
||||
#define ASE_STR_MMGR(s) ((s)->mmgr)
|
||||
#define ASE_STR_XTN(s) ((void*)(((ase_str_t*)s) + 1))
|
||||
#define ASE_STR_SIZER(s) ((s)->sizer)
|
||||
#define ASE_STR_EXTENSION(s) ((void*)(((ase_str_t*)s) + 1))
|
||||
|
||||
typedef struct ase_str_t ase_str_t;
|
||||
typedef ase_size_t (*ase_str_sizer_t) (ase_str_t* data, ase_size_t hint);
|
||||
@ -273,7 +273,7 @@ int ase_str_yield (
|
||||
);
|
||||
/******/
|
||||
|
||||
void* ase_str_getextension (
|
||||
void* ase_str_getxtn (
|
||||
ase_str_t* str
|
||||
);
|
||||
|
||||
|
@ -46,6 +46,7 @@ enum
|
||||
|
||||
|
||||
#define ASE_TIO_MMGR(tio) ((tio)->mmgr)
|
||||
#define ASE_TIO_XTN(s) ((void*)(((ase_tio_t*)s) + 1))
|
||||
#define ASE_TIO_ERRNUM(tio) ((tio)->errnum)
|
||||
|
||||
/*
|
||||
@ -115,7 +116,7 @@ int ase_tio_fini (
|
||||
ase_tio_t* tio
|
||||
);
|
||||
|
||||
void* ase_tio_getextension (
|
||||
void* ase_tio_getxtn (
|
||||
ase_tio_t* tio
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp 469 2008-12-11 10:05:28Z baconevi $
|
||||
* $Id: Awk.cpp 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -1178,7 +1178,7 @@ int Awk::open ()
|
||||
return -1;
|
||||
}
|
||||
|
||||
*(Awk**)ase_map_getextension(functionMap) = this;
|
||||
*(Awk**)ASE_MAP_XTN(functionMap) = this;
|
||||
ase_map_setcopier (functionMap, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setfreeer (functionMap, ASE_MAP_VAL, freeFunctionMapValue);
|
||||
ase_map_setscale (functionMap, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
@ -1681,7 +1681,7 @@ int Awk::functionHandler (
|
||||
void Awk::freeFunctionMapValue (map_t* map, void* dptr, size_t dlen)
|
||||
{
|
||||
//Awk* awk = (Awk*)owner;
|
||||
Awk* awk = *(Awk**)ase_map_getextension(map);
|
||||
Awk* awk = *(Awk**)ASE_MAP_XTN(map);
|
||||
ase_awk_free (awk->awk, dptr);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c 455 2008-11-26 09:05:00Z baconevi $
|
||||
* $Id: awk.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
static void free_afn (ase_map_t* map, void* vptr, ase_size_t vlen)
|
||||
{
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_MAP_EXTENSION(map);
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_MAP_XTN(map);
|
||||
ase_awk_afn_t* f = (ase_awk_afn_t*)vptr;
|
||||
|
||||
/* f->name doesn't have to be freed */
|
||||
@ -35,7 +35,7 @@ static void free_afn (ase_map_t* map, void* vptr, ase_size_t vlen)
|
||||
|
||||
static void free_bfn (ase_map_t* map, void* vptr, ase_size_t vlen)
|
||||
{
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_MAP_EXTENSION(map);
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_MAP_XTN(map);
|
||||
ase_awk_bfn_t* f = (ase_awk_bfn_t*)vptr;
|
||||
|
||||
ASE_AWK_FREE (awk, f);
|
||||
@ -66,7 +66,7 @@ ase_awk_t* ase_awk_open (ase_mmgr_t* mmgr, ase_size_t ext)
|
||||
|
||||
awk->wtab = ase_map_open (mmgr, ASE_SIZEOF(awk), 512, 70);
|
||||
if (awk->wtab == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->wtab) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->wtab) = awk;
|
||||
ase_map_setcopier (awk->wtab, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setcopier (awk->wtab, ASE_MAP_VAL, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setscale (awk->wtab, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
@ -74,7 +74,7 @@ ase_awk_t* ase_awk_open (ase_mmgr_t* mmgr, ase_size_t ext)
|
||||
|
||||
awk->rwtab = ase_map_open (mmgr, ASE_SIZEOF(awk), 512, 70);
|
||||
if (awk->rwtab == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->rwtab) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->rwtab) = awk;
|
||||
ase_map_setcopier (awk->rwtab, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setcopier (awk->rwtab, ASE_MAP_VAL, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setscale (awk->rwtab, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
@ -83,21 +83,21 @@ ase_awk_t* ase_awk_open (ase_mmgr_t* mmgr, ase_size_t ext)
|
||||
/* TODO: initial map size?? */
|
||||
awk->tree.afns = ase_map_open (mmgr, ASE_SIZEOF(awk), 512, 70);
|
||||
if (awk->tree.afns == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->tree.afns) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->tree.afns) = awk;
|
||||
ase_map_setcopier (awk->tree.afns, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setfreeer (awk->tree.afns, ASE_MAP_VAL, free_afn);
|
||||
ase_map_setscale (awk->tree.afns, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
|
||||
awk->parse.afns = ase_map_open (mmgr, ASE_SIZEOF(awk), 256, 70);
|
||||
if (awk->parse.afns == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->parse.afns) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->parse.afns) = awk;
|
||||
ase_map_setcopier (awk->parse.afns, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setcopier (awk->parse.afns, ASE_MAP_VAL, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setscale (awk->parse.afns, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
|
||||
awk->parse.named = ase_map_open (mmgr, ASE_SIZEOF(awk), 256, 70);
|
||||
if (awk->parse.named == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->parse.named) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->parse.named) = awk;
|
||||
ase_map_setcopier (awk->parse.named, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setcopier (awk->parse.named, ASE_MAP_VAL, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setscale (awk->parse.named, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
@ -110,15 +110,15 @@ ase_awk_t* ase_awk_open (ase_mmgr_t* mmgr, ase_size_t ext)
|
||||
awk->parse.locals == ASE_NULL ||
|
||||
awk->parse.params == ASE_NULL) goto oops;
|
||||
|
||||
*(ase_awk_t**)ASE_LDA_EXTENSION(awk->parse.globals) = awk;
|
||||
*(ase_awk_t**)ASE_LDA_XTN(awk->parse.globals) = awk;
|
||||
ase_lda_setcopier (awk->parse.globals, ASE_LDA_COPIER_INLINE);
|
||||
ase_lda_setscale (awk->parse.globals, ASE_SIZEOF(ase_char_t));
|
||||
|
||||
*(ase_awk_t**)ASE_LDA_EXTENSION(awk->parse.locals) = awk;
|
||||
*(ase_awk_t**)ASE_LDA_XTN(awk->parse.locals) = awk;
|
||||
ase_lda_setcopier (awk->parse.locals, ASE_LDA_COPIER_INLINE);
|
||||
ase_lda_setscale (awk->parse.locals, ASE_SIZEOF(ase_char_t));
|
||||
|
||||
*(ase_awk_t**)ASE_LDA_EXTENSION(awk->parse.params) = awk;
|
||||
*(ase_awk_t**)ASE_LDA_XTN(awk->parse.params) = awk;
|
||||
ase_lda_setcopier (awk->parse.params, ASE_LDA_COPIER_INLINE);
|
||||
ase_lda_setscale (awk->parse.params, ASE_SIZEOF(ase_char_t));
|
||||
|
||||
@ -156,7 +156,7 @@ ase_awk_t* ase_awk_open (ase_mmgr_t* mmgr, ase_size_t ext)
|
||||
awk->bfn.sys = ASE_NULL;
|
||||
awk->bfn.user = ase_map_open (mmgr, ASE_SIZEOF(awk), 512, 70);
|
||||
if (awk->bfn.user == ASE_NULL) goto oops;
|
||||
*(ase_awk_t**)ASE_MAP_EXTENSION(awk->bfn.user) = awk;
|
||||
*(ase_awk_t**)ASE_MAP_XTN(awk->bfn.user) = awk;
|
||||
ase_map_setcopier (awk->bfn.user, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setfreeer (awk->bfn.user, ASE_MAP_VAL, free_bfn);
|
||||
ase_map_setscale (awk->bfn.user, ASE_MAP_KEY, ASE_SIZEOF(ase_char_t));
|
||||
@ -304,7 +304,7 @@ int ase_awk_clear (ase_awk_t* awk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ase_awk_getextension (ase_awk_t* awk)
|
||||
void* ase_awk_getxtn (ase_awk_t* awk)
|
||||
{
|
||||
return (void*)(awk + 1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c 416 2008-10-11 14:10:25Z baconevi $
|
||||
* $Id: parse.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -1433,7 +1433,7 @@ struct check_global_t
|
||||
static ase_lda_walk_t check_global (ase_lda_t* lda, ase_size_t index, void* arg)
|
||||
{
|
||||
ase_cstr_t tmp;
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_LDA_EXTENSION(lda);
|
||||
ase_awk_t* awk = *(ase_awk_t**)ASE_LDA_XTN(lda);
|
||||
check_global_t* cg = (check_global_t*)arg;
|
||||
|
||||
tmp.ptr = ASE_LDA_DPTR(lda,index);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c 469 2008-12-11 10:05:28Z baconevi $
|
||||
* $Id: run.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -734,13 +734,13 @@ ase_bool_t ase_awk_isstop (ase_awk_run_t* run)
|
||||
static void free_namedval (ase_map_t* map, void* dptr, ase_size_t dlen)
|
||||
{
|
||||
ase_awk_refdownval (
|
||||
*(ase_awk_run_t**)ASE_MAP_EXTENSION(map), dptr);
|
||||
*(ase_awk_run_t**)ASE_MAP_XTN(map), dptr);
|
||||
}
|
||||
|
||||
static void same_namedval (ase_map_t* map, void* dptr, ase_size_t dlen)
|
||||
{
|
||||
ase_awk_refdownval_nofree (
|
||||
*(ase_awk_run_t**)ASE_MAP_EXTENSION(map), dptr);
|
||||
*(ase_awk_run_t**)ASE_MAP_XTN(map), dptr);
|
||||
}
|
||||
|
||||
static int init_run (
|
||||
@ -807,7 +807,7 @@ static int init_run (
|
||||
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
|
||||
return -1;
|
||||
}
|
||||
*(ase_awk_run_t**)ASE_MAP_EXTENSION(run->named) = run;
|
||||
*(ase_awk_run_t**)ASE_MAP_XTN(run->named) = run;
|
||||
ase_map_setcopier (run->named, ASE_MAP_KEY, ASE_MAP_COPIER_INLINE);
|
||||
ase_map_setfreeer (run->named, ASE_MAP_VAL, free_namedval);
|
||||
ase_map_setkeeper (run->named, same_namedval);
|
||||
|
@ -9,11 +9,10 @@
|
||||
#include <stdarg.h>
|
||||
#include <ase/utl/stdio.h>
|
||||
|
||||
typedef struct ext_t
|
||||
typedef struct xtn_t
|
||||
{
|
||||
ase_awk_prmfns_t prmfns;
|
||||
}
|
||||
ext_t;
|
||||
} xtn_t;
|
||||
|
||||
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||
{
|
||||
@ -34,26 +33,25 @@ static int custom_awk_sprintf (
|
||||
return n;
|
||||
}
|
||||
|
||||
ase_awk_t* ase_awk_opensimple (void)
|
||||
ase_awk_t* ase_awk_opensimple (ase_size_t xtnsize)
|
||||
{
|
||||
ase_awk_t* awk;
|
||||
ext_t* ext;
|
||||
xtn_t* xtn;
|
||||
|
||||
awk = ase_awk_open (ASE_MMGR_GETDFL(), ASE_SIZEOF(ext_t));
|
||||
awk = ase_awk_open (ASE_MMGR_GETDFL(), xtnsize + ASE_SIZEOF(xtn_t));
|
||||
ase_awk_setccls (awk, ASE_CCLS_GETDFL());
|
||||
|
||||
ext = (ext_t*)ase_awk_getextension(awk);
|
||||
ext->prmfns.pow = custom_awk_pow;
|
||||
ext->prmfns.sprintf = custom_awk_sprintf;
|
||||
ext->prmfns.data = ASE_NULL;
|
||||
ase_awk_setprmfns (awk, &ext->prmfns);
|
||||
xtn = (xtn_t*)((ase_byte_t*)ase_awk_getxtn(awk) + xtnsize);
|
||||
|
||||
xtn->prmfns.pow = custom_awk_pow;
|
||||
xtn->prmfns.sprintf = custom_awk_sprintf;
|
||||
xtn->prmfns.data = ASE_NULL;
|
||||
ase_awk_setprmfns (awk, &xtn->prmfns);
|
||||
|
||||
ase_awk_setoption (awk,
|
||||
ASE_AWK_IMPLICIT | ASE_AWK_EXTIO | ASE_AWK_NEWLINE |
|
||||
ASE_AWK_BASEONE | ASE_AWK_PABLOCK);
|
||||
|
||||
/*ase_awk_addfunction ();*/
|
||||
|
||||
return awk;
|
||||
}
|
||||
|
||||
@ -393,8 +391,7 @@ static ase_ssize_t awk_extio_file (
|
||||
else if (epa->mode == ASE_AWK_EXTIO_FILE_APPEND)
|
||||
{
|
||||
mode = ASE_SIO_APPEND |
|
||||
ASE_SIO_CREATE |
|
||||
ASE_SIO_TRUNCATE;
|
||||
ASE_SIO_CREATE;
|
||||
}
|
||||
else return -1; /* TODO: any way to set the error number? */
|
||||
|
||||
@ -682,34 +679,66 @@ static ase_ssize_t awk_extio_console (
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ase_awk_runsimple (ase_awk_t* awk, ase_char_t** icf)
|
||||
int ase_awk_runsimple (ase_awk_t* awk, ase_char_t** icf, ase_awk_runcbs_t* cbs)
|
||||
{
|
||||
ase_awk_runcbs_t runcbs;
|
||||
ase_awk_runios_t runios;
|
||||
ase_awk_runios_t ios;
|
||||
runio_data_t rd;
|
||||
|
||||
rd.ic.files = icf;
|
||||
rd.ic.index = 0;
|
||||
|
||||
runios.pipe = awk_extio_pipe;
|
||||
runios.file = awk_extio_file;
|
||||
runios.console = awk_extio_console;
|
||||
runios.data = &rd;
|
||||
|
||||
/*
|
||||
runcbs.on_start = on_run_start;
|
||||
runcbs.on_statement = on_run_statement;
|
||||
runcbs.on_return = on_run_return;
|
||||
runcbs.on_end = on_run_end;
|
||||
runcbs.data = ASE_NULL;
|
||||
*/
|
||||
ios.pipe = awk_extio_pipe;
|
||||
ios.file = awk_extio_file;
|
||||
ios.console = awk_extio_console;
|
||||
ios.data = &rd;
|
||||
|
||||
return ase_awk_run (
|
||||
awk,
|
||||
ASE_NULL/*mfn*/,
|
||||
&runios,
|
||||
ASE_NULL/*&runcbs*/,
|
||||
&ios,
|
||||
cbs,
|
||||
ASE_NULL/*runarg*/,
|
||||
ASE_NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*** EXTRA BUILTIN FUNCTIONS ***/
|
||||
#if 0
|
||||
int aes_awk_func_sleep (
|
||||
ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl)
|
||||
{
|
||||
ase_size_t nargs;
|
||||
ase_awk_val_t* a0;
|
||||
ase_long_t lv;
|
||||
ase_real_t rv;
|
||||
ase_awk_val_t* r;
|
||||
int n;
|
||||
|
||||
nargs = ase_awk_getnargs (run);
|
||||
ASE_ASSERT (nargs == 1);
|
||||
|
||||
a0 = ase_awk_getarg (run, 0);
|
||||
|
||||
n = ase_awk_valtonum (run, a0, &lv, &rv);
|
||||
if (n == -1) return -1;
|
||||
if (n == 1) lv = (ase_long_t)rv;
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep ((DWORD)(lv * 1000));
|
||||
n = 0;
|
||||
#else
|
||||
n = sleep (lv);
|
||||
#endif
|
||||
|
||||
r = ase_awk_makeintval (run, n);
|
||||
if (r == ASE_NULL)
|
||||
{
|
||||
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ase_awk_setretval (run, r);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c 468 2008-12-10 10:19:59Z baconevi $
|
||||
* $Id: val.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -430,7 +430,7 @@ static void same_mapval (void* run, void* v)
|
||||
*/
|
||||
static void free_mapval (ase_map_t* map, void* dptr, ase_size_t dlen)
|
||||
{
|
||||
ase_awk_run_t* run = *(ase_awk_run_t**)ASE_MAP_EXTENSION(map);
|
||||
ase_awk_run_t* run = *(ase_awk_run_t**)ASE_MAP_XTN(map);
|
||||
|
||||
#ifdef DEBUG_VAL
|
||||
ase_dprintf (ASE_T("refdown in map free..."));
|
||||
@ -443,7 +443,7 @@ static void free_mapval (ase_map_t* map, void* dptr, ase_size_t dlen)
|
||||
|
||||
static void same_mapval (ase_map_t* map, void* dptr, ase_size_t dlen)
|
||||
{
|
||||
ase_awk_run_t* run = *(ase_awk_run_t**)ASE_MAP_EXTENSION(map);
|
||||
ase_awk_run_t* run = *(ase_awk_run_t**)ASE_MAP_XTN(map);
|
||||
#ifdef DEBUG_VAL
|
||||
ase_dprintf (ASE_T("refdown nofree in map free..."));
|
||||
ase_awk_dprintval (run, dptr);
|
||||
@ -501,7 +501,7 @@ ase_awk_val_t* ase_awk_makemapval (ase_awk_run_t* run)
|
||||
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
|
||||
return ASE_NULL;
|
||||
}
|
||||
*(ase_awk_run_t**)ASE_MAP_EXTENSION(val->map) = run;
|
||||
*(ase_awk_run_t**)ASE_MAP_XTN(val->map) = run;
|
||||
|
||||
/* the key is copied inline into a pair and is freed when the pair
|
||||
* is destroyed */
|
||||
@ -1141,7 +1141,7 @@ static ase_map_walk_t print_pair (
|
||||
{
|
||||
ase_awk_run_t* run = (ase_awk_run_t*)arg;
|
||||
|
||||
ASE_ASSERT (run == *(ase_awk_run_t**)ASE_MAP_EXTENSION(map));
|
||||
ASE_ASSERT (run == *(ase_awk_run_t**)ASE_MAP_XTN(map));
|
||||
|
||||
DPRINTF (DCUSTOM, ASE_T(" %.*s=>"),
|
||||
(int)ASE_MAP_KLEN(pair), ASE_MAP_KPTR(pair));
|
||||
|
@ -43,7 +43,7 @@ void ase_dll_clear (ase_dll_t* dll)
|
||||
ASE_ASSERT (dll->tail == ASE_NULL);
|
||||
}
|
||||
|
||||
void* ase_dll_getextension (ase_dll_t* dll)
|
||||
void* ase_dll_getxtn (ase_dll_t* dll)
|
||||
{
|
||||
return dll + 1;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void ase_lda_fini (lda_t* lda)
|
||||
}
|
||||
}
|
||||
|
||||
void* ase_lda_getextension (lda_t* lda)
|
||||
void* ase_lda_getxtn (lda_t* lda)
|
||||
{
|
||||
return lda + 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.c 483 2008-12-14 13:25:42Z baconevi $
|
||||
* $Id: map.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -274,7 +274,7 @@ void ase_map_fini (map_t* map)
|
||||
ASE_MMGR_FREE (map->mmgr, map->bucket);
|
||||
}
|
||||
|
||||
void* ase_map_getextension (map_t* map)
|
||||
void* ase_map_getxtn (map_t* map)
|
||||
{
|
||||
return map + 1;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void ase_sll_fini (sll_t* sll)
|
||||
ase_sll_clear (sll);
|
||||
}
|
||||
|
||||
void* ase_sll_getextension (sll_t* sll)
|
||||
void* ase_sll_getxtn (sll_t* sll)
|
||||
{
|
||||
return sll + 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str_dyn.c 379 2008-09-24 08:06:56Z baconevi $
|
||||
* $Id: str_dyn.c 496 2008-12-15 09:56:48Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -92,7 +92,7 @@ int ase_str_yield (ase_str_t* str, ase_xstr_t* buf, int new_capa)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ase_str_getextension (ase_str_t* str)
|
||||
void* ase_str_getxtn (ase_str_t* str)
|
||||
{
|
||||
return str + 1;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int ase_tio_fini (ase_tio_t* tio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ase_tio_getextension (ase_tio_t* tio)
|
||||
void* ase_tio_getxtn (ase_tio_t* tio)
|
||||
{
|
||||
return tio + 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user