*** empty log message ***
This commit is contained in:
parent
9d4383cd7b
commit
d6307aafe2
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.109 2007-02-23 08:17:48 bacon Exp $
|
||||
* $Id: awk.c,v 1.110 2007-02-24 14:31:43 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -48,7 +48,7 @@ ase_awk_t* ase_awk_open (
|
||||
awk = (ase_awk_t*) malloc (ASE_SIZEOF(ase_awk_t));
|
||||
#else
|
||||
awk = (ase_awk_t*) prmfns->mmgr.malloc (
|
||||
&prmfns->mmgr, ASE_SIZEOF(ase_awk_t));
|
||||
prmfns->mmgr.custom_data, ASE_SIZEOF(ase_awk_t));
|
||||
#endif
|
||||
if (awk == ASE_NULL)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.191 2007-02-23 08:17:49 bacon Exp $
|
||||
* $Id: awk.h,v 1.192 2007-02-24 14:31:43 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -22,14 +22,14 @@ typedef struct ase_awk_runios_t ase_awk_runios_t;
|
||||
typedef struct ase_awk_runcbs_t ase_awk_runcbs_t;
|
||||
typedef struct ase_awk_runarg_t ase_awk_runarg_t;
|
||||
|
||||
typedef ase_real_t (*ase_awk_pow_t) (ase_real_t x, ase_real_t y);
|
||||
|
||||
typedef ase_real_t (*ase_awk_pow_t) (void* custom, ase_real_t x, ase_real_t y);
|
||||
typedef int (*ase_awk_sprintf_t) (
|
||||
ase_char_t* buf, ase_size_t size, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_aprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_dprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_abort_t) (void* custom_data);
|
||||
typedef void (*ase_awk_lock_t) (void* custom_data);
|
||||
void* custom, ase_char_t* buf, ase_size_t size,
|
||||
const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_aprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_awk_abort_t) (void* custom);
|
||||
typedef void (*ase_awk_lock_t) (void* custom);
|
||||
|
||||
typedef ase_ssize_t (*ase_awk_io_t) (
|
||||
int cmd, void* arg, ase_char_t* data, ase_size_t count);
|
||||
@ -81,7 +81,7 @@ struct ase_awk_prmfns_t
|
||||
ase_awk_lock_t lock; /* required if multi-threaded */
|
||||
ase_awk_lock_t unlock; /* required if multi-threaded */
|
||||
|
||||
/* user-defined data passed to selected system functions */
|
||||
/* user-defined data passed to the functions above */
|
||||
void* custom_data; /* optional */
|
||||
} misc;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: func.c,v 1.96 2007-02-23 08:17:49 bacon Exp $
|
||||
* $Id: func.c,v 1.97 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -54,6 +54,7 @@ void* ase_awk_addbfn (
|
||||
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' added already"), name_len, name);
|
||||
ase_awk_seterror (awk, ASE_AWK_EEXIST, 0, awk->errmsg);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: jni.c,v 1.69 2007-02-23 08:53:35 bacon Exp $
|
||||
* $Id: jni.c,v 1.70 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -96,32 +96,54 @@ struct run_data_t
|
||||
jmethodID double_value;
|
||||
};
|
||||
|
||||
static void* awk_malloc (ase_mmgr_t* mmgr, ase_size_t n)
|
||||
static void* awk_malloc (void* custom, ase_size_t n)
|
||||
{
|
||||
return malloc (n);
|
||||
}
|
||||
|
||||
static void* awk_realloc (ase_mmgr_t* mmgr, void* ptr, ase_size_t n)
|
||||
static void* awk_realloc (void* custom, void* ptr, ase_size_t n)
|
||||
{
|
||||
return realloc (ptr, n);
|
||||
}
|
||||
|
||||
static void awk_free (ase_mmgr_t* mmgr, void* ptr)
|
||||
static void awk_free (void* custom, void* ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
static ase_real_t awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static void awk_abort (void* custom_data)
|
||||
static void awk_abort (void* custom)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
static void awk_dprintf (const ase_char_t* fmt, ...)
|
||||
static int 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;
|
||||
}
|
||||
|
||||
static void awk_printf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
ase_vfprintf (stdout, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void awk_dprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -245,8 +267,8 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
|
||||
prmfns.ccls.custom_data = NULL;
|
||||
|
||||
prmfns.misc.pow = awk_pow;
|
||||
prmfns.misc.sprintf = ase_sprintf;
|
||||
prmfns.misc.aprintf = ase_printf;
|
||||
prmfns.misc.sprintf = awk_sprintf;
|
||||
prmfns.misc.aprintf = awk_printf;
|
||||
prmfns.misc.dprintf = awk_dprintf;
|
||||
prmfns.misc.abort = awk_abort;
|
||||
prmfns.misc.custom_data = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.51 2007-02-23 08:17:49 bacon Exp $
|
||||
* $Id: misc.c,v 1.52 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -910,12 +910,14 @@ int ase_awk_assertfail (ase_awk_t* awk,
|
||||
if (desc == ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.aprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
|
||||
file, line, expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.aprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n\nDESCRIPTION:\n%s\n"),
|
||||
file, line, expr, desc);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.245 2007-02-23 08:17:49 bacon Exp $
|
||||
* $Id: parse.c,v 1.246 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -333,7 +333,8 @@ static struct __bvent __bvtab[] =
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
awk->prmfns.misc.sprintf ( \
|
||||
(awk)->prmfns.misc.sprintf ( \
|
||||
(awk)->prmfns.misc.custom_data, \
|
||||
(awk)->errmsg, ASE_COUNTOF((awk)->errmsg), \
|
||||
msg, \
|
||||
ASE_STR_LEN(&(awk)->token.name), \
|
||||
@ -709,6 +710,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' not a valid function name"),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
@ -728,6 +730,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("built-in function '%.*s' redefined"),
|
||||
name_len, name);
|
||||
@ -743,6 +746,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
{
|
||||
/* the function is defined previously */
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("function '%.*s' redefined"),
|
||||
name_len, name);
|
||||
@ -763,6 +767,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
if (g != (ase_size_t)-1)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("global variable '%.*s' redefined"),
|
||||
name_len, name);
|
||||
@ -850,6 +855,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' not a valid parameter name"),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
@ -876,6 +882,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
ase_awk_tab_clear (&awk->parse.params);
|
||||
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("conflicting parameter '%.*s' with the function"),
|
||||
param_len, param);
|
||||
@ -903,6 +910,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
ase_awk_tab_clear (&awk->parse.params);
|
||||
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("duplicate parameter '%.*s'"),
|
||||
param_len, param);
|
||||
@ -991,6 +999,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' not a valid start of the function body"),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
@ -1334,6 +1343,7 @@ static ase_awk_t* __add_global (
|
||||
if (ase_awk_getbfn (awk, name, len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("built-in function '%.*s' redefined"),
|
||||
len, name);
|
||||
@ -1347,6 +1357,7 @@ static ase_awk_t* __add_global (
|
||||
&awk->tree.afns, name, len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("function '%.*s' redefined"),
|
||||
len, name);
|
||||
@ -1361,6 +1372,7 @@ static ase_awk_t* __add_global (
|
||||
&awk->parse.globals, 0, name, len) != (ase_size_t)-1)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("duplicate global variable '%.*s'"),
|
||||
len, name);
|
||||
@ -1401,6 +1413,7 @@ static ase_awk_t* __collect_globals (ase_awk_t* awk)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' not a valid variable name"),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
@ -1459,6 +1472,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("'%.*s' not a valid variable name"),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
@ -1482,6 +1496,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
if (ase_awk_getbfn (awk, local, local_len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("built-in function '%.*s' redefined"),
|
||||
local_len, local);
|
||||
@ -1497,6 +1512,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
&awk->tree.afns, local, local_len) != ASE_NULL)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("function '%.*s' redefined"),
|
||||
local_len, local);
|
||||
@ -1513,6 +1529,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
0, local, local_len) != (ase_size_t)-1)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("parameter '%.*s' redefined"),
|
||||
local_len, local);
|
||||
@ -1529,6 +1546,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
local, local_len) != (ase_size_t)-1)
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("duplicate local variable '%.*s'"),
|
||||
local_len, local);
|
||||
@ -2969,6 +2987,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line)
|
||||
* of the function call */
|
||||
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("function name '%.*s' without a left parenthesis"),
|
||||
name_len, name_dup);
|
||||
@ -3080,6 +3099,7 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line)
|
||||
}
|
||||
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("undefined identifier '%.*s'"),
|
||||
name_len, name_dup);
|
||||
@ -3223,6 +3243,7 @@ static ase_awk_nde_t* __parse_hashidx (
|
||||
ASE_AWK_FREE (awk, nde);
|
||||
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("undefined identifier '%.*s'"), name_len, name);
|
||||
ase_awk_seterror (awk, ASE_AWK_EUNDEF, line, awk->errmsg);
|
||||
@ -4610,6 +4631,7 @@ static int __get_token (ase_awk_t* awk)
|
||||
else
|
||||
{
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
||||
ASE_T("invalid character '%c'"), c);
|
||||
ase_awk_seterror (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.329 2007-02-23 08:17:50 bacon Exp $
|
||||
* $Id: run.c,v 1.330 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -247,6 +247,7 @@ static int __set_global (
|
||||
if (var != ASE_NULL)
|
||||
{
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("map '%.*s' not assignable with a scalar"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -701,7 +702,6 @@ int ase_awk_run (ase_awk_t* awk,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the run loop ended. execute the end callback if it exists */
|
||||
if (runcbs != ASE_NULL && runcbs->on_end != ASE_NULL)
|
||||
{
|
||||
@ -1776,7 +1776,7 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
|
||||
while (p != ASE_NULL && run->exit_level == EXIT_NONE)
|
||||
{
|
||||
/*run->awk->prmfns.dprintf (ASE_T("running a statement\n"));*/
|
||||
if (__run_statement(run,p) == -1)
|
||||
if (__run_statement (run, p) == -1)
|
||||
{
|
||||
n = -1;
|
||||
break;
|
||||
@ -1909,9 +1909,10 @@ static int __run_statement (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
default:
|
||||
{
|
||||
ase_awk_val_t* v;
|
||||
v = __eval_expression(run,nde);
|
||||
v = __eval_expression (run, nde);
|
||||
if (v == ASE_NULL) return -1;
|
||||
|
||||
/* destroy the value if not referenced */
|
||||
ase_awk_refupval (run, v);
|
||||
ase_awk_refdownval (run, v);
|
||||
|
||||
@ -2412,6 +2413,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
if (val->type != ASE_AWK_VAL_MAP)
|
||||
{
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("'%.*s' not deletable"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -2523,6 +2525,7 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde)
|
||||
if (val->type != ASE_AWK_VAL_MAP)
|
||||
{
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("'%.*s' not deletable"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -3104,6 +3107,7 @@ static ase_awk_val_t* __do_assignment_scalar (
|
||||
/* once a variable becomes a map,
|
||||
* it cannot be changed to a scalar variable */
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("map '%.*s' not assignable with a scalar"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -3138,6 +3142,7 @@ static ase_awk_val_t* __do_assignment_scalar (
|
||||
/* once the variable becomes a map,
|
||||
* it cannot be changed to a scalar variable */
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("map '%.*s' not assignable with a scalar"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -3158,6 +3163,7 @@ static ase_awk_val_t* __do_assignment_scalar (
|
||||
/* once the variable becomes a map,
|
||||
* it cannot be changed to a scalar variable */
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg, ASE_COUNTOF(run->errmsg),
|
||||
ASE_T("map '%.*s' not assignable with a scalar"),
|
||||
var->id.name_len, var->id.name);
|
||||
@ -4427,14 +4433,18 @@ static ase_awk_val_t* __eval_binop_exp (
|
||||
{
|
||||
/* left - int, right - real */
|
||||
res = ase_awk_makerealval (run,
|
||||
run->awk->prmfns.misc.pow((ase_real_t)l1,(ase_real_t)r2));
|
||||
run->awk->prmfns.misc.pow (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
(ase_real_t)l1,(ase_real_t)r2));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* left - real, right - real */
|
||||
ASE_AWK_ASSERT (run->awk, n3 == 3);
|
||||
res = ase_awk_makerealval (run,
|
||||
run->awk->prmfns.misc.pow((ase_real_t)r1,(ase_real_t)r2));
|
||||
run->awk->prmfns.misc.pow(
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
(ase_real_t)r1,(ase_real_t)r2));
|
||||
}
|
||||
|
||||
if (res == ASE_NULL)
|
||||
@ -5250,6 +5260,7 @@ static ase_awk_val_t* __eval_afn (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
call->what.afn.name.len > ASE_COUNTOF(run->errmsg)-len2)
|
||||
{
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg,
|
||||
ASE_COUNTOF(run->errmsg),
|
||||
fmt2,
|
||||
@ -5259,6 +5270,7 @@ static ase_awk_val_t* __eval_afn (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
else
|
||||
{
|
||||
run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->errmsg,
|
||||
ASE_COUNTOF(run->errmsg),
|
||||
fmt,
|
||||
@ -6483,6 +6495,7 @@ ase_char_t* ase_awk_format (
|
||||
do
|
||||
{
|
||||
n = run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->format.tmp.ptr,
|
||||
run->format.tmp.len,
|
||||
#if ASE_SIZEOF_LONG_LONG > 0
|
||||
@ -6588,6 +6601,7 @@ ase_char_t* ase_awk_format (
|
||||
do
|
||||
{
|
||||
n = run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->format.tmp.ptr,
|
||||
run->format.tmp.len,
|
||||
#if ASE_SIZEOF_LONG_LONG > 0
|
||||
@ -6708,6 +6722,7 @@ ase_char_t* ase_awk_format (
|
||||
do
|
||||
{
|
||||
n = run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->format.tmp.ptr,
|
||||
run->format.tmp.len,
|
||||
ASE_STR_BUF(fbu),
|
||||
@ -6795,6 +6810,7 @@ ase_char_t* ase_awk_format (
|
||||
do
|
||||
{
|
||||
n = run->awk->prmfns.misc.sprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
run->format.tmp.ptr,
|
||||
run->format.tmp.len,
|
||||
ASE_STR_BUF(fbu),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.c,v 1.103 2007-02-23 08:17:51 bacon Exp $
|
||||
* $Id: tree.c,v 1.104 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -261,10 +261,12 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
ase_char_t tmp[256];
|
||||
#if (ASE_SIZEOF_LONG_DOUBLE != 0)
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
tmp, ASE_COUNTOF(tmp), ASE_T("%Lf"),
|
||||
(long double)((ase_awk_nde_real_t*)nde)->val);
|
||||
#elif (ASE_SIZEOF_DOUBLE != 0)
|
||||
awk->prmfns.misc.sprintf (
|
||||
awk->prmfns.misc.custom_data,
|
||||
tmp, ASE_COUNTOF(tmp), ASE_T("%f"),
|
||||
(double)((ase_awk_nde_real_t*)nde)->val);
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.110 2007-02-23 08:17:51 bacon Exp $
|
||||
* $Id: val.c,v 1.111 2007-02-24 14:31:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -341,9 +341,13 @@ void ase_awk_refupval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
if (ase_awk_isbuiltinval(val)) return;
|
||||
|
||||
/*
|
||||
run->awk->prmfns.misc.dprintf (ASE_T("ref up [ptr=%p] [count=%d] "), val, (int)val->ref);
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("ref up [ptr=%p] [count=%d] "), val, (int)val->ref);
|
||||
ase_awk_dprintval (run, val);
|
||||
run->awk->prmfns.misc.dprintf (ASE_T("\n"));
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("\n"));
|
||||
*/
|
||||
|
||||
val->ref++;
|
||||
@ -354,9 +358,13 @@ void ase_awk_refdownval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
if (ase_awk_isbuiltinval(val)) return;
|
||||
|
||||
/*
|
||||
run->awk->prmfns.misc.dprintf (ASE_T("ref down [ptr=%p] [count=%d]\n"), val, (int)val->ref);
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("ref down [ptr=%p] [count=%d]\n"), val, (int)val->ref);
|
||||
ase_awk_dprintval (run, val);
|
||||
run->awk->prmfns.misc.dprintf (ASE_T("\n"));
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("\n"));
|
||||
*/
|
||||
|
||||
ASE_AWK_ASSERTX (run->awk, val->ref > 0,
|
||||
@ -465,6 +473,7 @@ ase_char_t* ase_awk_valtostr (
|
||||
|
||||
#ifdef _DEBUG
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("ERROR: WRONG VALUE TYPE [%d] in ase_awk_valtostr\n"),
|
||||
v->type);
|
||||
#endif
|
||||
@ -722,6 +731,7 @@ int ase_awk_valtonum (
|
||||
|
||||
#ifdef _DEBUG
|
||||
run->awk->prmfns.misc.dprintf (
|
||||
run->awk->prmfns.misc.custom_data,
|
||||
ASE_T("ERROR: WRONG VALUE TYPE [%d] in ase_awk_valtonum\n"),
|
||||
v->type);
|
||||
#endif
|
||||
@ -751,14 +761,15 @@ int ase_awk_strtonum (
|
||||
}
|
||||
|
||||
#define __DPRINTF run->awk->prmfns.misc.dprintf
|
||||
#define __DCUSTOM run->awk->prmfns.misc.custom_data
|
||||
|
||||
static int __print_pair (ase_awk_pair_t* pair, void* arg)
|
||||
{
|
||||
ase_awk_run_t* run = (ase_awk_run_t*)arg;
|
||||
|
||||
__DPRINTF (ASE_T(" %s=>"), pair->key);
|
||||
__DPRINTF (__DCUSTOM, ASE_T(" %s=>"), pair->key);
|
||||
ase_awk_dprintval ((ase_awk_run_t*)arg, pair->val);
|
||||
__DPRINTF (ASE_T(" "));
|
||||
__DPRINTF (__DCUSTOM, ASE_T(" "));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -769,21 +780,21 @@ void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
switch (val->type)
|
||||
{
|
||||
case ASE_AWK_VAL_NIL:
|
||||
__DPRINTF (ASE_T("nil"));
|
||||
__DPRINTF (__DCUSTOM, ASE_T("nil"));
|
||||
break;
|
||||
|
||||
case ASE_AWK_VAL_INT:
|
||||
#if ASE_SIZEOF_LONG_LONG > 0
|
||||
__DPRINTF (ASE_T("%lld"),
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%lld"),
|
||||
(long long)((ase_awk_val_int_t*)val)->val);
|
||||
#elif ASE_SIZEOF___INT64 > 0
|
||||
__DPRINTF (ASE_T("%I64d"),
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%I64d"),
|
||||
(__int64)((ase_awk_val_int_t*)val)->val);
|
||||
#elif ASE_SIZEOF_LONG > 0
|
||||
__DPRINTF (ASE_T("%ld"),
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%ld"),
|
||||
(long)((ase_awk_val_int_t*)val)->val);
|
||||
#elif ASE_SIZEOF_INT > 0
|
||||
__DPRINTF (ASE_T("%d"),
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%d"),
|
||||
(int)((ase_awk_val_int_t*)val)->val);
|
||||
#else
|
||||
#error unsupported size
|
||||
@ -791,31 +802,31 @@ void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
break;
|
||||
|
||||
case ASE_AWK_VAL_REAL:
|
||||
__DPRINTF (ASE_T("%Lf"),
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%Lf"),
|
||||
(long double)((ase_awk_val_real_t*)val)->val);
|
||||
break;
|
||||
|
||||
case ASE_AWK_VAL_STR:
|
||||
__DPRINTF (ASE_T("%s"), ((ase_awk_val_str_t*)val)->buf);
|
||||
__DPRINTF (__DCUSTOM, ASE_T("%s"), ((ase_awk_val_str_t*)val)->buf);
|
||||
break;
|
||||
|
||||
case ASE_AWK_VAL_REX:
|
||||
__DPRINTF (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;
|
||||
|
||||
case ASE_AWK_VAL_MAP:
|
||||
__DPRINTF (ASE_T("MAP["));
|
||||
__DPRINTF (__DCUSTOM, ASE_T("MAP["));
|
||||
ase_awk_map_walk (((ase_awk_val_map_t*)val)->map, __print_pair, run);
|
||||
__DPRINTF (ASE_T("]"));
|
||||
__DPRINTF (__DCUSTOM, ASE_T("]"));
|
||||
break;
|
||||
|
||||
case ASE_AWK_VAL_REF:
|
||||
__DPRINTF (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);
|
||||
__DPRINTF (ASE_T("]"));
|
||||
__DPRINTF (__DCUSTOM, ASE_T("]"));
|
||||
break;
|
||||
|
||||
default:
|
||||
__DPRINTF (ASE_T("**** INTERNAL ERROR - INVALID VALUE TYPE ****\n"));
|
||||
__DPRINTF (__DCUSTOM, ASE_T("**** INTERNAL ERROR - INVALID VALUE TYPE ****\n"));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
OUT = asecmn
|
||||
|
||||
C_SRCS = mem.c str.c
|
||||
C_SRCS = mem.c str.c rex.c
|
||||
C_OBJS = $(C_SRCS:.c=.obj)
|
||||
|
||||
CC = bcc32
|
||||
|
138
ase/com/Awk.cpp
138
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.25 2007-02-23 15:34:26 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.26 2007-02-24 14:32:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -92,32 +92,112 @@ CAwk::~CAwk ()
|
||||
}
|
||||
}
|
||||
|
||||
static void* awk_malloc (ase_mmgr_t* mmgr, ase_size_t n)
|
||||
static void* custom_awk_malloc (void* custom, ase_size_t n)
|
||||
{
|
||||
return malloc (n);
|
||||
}
|
||||
|
||||
static void* awk_realloc (ase_mmgr_t* mmgr, void* ptr, ase_size_t n)
|
||||
static void* custom_awk_realloc (void* custom, void* ptr, ase_size_t n)
|
||||
{
|
||||
return realloc (ptr, n);
|
||||
}
|
||||
|
||||
static void awk_free (ase_mmgr_t* mmgr, void* ptr)
|
||||
static void custom_awk_free (void* custom, void* ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
ase_bool_t custom_awk_isupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isupper (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_islower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_islower (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isalpha (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalpha (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isxdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isxdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isalnum (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalnum (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isspace (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isspace (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isprint (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isprint (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_isgraph (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isgraph (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_iscntrl (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_iscntrl (c);
|
||||
}
|
||||
|
||||
ase_bool_t custom_awk_ispunct (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_ispunct (c);
|
||||
}
|
||||
|
||||
ase_cint_t custom_awk_toupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_toupper (c);
|
||||
}
|
||||
|
||||
ase_cint_t custom_awk_tolower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_tolower (c);
|
||||
}
|
||||
|
||||
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static void awk_abort (void* custom_data)
|
||||
static void custom_awk_abort (void* custom)
|
||||
{
|
||||
abort ();
|
||||
|
||||
}
|
||||
|
||||
static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
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;
|
||||
}
|
||||
|
||||
static void custom_awk_aprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int n;
|
||||
@ -131,7 +211,7 @@ static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void awk_dprintf (const ase_char_t* fmt, ...)
|
||||
static void custom_awk_dprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -406,29 +486,29 @@ HRESULT CAwk::Parse (int* ret)
|
||||
|
||||
memset (&prmfns, 0, sizeof(prmfns));
|
||||
|
||||
prmfns.mmgr.malloc = awk_malloc;
|
||||
prmfns.mmgr.realloc = awk_realloc;
|
||||
prmfns.mmgr.free = awk_free;
|
||||
prmfns.mmgr.malloc = custom_awk_malloc;
|
||||
prmfns.mmgr.realloc = custom_awk_realloc;
|
||||
prmfns.mmgr.free = custom_awk_free;
|
||||
|
||||
prmfns.ccls.is_upper = ase_isupper;
|
||||
prmfns.ccls.is_lower = ase_islower;
|
||||
prmfns.ccls.is_alpha = ase_isalpha;
|
||||
prmfns.ccls.is_digit = ase_isdigit;
|
||||
prmfns.ccls.is_xdigit = ase_isxdigit;
|
||||
prmfns.ccls.is_alnum = ase_isalnum;
|
||||
prmfns.ccls.is_space = ase_isspace;
|
||||
prmfns.ccls.is_print = ase_isprint;
|
||||
prmfns.ccls.is_graph = ase_isgraph;
|
||||
prmfns.ccls.is_cntrl = ase_iscntrl;
|
||||
prmfns.ccls.is_punct = ase_ispunct;
|
||||
prmfns.ccls.to_upper = ase_toupper;
|
||||
prmfns.ccls.to_lower = ase_tolower;
|
||||
prmfns.ccls.is_upper = custom_awk_isupper;
|
||||
prmfns.ccls.is_lower = custom_awk_islower;
|
||||
prmfns.ccls.is_alpha = custom_awk_isalpha;
|
||||
prmfns.ccls.is_digit = custom_awk_isdigit;
|
||||
prmfns.ccls.is_xdigit = custom_awk_isxdigit;
|
||||
prmfns.ccls.is_alnum = custom_awk_isalnum;
|
||||
prmfns.ccls.is_space = custom_awk_isspace;
|
||||
prmfns.ccls.is_print = custom_awk_isprint;
|
||||
prmfns.ccls.is_graph = custom_awk_isgraph;
|
||||
prmfns.ccls.is_cntrl = custom_awk_iscntrl;
|
||||
prmfns.ccls.is_punct = custom_awk_ispunct;
|
||||
prmfns.ccls.to_upper = custom_awk_toupper;
|
||||
prmfns.ccls.to_lower = custom_awk_tolower;
|
||||
|
||||
prmfns.misc.pow = awk_pow;
|
||||
prmfns.misc.sprintf = ase_sprintf;
|
||||
prmfns.misc.aprintf = awk_aprintf;
|
||||
prmfns.misc.dprintf = awk_dprintf;
|
||||
prmfns.misc.abort = awk_abort;
|
||||
prmfns.misc.pow = custom_awk_pow;
|
||||
prmfns.misc.sprintf = custom_awk_sprintf;
|
||||
prmfns.misc.aprintf = custom_awk_aprintf;
|
||||
prmfns.misc.dprintf = custom_awk_dprintf;
|
||||
prmfns.misc.abort = custom_awk_abort;
|
||||
|
||||
handle = ase_awk_open (&prmfns, NULL, &errnum);
|
||||
if (handle == NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: err.c,v 1.12 2007-02-23 10:53:38 bacon Exp $
|
||||
* $Id: err.c,v 1.13 2007-02-24 14:32:10 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -64,6 +64,7 @@ void ase_lsp_seterror (
|
||||
{
|
||||
case 0:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt);
|
||||
@ -71,6 +72,7 @@ void ase_lsp_seterror (
|
||||
|
||||
case 1:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt,
|
||||
@ -79,6 +81,7 @@ void ase_lsp_seterror (
|
||||
|
||||
case 2:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt,
|
||||
@ -88,6 +91,7 @@ void ase_lsp_seterror (
|
||||
|
||||
case 3:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt,
|
||||
@ -98,6 +102,7 @@ void ase_lsp_seterror (
|
||||
|
||||
case 4:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt,
|
||||
@ -109,6 +114,7 @@ void ase_lsp_seterror (
|
||||
|
||||
case 5:
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
lsp->errmsg,
|
||||
ASE_COUNTOF(lsp->errmsg),
|
||||
errfmt,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lsp.c,v 1.25 2007-02-23 10:53:38 bacon Exp $
|
||||
* $Id: lsp.c,v 1.26 2007-02-24 14:32:11 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -48,7 +48,7 @@ ase_lsp_t* ase_lsp_open (
|
||||
lsp = (ase_lsp_t*) malloc (ASE_SIZEOF(ase_lsp_t));
|
||||
#else
|
||||
lsp = (ase_lsp_t*) prmfns->mmgr.malloc (
|
||||
&prmfns->mmgr, ASE_SIZEOF(ase_lsp_t));
|
||||
prmfns->mmgr.custom_data, ASE_SIZEOF(ase_lsp_t));
|
||||
#endif
|
||||
if (lsp == ASE_NULL) return ASE_NULL;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lsp.h,v 1.39 2007-02-23 10:53:38 bacon Exp $
|
||||
* $Id: lsp.h,v 1.40 2007-02-24 14:32:11 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -17,13 +17,14 @@ typedef struct ase_lsp_prmfns_t ase_lsp_prmfns_t;
|
||||
typedef ase_ssize_t (*ase_lsp_io_t) (
|
||||
int cmd, void* arg, ase_char_t* data, ase_size_t count);
|
||||
|
||||
typedef ase_real_t (*ase_lsp_pow_t) (ase_real_t x, ase_real_t y);
|
||||
|
||||
typedef ase_real_t (*ase_lsp_pow_t) (
|
||||
void* custom, ase_real_t x, ase_real_t y);
|
||||
typedef int (*ase_lsp_sprintf_t) (
|
||||
ase_char_t* buf, ase_size_t size, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_aprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_dprintf_t) (const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_abort_t) (void* custom_data);
|
||||
void* custom, ase_char_t* buf, ase_size_t size,
|
||||
const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_aprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
||||
typedef void (*ase_lsp_abort_t) (void* custom);
|
||||
|
||||
struct ase_lsp_prmfns_t
|
||||
{
|
||||
@ -39,7 +40,6 @@ struct ase_lsp_prmfns_t
|
||||
ase_lsp_abort_t abort;
|
||||
void* custom_data;
|
||||
} misc;
|
||||
|
||||
};
|
||||
|
||||
/* io function commands */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mem.c,v 1.31 2007-02-23 10:53:38 bacon Exp $
|
||||
* $Id: mem.c,v 1.32 2007-02-24 14:32:11 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -96,6 +96,7 @@ ase_lsp_obj_t* ase_lsp_alloc (ase_lsp_mem_t* mem, int type, ase_size_t size)
|
||||
|
||||
/* TODO: remove the following line... */
|
||||
ase_lsp_gc (mem);
|
||||
|
||||
if (mem->count >= mem->ubound) ase_lsp_gc (mem);
|
||||
if (mem->count >= mem->ubound)
|
||||
{
|
||||
@ -326,6 +327,7 @@ static void __mark_objs_in_use (ase_lsp_mem_t* mem)
|
||||
if (mem->macro != ASE_NULL) __mark_obj (mem->lsp, mem->macro);
|
||||
}
|
||||
|
||||
#include <ase/utl/stdio.h>
|
||||
static void __sweep_unmarked_objs (ase_lsp_mem_t* mem)
|
||||
{
|
||||
ase_lsp_obj_t* obj, * prev, * next;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.9 2007-02-23 10:53:39 bacon Exp $
|
||||
* $Id: misc.c,v 1.10 2007-02-24 14:32:11 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -580,12 +580,14 @@ int ase_lsp_assertfail (ase_lsp_t* lsp,
|
||||
if (desc == ASE_NULL)
|
||||
{
|
||||
lsp->prmfns.misc.aprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n"),
|
||||
file, line, expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
lsp->prmfns.misc.aprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
ASE_T("ASSERTION FAILURE AT FILE %s LINE %d\n%s\n\nDESCRIPTION:\n%s\n"),
|
||||
file, line, expr, desc);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: print.c,v 1.25 2007-02-23 10:53:39 bacon Exp $
|
||||
* $Id: print.c,v 1.26 2007-02-24 14:32:11 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -45,18 +45,22 @@ static int __print (ase_lsp_t* lsp, const ase_lsp_obj_t* obj, ase_bool_t prt_con
|
||||
case ASE_LSP_OBJ_INT:
|
||||
#if ASE_SIZEOF_LONG_LONG > 0
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("%lld"), (long long)ASE_LSP_IVAL(obj));
|
||||
#elif ASE_SIZEOF___INT64 > 0
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("%I64d"), (__int64)ASE_LSP_IVAL(obj));
|
||||
#elif ASE_SIZEOF_LONG > 0
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("%ld"), (long)ASE_LSP_IVAL(obj));
|
||||
#elif ASE_SIZEOF_INT > 0
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("%d"), (int)ASE_LSP_IVAL(obj));
|
||||
#else
|
||||
@ -66,7 +70,9 @@ static int __print (ase_lsp_t* lsp, const ase_lsp_obj_t* obj, ase_bool_t prt_con
|
||||
break;
|
||||
|
||||
case ASE_LSP_OBJ_REAL:
|
||||
lsp->prmfns.misc.sprintf (buf, ASE_COUNTOF(buf),
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("%Lf"), (long double)ASE_LSP_RVAL(obj));
|
||||
|
||||
OUTPUT_STR (lsp, buf);
|
||||
@ -128,7 +134,9 @@ static int __print (ase_lsp_t* lsp, const ase_lsp_obj_t* obj, ase_bool_t prt_con
|
||||
break;
|
||||
|
||||
default:
|
||||
lsp->prmfns.misc.sprintf (buf, ASE_COUNTOF(buf),
|
||||
lsp->prmfns.misc.sprintf (
|
||||
lsp->prmfns.misc.custom_data,
|
||||
buf, ASE_COUNTOF(buf),
|
||||
ASE_T("unknown object type: %d"), ASE_LSP_TYPE(obj));
|
||||
OUTPUT_STR (lsp, buf);
|
||||
}
|
||||
|
34
ase/macros.h
34
ase/macros.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: macros.h,v 1.53 2007-02-23 15:18:35 bacon Exp $
|
||||
* $Id: macros.h,v 1.54 2007-02-24 14:32:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -96,22 +96,22 @@
|
||||
#define ASE_END_PACKED_STRUCT() };
|
||||
#endif
|
||||
|
||||
#define ASE_MALLOC(mmgr,size) (mmgr)->malloc (mmgr, size)
|
||||
#define ASE_REALLOC(mmgr,ptr,size) (mmgr)->realloc (mmgr, ptr, size)
|
||||
#define ASE_FREE(mmgr,ptr) (mmgr)->free (mmgr, ptr)
|
||||
#define ASE_MALLOC(mmgr,size) (mmgr)->malloc((mmgr)->custom_data, size)
|
||||
#define ASE_REALLOC(mmgr,ptr,size) (mmgr)->realloc((mmgr)->custom_data, ptr, size)
|
||||
#define ASE_FREE(mmgr,ptr) (mmgr)->free((mmgr)->custom_data, ptr)
|
||||
|
||||
#define ASE_ISUPPER(ccls,c) (ccls)->is_upper (ccls, c)
|
||||
#define ASE_ISLOWER(ccls,c) (ccls)->is_lower (ccls, c)
|
||||
#define ASE_ISALPHA(ccls,c) (ccls)->is_alpha (ccls, c)
|
||||
#define ASE_ISDIGIT(ccls,c) (ccls)->is_digit (ccls, c)
|
||||
#define ASE_ISXDIGIT(ccls,c) (ccls)->is_xdigit (ccls, c)
|
||||
#define ASE_ISALNUM(ccls,c) (ccls)->is_alnum (ccls, c)
|
||||
#define ASE_ISSPACE(ccls,c) (ccls)->is_space (ccls, c)
|
||||
#define ASE_ISPRINT(ccls,c) (ccls)->is_print (ccls, c)
|
||||
#define ASE_ISGRAPH(ccls,c) (ccls)->is_graph (ccls, c)
|
||||
#define ASE_ISCNTRL(ccls,c) (ccls)->is_cntrl (ccls, c)
|
||||
#define ASE_ISPUNCT(ccls,c) (ccls)->is_punct (ccls, c)
|
||||
#define ASE_TOUPPER(ccls,c) (ccls)->to_upper (ccls, c)
|
||||
#define ASE_TOLOWER(ccls,c) (ccls)->to_lower (ccls, c)
|
||||
#define ASE_ISUPPER(ccls,c) (ccls)->is_upper((ccls)->custom_data,c)
|
||||
#define ASE_ISLOWER(ccls,c) (ccls)->is_lower((ccls)->custom_data,c)
|
||||
#define ASE_ISALPHA(ccls,c) (ccls)->is_alpha((ccls)->custom_data,c)
|
||||
#define ASE_ISDIGIT(ccls,c) (ccls)->is_digit((ccls)->custom_data,c)
|
||||
#define ASE_ISXDIGIT(ccls,c) (ccls)->is_xdigit((ccls)->custom_data,c)
|
||||
#define ASE_ISALNUM(ccls,c) (ccls)->is_alnum((ccls)->custom_data,c)
|
||||
#define ASE_ISSPACE(ccls,c) (ccls)->is_space((ccls)->custom_data,c)
|
||||
#define ASE_ISPRINT(ccls,c) (ccls)->is_print((ccls)->custom_data,c)
|
||||
#define ASE_ISGRAPH(ccls,c) (ccls)->is_graph((ccls)->custom_data,c)
|
||||
#define ASE_ISCNTRL(ccls,c) (ccls)->is_cntrl((ccls)->custom_data,c)
|
||||
#define ASE_ISPUNCT(ccls,c) (ccls)->is_punct((ccls)->custom_data,c)
|
||||
#define ASE_TOUPPER(ccls,c) (ccls)->to_upper((ccls)->custom_data,c)
|
||||
#define ASE_TOLOWER(ccls,c) (ccls)->to_lower((ccls)->custom_data,c)
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.177 2007-02-23 08:54:03 bacon Exp $
|
||||
* $Id: awk.c,v 1.178 2007-02-24 14:32:44 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -22,11 +22,9 @@
|
||||
#pragma warning (disable: 4996)
|
||||
#pragma warning (disable: 4296)
|
||||
#elif defined(ASE_CHAR_IS_MCHAR)
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#else
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
@ -52,17 +50,97 @@ struct awk_src_io
|
||||
#include <ase/utl/main.c>
|
||||
#endif
|
||||
|
||||
static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
static ase_bool_t custom_awk_isupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isupper (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_islower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_islower (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isalpha (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalpha (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isdigit (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isxdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isxdigit (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isalnum (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalnum (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isspace (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isspace (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isprint (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isprint (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_isgraph (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isgraph (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_iscntrl (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_iscntrl (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_awk_ispunct (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_ispunct (c);
|
||||
}
|
||||
|
||||
static ase_cint_t custom_awk_toupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_toupper (c);
|
||||
}
|
||||
|
||||
static ase_cint_t custom_awk_tolower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_tolower (c);
|
||||
}
|
||||
|
||||
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static void awk_abort (void* custom_data)
|
||||
static void custom_awk_abort (void* custom)
|
||||
{
|
||||
abort ();
|
||||
|
||||
}
|
||||
|
||||
static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
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;
|
||||
}
|
||||
|
||||
static void custom_awk_aprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef _WIN32
|
||||
@ -88,7 +166,15 @@ static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void awk_dprintf (const ase_char_t* fmt, ...)
|
||||
static void custom_awk_dprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
ase_vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void dprintf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -167,7 +253,7 @@ static ase_ssize_t awk_extio_pipe (
|
||||
mode = ASE_T("w");
|
||||
else return -1; /* TODO: any way to set the error number? */
|
||||
|
||||
awk_dprintf (ASE_T("opening %s of type %d (pipe)\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("opening %s of type %d (pipe)\n"), epa->name, epa->type);
|
||||
handle = ase_popen (epa->name, mode);
|
||||
if (handle == NULL) return -1;
|
||||
epa->handle = (void*)handle;
|
||||
@ -176,7 +262,7 @@ static ase_ssize_t awk_extio_pipe (
|
||||
|
||||
case ASE_AWK_IO_CLOSE:
|
||||
{
|
||||
awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type);
|
||||
fclose ((FILE*)epa->handle);
|
||||
epa->handle = NULL;
|
||||
return 0;
|
||||
@ -245,7 +331,7 @@ static ase_ssize_t awk_extio_file (
|
||||
mode = ASE_T("a");
|
||||
else return -1; /* TODO: any way to set the error number? */
|
||||
|
||||
awk_dprintf (ASE_T("opening %s of type %d (file)\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("opening %s of type %d (file)\n"), epa->name, epa->type);
|
||||
handle = ase_fopen (epa->name, mode);
|
||||
if (handle == NULL) return -1;
|
||||
|
||||
@ -255,7 +341,7 @@ static ase_ssize_t awk_extio_file (
|
||||
|
||||
case ASE_AWK_IO_CLOSE:
|
||||
{
|
||||
awk_dprintf (ASE_T("closing %s of type %d (file)\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("closing %s of type %d (file)\n"), epa->name, epa->type);
|
||||
fclose ((FILE*)epa->handle);
|
||||
epa->handle = NULL;
|
||||
return 0;
|
||||
@ -364,7 +450,7 @@ static ase_ssize_t awk_extio_console (
|
||||
FILE* fp = ase_fopen (infiles[infile_no], ASE_T("r"));
|
||||
if (fp == ASE_NULL)
|
||||
{
|
||||
awk_dprintf (ASE_T("failed to open the next console of type %x - fopen failure\n"), epa->type);
|
||||
dprintf (ASE_T("failed to open the next console of type %x - fopen failure\n"), epa->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -376,7 +462,7 @@ static ase_ssize_t awk_extio_console (
|
||||
fclose ((FILE*)epa->handle);
|
||||
}
|
||||
|
||||
awk_dprintf (ASE_T("open the next console [%s]\n"), infiles[infile_no]);
|
||||
dprintf (ASE_T("open the next console [%s]\n"), infiles[infile_no]);
|
||||
epa->handle = fp;
|
||||
}
|
||||
|
||||
@ -410,20 +496,20 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
{
|
||||
/* TODO: OpenConsole in GUI APPLICATION */
|
||||
|
||||
awk_dprintf (ASE_T("opening console[%s] of type %x\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("opening console[%s] of type %x\n"), epa->name, epa->type);
|
||||
|
||||
if (epa->mode == ASE_AWK_EXTIO_CONSOLE_READ)
|
||||
{
|
||||
if (infiles[infile_no] == ASE_NULL)
|
||||
{
|
||||
/* no more input file */
|
||||
awk_dprintf (ASE_T("console - no more file\n"));;
|
||||
dprintf (ASE_T("console - no more file\n"));;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infiles[infile_no][0] == ASE_T('\0'))
|
||||
{
|
||||
awk_dprintf (ASE_T(" console(r) - <standard input>\n"));
|
||||
dprintf (ASE_T(" console(r) - <standard input>\n"));
|
||||
epa->handle = stdin;
|
||||
}
|
||||
else
|
||||
@ -433,11 +519,11 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
FILE* fp = ase_fopen (infiles[infile_no], ASE_T("r"));
|
||||
if (fp == ASE_NULL)
|
||||
{
|
||||
awk_dprintf (ASE_T("cannot open console of type %x - fopen failure\n"), epa->type);
|
||||
dprintf (ASE_T("cannot open console of type %x - fopen failure\n"), epa->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
awk_dprintf (ASE_T(" console(r) - %s\n"), infiles[infile_no]);
|
||||
dprintf (ASE_T(" console(r) - %s\n"), infiles[infile_no]);
|
||||
if (ase_awk_setfilename (
|
||||
epa->run, infiles[infile_no],
|
||||
ase_strlen(infiles[infile_no])) == -1)
|
||||
@ -454,7 +540,7 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
}
|
||||
else if (epa->mode == ASE_AWK_EXTIO_CONSOLE_WRITE)
|
||||
{
|
||||
awk_dprintf (ASE_T(" console(w) - <standard output>\n"));
|
||||
dprintf (ASE_T(" console(w) - <standard output>\n"));
|
||||
/* TODO: does output console has a name??? */
|
||||
/*ase_awk_setconsolename (ASE_T(""));*/
|
||||
epa->handle = stdout;
|
||||
@ -466,7 +552,7 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
|
||||
static int close_extio_console (ase_awk_extio_t* epa)
|
||||
{
|
||||
awk_dprintf (ASE_T("closing console of type %x\n"), epa->type);
|
||||
dprintf (ASE_T("closing console of type %x\n"), epa->type);
|
||||
|
||||
if (epa->handle != ASE_NULL &&
|
||||
epa->handle != stdin &&
|
||||
@ -485,7 +571,7 @@ static int next_extio_console (ase_awk_extio_t* epa)
|
||||
int n;
|
||||
FILE* fp = (FILE*)epa->handle;
|
||||
|
||||
awk_dprintf (ASE_T("switching console[%s] of type %x\n"), epa->name, epa->type);
|
||||
dprintf (ASE_T("switching console[%s] of type %x\n"), epa->name, epa->type);
|
||||
|
||||
n = open_extio_console(epa);
|
||||
if (n == -1) return -1;
|
||||
@ -529,46 +615,46 @@ static void stop_run (int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void on_run_start (ase_awk_run_t* run, void* custom_data)
|
||||
static void on_run_start (ase_awk_run_t* run, void* custom)
|
||||
{
|
||||
app_run = run;
|
||||
awk_dprintf (ASE_T("[AWK ABOUT TO START]\n"));
|
||||
dprintf (ASE_T("[AWK ABOUT TO START]\n"));
|
||||
}
|
||||
|
||||
static int __printval (ase_awk_pair_t* pair, void* arg)
|
||||
{
|
||||
ase_awk_run_t* run = (ase_awk_run_t*)arg;
|
||||
awk_dprintf (ASE_T("%s = "), (const ase_char_t*)pair->key);
|
||||
dprintf (ASE_T("%s = "), (const ase_char_t*)pair->key);
|
||||
ase_awk_dprintval (run, (ase_awk_val_t*)pair->val);
|
||||
awk_dprintf (ASE_T("\n"));
|
||||
dprintf (ASE_T("\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void on_run_return (
|
||||
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom_data)
|
||||
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom)
|
||||
{
|
||||
app_run = run;
|
||||
|
||||
awk_dprintf (ASE_T("[RETURN] - "));
|
||||
dprintf (ASE_T("[RETURN] - "));
|
||||
ase_awk_dprintval (run, ret);
|
||||
awk_dprintf (ASE_T("\n"));
|
||||
dprintf (ASE_T("\n"));
|
||||
|
||||
awk_dprintf (ASE_T("[NAMED VARIABLES]\n"));
|
||||
dprintf (ASE_T("[NAMED VARIABLES]\n"));
|
||||
ase_awk_map_walk (ase_awk_getrunnamedvarmap(run), __printval, run);
|
||||
awk_dprintf (ASE_T("[END NAMED VARIABLES]\n"));
|
||||
dprintf (ASE_T("[END NAMED VARIABLES]\n"));
|
||||
}
|
||||
|
||||
static void on_run_end (ase_awk_run_t* run, int errnum, void* custom_data)
|
||||
{
|
||||
if (errnum != ASE_AWK_ENOERR)
|
||||
{
|
||||
awk_dprintf (ASE_T("[AWK ENDED WITH AN ERROR] - "));
|
||||
awk_dprintf (ASE_T("CODE [%d] LINE [%u] %s\n"),
|
||||
dprintf (ASE_T("[AWK ENDED WITH AN ERROR] - "));
|
||||
dprintf (ASE_T("CODE [%d] LINE [%u] %s\n"),
|
||||
errnum,
|
||||
(unsigned int)ase_awk_getrunerrlin(run),
|
||||
ase_awk_getrunerrmsg(run));
|
||||
}
|
||||
else awk_dprintf (ASE_T("[AWK ENDED SUCCESSFULLY]\n"));
|
||||
else dprintf (ASE_T("[AWK ENDED SUCCESSFULLY]\n"));
|
||||
|
||||
app_run = NULL;
|
||||
}
|
||||
@ -581,32 +667,32 @@ struct prmfns_data_t
|
||||
};
|
||||
#endif
|
||||
|
||||
static void* awk_malloc (ase_mmgr_t* mmgr, ase_size_t n)
|
||||
static void* custom_awk_malloc (void* custom, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return HeapAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, n);
|
||||
return HeapAlloc (((prmfns_data_t*)custom)->heap, 0, n);
|
||||
#else
|
||||
return malloc (n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* awk_realloc (ase_mmgr_t* mmgr, void* ptr, ase_size_t n)
|
||||
static void* custom_awk_realloc (void* custom, void* ptr, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* HeapReAlloc behaves differently from realloc */
|
||||
if (ptr == NULL)
|
||||
return HeapAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, n);
|
||||
return HeapAlloc (((prmfns_data_t*)custom)->heap, 0, n);
|
||||
else
|
||||
return HeapReAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, ptr, n);
|
||||
return HeapReAlloc (((prmfns_data_t*)custom)->heap, 0, ptr, n);
|
||||
#else
|
||||
return realloc (ptr, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void awk_free (ase_mmgr_t* mmgr, void* ptr)
|
||||
static void custom_awk_free (void* custom, void* ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapFree (((prmfns_data_t*)mmgr->custom_data)->heap, 0, ptr);
|
||||
HeapFree (((prmfns_data_t*)custom)->heap, 0, ptr);
|
||||
#else
|
||||
free (ptr);
|
||||
#endif
|
||||
@ -742,9 +828,9 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
|
||||
memset (&prmfns, 0, ASE_SIZEOF(prmfns));
|
||||
|
||||
prmfns.mmgr.malloc = awk_malloc;
|
||||
prmfns.mmgr.realloc = awk_realloc;
|
||||
prmfns.mmgr.free = awk_free;
|
||||
prmfns.mmgr.malloc = custom_awk_malloc;
|
||||
prmfns.mmgr.realloc = custom_awk_realloc;
|
||||
prmfns.mmgr.free = custom_awk_free;
|
||||
#ifdef _WIN32
|
||||
prmfns_data.heap = HeapCreate (0, 1000000, 1000000);
|
||||
if (prmfns_data.heap == NULL)
|
||||
@ -758,26 +844,26 @@ static int awk_main (int argc, ase_char_t* argv[])
|
||||
prmfns.mmgr.custom_data = NULL;
|
||||
#endif
|
||||
|
||||
prmfns.ccls.is_upper = ase_isupper;
|
||||
prmfns.ccls.is_lower = ase_islower;
|
||||
prmfns.ccls.is_alpha = ase_isalpha;
|
||||
prmfns.ccls.is_digit = ase_isdigit;
|
||||
prmfns.ccls.is_xdigit = ase_isxdigit;
|
||||
prmfns.ccls.is_alnum = ase_isalnum;
|
||||
prmfns.ccls.is_space = ase_isspace;
|
||||
prmfns.ccls.is_print = ase_isprint;
|
||||
prmfns.ccls.is_graph = ase_isgraph;
|
||||
prmfns.ccls.is_cntrl = ase_iscntrl;
|
||||
prmfns.ccls.is_punct = ase_ispunct;
|
||||
prmfns.ccls.to_upper = ase_toupper;
|
||||
prmfns.ccls.to_lower = ase_tolower;
|
||||
prmfns.ccls.is_upper = custom_awk_isupper;
|
||||
prmfns.ccls.is_lower = custom_awk_islower;
|
||||
prmfns.ccls.is_alpha = custom_awk_isalpha;
|
||||
prmfns.ccls.is_digit = custom_awk_isdigit;
|
||||
prmfns.ccls.is_xdigit = custom_awk_isxdigit;
|
||||
prmfns.ccls.is_alnum = custom_awk_isalnum;
|
||||
prmfns.ccls.is_space = custom_awk_isspace;
|
||||
prmfns.ccls.is_print = custom_awk_isprint;
|
||||
prmfns.ccls.is_graph = custom_awk_isgraph;
|
||||
prmfns.ccls.is_cntrl = custom_awk_iscntrl;
|
||||
prmfns.ccls.is_punct = custom_awk_ispunct;
|
||||
prmfns.ccls.to_upper = custom_awk_toupper;
|
||||
prmfns.ccls.to_lower = custom_awk_tolower;
|
||||
prmfns.ccls.custom_data = NULL;
|
||||
|
||||
prmfns.misc.pow = awk_pow;
|
||||
prmfns.misc.sprintf = ase_sprintf;
|
||||
prmfns.misc.aprintf = awk_aprintf;
|
||||
prmfns.misc.dprintf = awk_dprintf;
|
||||
prmfns.misc.abort = awk_abort;
|
||||
prmfns.misc.pow = custom_awk_pow;
|
||||
prmfns.misc.abort = custom_awk_abort;
|
||||
prmfns.misc.sprintf = custom_awk_sprintf;
|
||||
prmfns.misc.aprintf = custom_awk_aprintf;
|
||||
prmfns.misc.dprintf = custom_awk_dprintf;
|
||||
prmfns.misc.lock = NULL;
|
||||
prmfns.misc.unlock = NULL;
|
||||
prmfns.misc.custom_data = NULL;
|
||||
|
@ -3,8 +3,8 @@ OBJS = $(SRCS:.c=.o)
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O2 -Wall -D_REENTRANT -D_THREAD_SAFE -fPIC -I../../..
|
||||
LDFLAGS = -L../../awk
|
||||
LIBS = -laseawk -lm
|
||||
LDFLAGS = -L../../cmn -L../../awk -L../../utl
|
||||
LIBS = -lasecmn -laseawk -laseutl -lm
|
||||
|
||||
all: aseawk
|
||||
|
||||
|
@ -3,8 +3,9 @@ OBJS = $(SRCS:.c=.o)
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O2 -Wall -D_REENTRANT -D_THREAD_SAFE -I../../..
|
||||
LDFLAGS = -L../../awk
|
||||
LIBS = -laseawk -lm
|
||||
LDFLAGS = -L../../cmn -L../../awk -L../../utl
|
||||
LIBS = -lasecmn -laseawk -laseutl -lm
|
||||
|
||||
|
||||
all: aseawk
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
CC = cl
|
||||
CFLAGS = /nologo /MT /W3 /GR- -I..\..\.. -D_WIN32_WINNT=0x0400
|
||||
LDFLAGS = /libpath:..\..\awk /libpath:..\..\utl
|
||||
LIBS = aseawk.lib aseutl.lib kernel32.lib user32.lib
|
||||
LDFLAGS = /libpath:..\..\cmn /libpath:..\..\awk /libpath:..\..\utl
|
||||
LIBS = asecmn.lib aseawk.lib aseutl.lib kernel32.lib user32.lib
|
||||
|
||||
!if !defined(CPU) || "$(CPU)" == ""
|
||||
CPU = $(PROCESSOR_ARCHITECTURE)
|
||||
|
@ -2,7 +2,7 @@ BEGIN { exit 10; }
|
||||
|
||||
{
|
||||
print $0;
|
||||
//print close ("");
|
||||
#print close ("");
|
||||
}
|
||||
|
||||
END { print "== END OF PROGRAM =="; }
|
||||
|
@ -97,43 +97,123 @@ struct prmfns_data_t
|
||||
};
|
||||
#endif
|
||||
|
||||
static void* lsp_malloc (ase_mmgr_t* mmgr, ase_size_t n)
|
||||
static void* custom_lsp_malloc (void* custom, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return HeapAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, n);
|
||||
return HeapAlloc (((prmfns_data_t*)custom)->heap, 0, n);
|
||||
#else
|
||||
return malloc (n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* lsp_realloc (ase_mmgr_t* mmgr, void* ptr, ase_size_t n)
|
||||
static void* custom_lsp_realloc (void* custom, void* ptr, ase_size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* HeapReAlloc behaves differently from realloc */
|
||||
if (ptr == NULL)
|
||||
return HeapAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, n);
|
||||
return HeapAlloc (((prmfns_data_t*)custom)->heap, 0, n);
|
||||
else
|
||||
return HeapReAlloc (((prmfns_data_t*)mmgr->custom_data)->heap, 0, ptr, n);
|
||||
return HeapReAlloc (((prmfns_data_t*)custom)->heap, 0, ptr, n);
|
||||
#else
|
||||
return realloc (ptr, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lsp_free (ase_mmgr_t* mmgr, void* ptr)
|
||||
static void custom_lsp_free (void* custom, void* ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapFree (((prmfns_data_t*)mmgr->custom_data)->heap, 0, ptr);
|
||||
HeapFree (((prmfns_data_t*)custom)->heap, 0, ptr);
|
||||
#else
|
||||
free (ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lsp_abort (void* custom_data)
|
||||
{
|
||||
abort ();
|
||||
static ase_bool_t custom_lsp_isupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isupper (c);
|
||||
}
|
||||
|
||||
static void lsp_aprintf (const ase_char_t* fmt, ...)
|
||||
static ase_bool_t custom_lsp_islower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_islower (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isalpha (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalpha (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isdigit (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isxdigit (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isxdigit (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isalnum (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isalnum (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isspace (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isspace (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isprint (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isprint (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_isgraph (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_isgraph (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_iscntrl (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_iscntrl (c);
|
||||
}
|
||||
|
||||
static ase_bool_t custom_lsp_ispunct (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_ispunct (c);
|
||||
}
|
||||
|
||||
static ase_cint_t custom_lsp_toupper (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_toupper (c);
|
||||
}
|
||||
|
||||
static ase_cint_t custom_lsp_tolower (void* custom, ase_cint_t c)
|
||||
{
|
||||
return ase_tolower (c);
|
||||
}
|
||||
|
||||
static void custom_lsp_abort (void* custom)
|
||||
{
|
||||
abort ();
|
||||
|
||||
}
|
||||
|
||||
static int custom_lsp_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;
|
||||
}
|
||||
|
||||
static void custom_lsp_aprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef _WIN32
|
||||
@ -159,7 +239,7 @@ static void lsp_aprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void lsp_dprintf (const ase_char_t* fmt, ...)
|
||||
static void custom_lsp_dprintf (void* custom, const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -167,6 +247,7 @@ static void lsp_dprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
||||
int lsp_main (int argc, ase_char_t* argv[])
|
||||
{
|
||||
ase_lsp_t* lsp;
|
||||
@ -188,9 +269,9 @@ int lsp_main (int argc, ase_char_t* argv[])
|
||||
|
||||
memset (&prmfns, 0, sizeof(prmfns));
|
||||
|
||||
prmfns.mmgr.malloc = lsp_malloc;
|
||||
prmfns.mmgr.realloc = lsp_realloc;
|
||||
prmfns.mmgr.free = lsp_free;
|
||||
prmfns.mmgr.malloc = custom_lsp_malloc;
|
||||
prmfns.mmgr.realloc = custom_lsp_realloc;
|
||||
prmfns.mmgr.free = custom_lsp_free;
|
||||
#ifdef _WIN32
|
||||
prmfns_data.heap = HeapCreate (0, 1000000, 1000000);
|
||||
if (prmfns_data.heap == NULL)
|
||||
@ -204,25 +285,26 @@ int lsp_main (int argc, ase_char_t* argv[])
|
||||
prmfns.mmgr.custom_data = ASE_NULL;
|
||||
#endif
|
||||
|
||||
prmfns.ccls.is_upper = ase_isupper;
|
||||
prmfns.ccls.is_lower = ase_islower;
|
||||
prmfns.ccls.is_alpha = ase_isalpha;
|
||||
prmfns.ccls.is_digit = ase_isdigit;
|
||||
prmfns.ccls.is_xdigit = ase_isxdigit;
|
||||
prmfns.ccls.is_alnum = ase_isalnum;
|
||||
prmfns.ccls.is_space = ase_isspace;
|
||||
prmfns.ccls.is_print = ase_isprint;
|
||||
prmfns.ccls.is_graph = ase_isgraph;
|
||||
prmfns.ccls.is_cntrl = ase_iscntrl;
|
||||
prmfns.ccls.is_punct = ase_ispunct;
|
||||
prmfns.ccls.to_upper = ase_toupper;
|
||||
prmfns.ccls.to_lower = ase_tolower;
|
||||
prmfns.ccls.is_upper = custom_lsp_isupper;
|
||||
prmfns.ccls.is_lower = custom_lsp_islower;
|
||||
prmfns.ccls.is_alpha = custom_lsp_isalpha;
|
||||
prmfns.ccls.is_digit = custom_lsp_isdigit;
|
||||
prmfns.ccls.is_xdigit = custom_lsp_isxdigit;
|
||||
prmfns.ccls.is_alnum = custom_lsp_isalnum;
|
||||
prmfns.ccls.is_space = custom_lsp_isspace;
|
||||
prmfns.ccls.is_print = custom_lsp_isprint;
|
||||
prmfns.ccls.is_graph = custom_lsp_isgraph;
|
||||
prmfns.ccls.is_cntrl = custom_lsp_iscntrl;
|
||||
prmfns.ccls.is_punct = custom_lsp_ispunct;
|
||||
prmfns.ccls.to_upper = custom_lsp_toupper;
|
||||
prmfns.ccls.to_lower = custom_lsp_tolower;
|
||||
prmfns.ccls.custom_data = ASE_NULL;
|
||||
|
||||
prmfns.misc.sprintf = ase_sprintf;
|
||||
prmfns.misc.aprintf = lsp_aprintf;
|
||||
prmfns.misc.dprintf = lsp_dprintf;
|
||||
prmfns.misc.abort = lsp_abort;
|
||||
prmfns.misc.sprintf = custom_lsp_sprintf;
|
||||
prmfns.misc.aprintf = custom_lsp_aprintf;
|
||||
prmfns.misc.dprintf = custom_lsp_dprintf;
|
||||
prmfns.misc.abort = custom_lsp_abort;
|
||||
prmfns.misc.custom_data = ASE_NULL;
|
||||
|
||||
lsp = ase_lsp_open (&prmfns, mem, inc);
|
||||
if (lsp == ASE_NULL)
|
||||
|
@ -1,8 +1,8 @@
|
||||
CC = bcc32
|
||||
LD = ilink32
|
||||
CFLAGS = -I..\..\..
|
||||
LDFLAGS = -L..\..\lsp -L..\..\utl
|
||||
LIBS = import32.lib cw32mt.lib aselsp.lib aseutl.lib
|
||||
LDFLAGS = -L..\..\cmn -L..\..\lsp -L..\..\utl
|
||||
LIBS = import32.lib cw32mt.lib asecmn.lib aselsp.lib aseutl.lib
|
||||
STARTUP = c0x32w.obj
|
||||
|
||||
all: aselsp
|
||||
|
@ -1,7 +1,7 @@
|
||||
CC = cl
|
||||
CFLAGS = /nologo /MT /GX /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\..
|
||||
LDFLAGS = /libpath:..\..\lsp /libpath:..\..\utl
|
||||
LIBS = aselsp.lib aseutl.lib user32.lib
|
||||
LDFLAGS = /libpath:..\..\cmn /libpath:..\..\lsp /libpath:..\..\utl
|
||||
LIBS = asecmn.lib aselsp.lib aseutl.lib user32.lib
|
||||
|
||||
all: aselsp
|
||||
|
||||
|
12
ase/types.h
12
ase/types.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h,v 1.73 2007-02-23 08:22:35 bacon Exp $
|
||||
* $Id: types.h,v 1.74 2007-02-24 14:32:44 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -233,12 +233,12 @@ typedef int ase_mcint_t;
|
||||
typedef struct ase_mmgr_t ase_mmgr_t;
|
||||
typedef struct ase_ccls_t ase_ccls_t;
|
||||
|
||||
typedef void* (*ase_malloc_t) (ase_mmgr_t* mmgr, ase_size_t n);
|
||||
typedef void* (*ase_realloc_t) (ase_mmgr_t* mmgr, void* ptr, ase_size_t n);
|
||||
typedef void (*ase_free_t) (ase_mmgr_t* mmgr, void* ptr);
|
||||
typedef void* (*ase_malloc_t) (void* custom, ase_size_t n);
|
||||
typedef void* (*ase_realloc_t) (void* custom, void* ptr, ase_size_t n);
|
||||
typedef void (*ase_free_t) (void* custom, void* ptr);
|
||||
|
||||
typedef ase_bool_t (*ase_isccls_t) (ase_ccls_t* ccls, ase_cint_t c);
|
||||
typedef ase_cint_t (*ase_toccls_t) (ase_ccls_t* ccls, ase_cint_t c);
|
||||
typedef ase_bool_t (*ase_isccls_t) (void* custom, ase_cint_t c);
|
||||
typedef ase_cint_t (*ase_toccls_t) (void* custom, ase_cint_t c);
|
||||
|
||||
struct ase_mmgr_t
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ctype.c,v 1.2 2007-02-23 08:17:51 bacon Exp $
|
||||
* $Id: ctype.c,v 1.3 2007-02-24 14:32:44 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/utl/ctype.h>
|
||||
@ -8,136 +8,137 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isupper (ase_cint_t c)
|
||||
{
|
||||
return isupper (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c)
|
||||
{
|
||||
ase_bool_t ase_islower (ase_cint_t c)
|
||||
{
|
||||
return islower (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isalpha (ase_cint_t c)
|
||||
{
|
||||
return isalpha (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isdigit (ase_cint_t c)
|
||||
{
|
||||
return isdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isxdigit (ase_cint_t c)
|
||||
{
|
||||
return isxdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isalnum (ase_cint_t c)
|
||||
{
|
||||
return isalnum (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isspace (ase_cint_t c)
|
||||
{
|
||||
return isspace (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isprint (ase_cint_t c)
|
||||
{
|
||||
return isprint (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isgraph (ase_cint_t c)
|
||||
{
|
||||
return isgraph (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_iscntrl (ase_cint_t c)
|
||||
{
|
||||
return iscntrl (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_ispunct (ase_cint_t c)
|
||||
{
|
||||
return ispunct (c);
|
||||
}
|
||||
|
||||
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_cint_t ase_toupper (ase_cint_t c)
|
||||
{
|
||||
return toupper (c);
|
||||
}
|
||||
|
||||
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_cint_t ase_tolower (ase_cint_t c)
|
||||
{
|
||||
return tolower (c);
|
||||
}
|
||||
|
||||
#elif defined(ASE_CHAR_IS_WCHAR)
|
||||
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
|
||||
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isupper (ase_cint_t c)
|
||||
{
|
||||
return iswupper (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_islower (ase_cint_t c)
|
||||
{
|
||||
return iswlower (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isalpha (ase_cint_t c)
|
||||
{
|
||||
return iswalpha (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isdigit (ase_cint_t c)
|
||||
{
|
||||
return iswdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isxdigit (ase_cint_t c)
|
||||
{
|
||||
return iswxdigit (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isalnum (ase_cint_t c)
|
||||
{
|
||||
return iswalnum (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isspace (ase_cint_t c)
|
||||
{
|
||||
return iswspace (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isprint (ase_cint_t c)
|
||||
{
|
||||
return iswprint (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_isgraph (ase_cint_t c)
|
||||
{
|
||||
return iswgraph (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_iscntrl (ase_cint_t c)
|
||||
{
|
||||
return iswcntrl (c);
|
||||
}
|
||||
|
||||
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_bool_t ase_ispunct (ase_cint_t c)
|
||||
{
|
||||
return iswpunct (c);
|
||||
}
|
||||
|
||||
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_cint_t ase_toupper (ase_cint_t c)
|
||||
{
|
||||
return towupper (c);
|
||||
}
|
||||
|
||||
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c)
|
||||
ase_cint_t ase_tolower (ase_cint_t c)
|
||||
{
|
||||
return towlower (c);
|
||||
}
|
||||
|
@ -12,20 +12,20 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_bool_t ase_isupper (ase_cint_t c);
|
||||
ase_bool_t ase_islower (ase_cint_t c);
|
||||
ase_bool_t ase_isalpha (ase_cint_t c);
|
||||
ase_bool_t ase_isdigit (ase_cint_t c);
|
||||
ase_bool_t ase_isxdigit (ase_cint_t c);
|
||||
ase_bool_t ase_isalnum (ase_cint_t c);
|
||||
ase_bool_t ase_isspace (ase_cint_t c);
|
||||
ase_bool_t ase_isprint (ase_cint_t c);
|
||||
ase_bool_t ase_isgraph (ase_cint_t c);
|
||||
ase_bool_t ase_iscntrl (ase_cint_t c);
|
||||
ase_bool_t ase_ispunct (ase_cint_t c);
|
||||
|
||||
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c);
|
||||
ase_cint_t ase_toupper (ase_cint_t c);
|
||||
ase_cint_t ase_tolower (ase_cint_t c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user