*** empty log message ***
This commit is contained in:
parent
4818807837
commit
38d2b2348a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.99 2006-12-15 14:58:14 bacon Exp $
|
||||
* $Id: awk.c,v 1.100 2006-12-16 14:43:49 bacon Exp $
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
@ -116,7 +116,6 @@ ase_awk_t* ase_awk_open (const ase_awk_sysfns_t* sysfns, int* errnum)
|
||||
awk->errnum = ASE_AWK_ENOERR;
|
||||
|
||||
awk->parse.nlocals_max = 0;
|
||||
awk->parse.nl_semicolon = 0;
|
||||
|
||||
awk->tree.nglobals = 0;
|
||||
awk->tree.nbglobals = 0;
|
||||
@ -126,7 +125,9 @@ ase_awk_t* ase_awk_open (const ase_awk_sysfns_t* sysfns, int* errnum)
|
||||
awk->tree.chain_tail = ASE_NULL;
|
||||
awk->tree.chain_size = 0;
|
||||
|
||||
awk->token.prev = 0;
|
||||
awk->token.prev.type = 0;
|
||||
awk->token.prev.line = 0;
|
||||
awk->token.prev.column = 0;
|
||||
awk->token.type = 0;
|
||||
awk->token.line = 0;
|
||||
awk->token.column = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.166 2006-12-15 14:58:14 bacon Exp $
|
||||
* $Id: awk.h,v 1.167 2006-12-16 14:43:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
@ -126,9 +126,9 @@ struct ase_awk_runios_t
|
||||
struct ase_awk_runcbs_t
|
||||
{
|
||||
void (*on_start) (
|
||||
ase_awk_t* awk, void* handle, void* custom_data);
|
||||
ase_awk_t* awk, ase_awk_run_t* run, void* custom_data);
|
||||
void (*on_end) (
|
||||
ase_awk_t* awk, void* handle, int errnum, void* custom_data);
|
||||
ase_awk_t* awk, ase_awk_run_t* run, int errnum, void* custom_data);
|
||||
void* custom_data;
|
||||
};
|
||||
|
||||
@ -439,8 +439,12 @@ int ase_awk_setofilename (
|
||||
|
||||
ase_awk_t* ase_awk_getrunawk (ase_awk_run_t* awk);
|
||||
void* ase_awk_getruncustomdata (ase_awk_run_t* awk);
|
||||
|
||||
/* functions to manipulate the run-time error */
|
||||
int ase_awk_getrunerrnum (ase_awk_run_t* run);
|
||||
const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run);
|
||||
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum);
|
||||
void ase_awk_setrunerrmsg (ase_awk_run_t* run, const ase_char_t* msg);
|
||||
|
||||
/* functions to manipulate built-in functions */
|
||||
void* ase_awk_addbfn (
|
||||
@ -485,7 +489,10 @@ ase_char_t* ase_awk_strxdup2 (
|
||||
|
||||
ase_size_t ase_awk_strlen (const ase_char_t* str);
|
||||
ase_size_t ase_awk_strcpy (ase_char_t* buf, const ase_char_t* str);
|
||||
ase_size_t ase_awk_strncpy (ase_char_t* buf, const ase_char_t* str, ase_size_t len);
|
||||
ase_size_t ase_awk_strxcpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str);
|
||||
ase_size_t ase_awk_strncpy (
|
||||
ase_char_t* buf, const ase_char_t* str, ase_size_t len);
|
||||
int ase_awk_strcmp (const ase_char_t* s1, const ase_char_t* s2);
|
||||
|
||||
int ase_awk_strxncmp (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_i.h,v 1.90 2006-12-13 14:13:07 bacon Exp $
|
||||
* $Id: awk_i.h,v 1.91 2006-12-16 14:43:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWKI_H_
|
||||
@ -135,8 +135,6 @@ struct ase_awk_t
|
||||
ase_awk_tab_t params;
|
||||
ase_size_t nlocals_max;
|
||||
|
||||
int nl_semicolon;
|
||||
|
||||
ase_awk_nde_t* (*parse_block) (ase_awk_t*,ase_bool_t);
|
||||
} parse;
|
||||
|
||||
@ -166,7 +164,13 @@ struct ase_awk_t
|
||||
/* token */
|
||||
struct
|
||||
{
|
||||
int prev;
|
||||
struct
|
||||
{
|
||||
int type;
|
||||
ase_size_t line;
|
||||
ase_size_t column;
|
||||
} prev;
|
||||
|
||||
int type;
|
||||
ase_awk_str_t name;
|
||||
ase_size_t line;
|
||||
@ -325,6 +329,8 @@ struct ase_awk_run_t
|
||||
} depth;
|
||||
|
||||
int errnum;
|
||||
ase_char_t errmsg[256];
|
||||
|
||||
void* custom_data;
|
||||
ase_awk_t* awk;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: jni.c,v 1.41 2006-12-15 14:58:15 bacon Exp $
|
||||
* $Id: jni.c,v 1.42 2006-12-16 14:43:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -329,8 +329,9 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_parse (JNIEnv* env, jobject obj)
|
||||
except = (*env)->FindClass (env, CLASS_EXCEPTION);
|
||||
if (except == NULL) return;
|
||||
|
||||
n = snprintf (msg, sizeof(msg), "parse error at line %d: %S",
|
||||
ase_awk_getsrcline(awk),
|
||||
n = snprintf (msg, sizeof(msg),
|
||||
"parse error at line %d: %S",
|
||||
ase_awk_getsrcline(awk),
|
||||
ase_awk_geterrstr(ase_awk_geterrnum(awk)));
|
||||
if (n < 0 || n >= sizeof(msg)) msg[sizeof(msg)-1] = '\0';
|
||||
|
||||
|
@ -42,9 +42,6 @@ lib: $(C_OBJS)
|
||||
jni: lib $(JNI_OBJS) $(JAVA_OBJS)
|
||||
$(LD) $(LDFLAGS) $(STARTUP) $(JNI_OBJS),$(OUT).dll,,$(JNI_LIBS),jni.def,
|
||||
|
||||
ada:
|
||||
gnatmake -I.. ase-awk
|
||||
|
||||
clean:
|
||||
-del $(OBJS) $(OUT).lib $(OUT).dll *.obj *.class
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: misc.c,v 1.46 2006-12-13 14:16:12 bacon Exp $
|
||||
* $Id: misc.c,v 1.47 2006-12-16 14:43:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -670,7 +670,25 @@ ase_size_t ase_awk_strcpy (ase_char_t* buf, const ase_char_t* str)
|
||||
return buf - org - 1;
|
||||
}
|
||||
|
||||
ase_size_t ase_awk_strncpy (ase_char_t* buf, const ase_char_t* str, ase_size_t len)
|
||||
ase_size_t ase_awk_strxcpy (
|
||||
ase_char_t* buf, ase_size_t bsz, const ase_char_t* str)
|
||||
{
|
||||
ase_char_t* p, * p2;
|
||||
|
||||
p = buf; p2 = buf + bsz - 1;
|
||||
|
||||
while (p < p2)
|
||||
{
|
||||
if (*str == ASE_T('\0')) break;
|
||||
*p++ = *str++;
|
||||
}
|
||||
|
||||
if (bsz > 0) *p = ASE_T('\0');
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
ase_size_t ase_awk_strncpy (
|
||||
ase_char_t* buf, const ase_char_t* str, ase_size_t len)
|
||||
{
|
||||
const ase_char_t* end = str + len;
|
||||
while (str < end) *buf++ = *str++;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.222 2006-12-15 14:58:15 bacon Exp $
|
||||
* $Id: parse.c,v 1.223 2006-12-16 14:43:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -300,11 +300,15 @@ static struct __bvent __bvtab[] =
|
||||
c = (awk)->src.lex.curc; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
#define SET_TOKEN_TYPE(awk,code) \
|
||||
do { \
|
||||
(awk)->token.prev = (awk)->token.type; \
|
||||
(awk)->token.prev.type = (awk)->token.type; \
|
||||
(awk)->token.type = (code); \
|
||||
} while (0);
|
||||
} while (0)
|
||||
*/
|
||||
#define SET_TOKEN_TYPE(awk,code) \
|
||||
do { (awk)->token.type = (code); } while (0)
|
||||
|
||||
#define ADD_TOKEN_CHAR(awk,c) \
|
||||
do { \
|
||||
@ -890,7 +894,8 @@ static ase_awk_chain_t* __parse_pattern_block (
|
||||
if (nde == ASE_NULL) return ASE_NULL;
|
||||
}
|
||||
|
||||
chain = (ase_awk_chain_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_chain_t));
|
||||
chain = (ase_awk_chain_t*)
|
||||
ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_chain_t));
|
||||
if (chain == ASE_NULL)
|
||||
{
|
||||
ase_awk_clrpt (awk, nde);
|
||||
@ -998,7 +1003,8 @@ static ase_awk_nde_t* __parse_block (ase_awk_t* awk, ase_bool_t is_top)
|
||||
curr = nde;
|
||||
}
|
||||
|
||||
block = (ase_awk_nde_blk_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_blk_t));
|
||||
block = (ase_awk_nde_blk_t*)
|
||||
ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_nde_blk_t));
|
||||
if (block == ASE_NULL)
|
||||
{
|
||||
ase_awk_tab_remove (
|
||||
@ -1018,6 +1024,7 @@ static ase_awk_nde_t* __parse_block (ase_awk_t* awk, ase_bool_t is_top)
|
||||
/* if (head == ASE_NULL) tmp = 0; */
|
||||
|
||||
block->type = ASE_AWK_NDE_BLK;
|
||||
//block->line =
|
||||
block->next = ASE_NULL;
|
||||
block->body = head;
|
||||
|
||||
@ -1252,11 +1259,22 @@ static ase_awk_nde_t* __parse_statement (ase_awk_t* awk)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* the statement id held in awk->parse.id.stmnt denotes
|
||||
* the token id of the statement currently being parsed.
|
||||
* the current statement id is saved here because the
|
||||
* statement id can be changed in __parse_statement_nb.
|
||||
* it will, in turn, call __parse_statement which will
|
||||
* eventually change the statement id. */
|
||||
int old_id = awk->parse.id.stmnt;
|
||||
|
||||
/* set the current statement id */
|
||||
awk->parse.id.stmnt = awk->token.type;
|
||||
|
||||
/* proceed parsing the statement */
|
||||
nde = __parse_statement_nb (awk);
|
||||
|
||||
/* restore the statement id saved previously */
|
||||
awk->parse.id.stmnt = old_id;
|
||||
awk->parse.nl_semicolon = 0;
|
||||
}
|
||||
|
||||
return nde;
|
||||
@ -1293,7 +1311,6 @@ static ase_awk_nde_t* __parse_statement_nb (ase_awk_t* awk)
|
||||
return nde;
|
||||
}
|
||||
|
||||
awk->parse.nl_semicolon = 1;
|
||||
/* keywords that require a terminating semicolon */
|
||||
if (MATCH(awk,TOKEN_DO))
|
||||
{
|
||||
@ -1360,8 +1377,6 @@ awk->parse.nl_semicolon = 1;
|
||||
nde = __parse_expression(awk);
|
||||
}
|
||||
|
||||
/* TODO: newline ... */
|
||||
awk->parse.nl_semicolon = 0;
|
||||
if (nde == ASE_NULL) return ASE_NULL;
|
||||
|
||||
/* check if a statement ends with a semicolon */
|
||||
@ -2191,6 +2206,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
/* the regular expression is tokenized here because
|
||||
* of the context-sensitivity of the slash symbol */
|
||||
SET_TOKEN_TYPE (awk, TOKEN_REX);
|
||||
|
||||
ase_awk_str_clear (&awk->token.name);
|
||||
if (__get_rexstr (awk) == -1) return ASE_NULL;
|
||||
ASE_AWK_ASSERT (awk, MATCH(awk,TOKEN_REX));
|
||||
@ -2203,8 +2219,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
nde->next = ASE_NULL;
|
||||
|
||||
nde->len = ASE_AWK_STR_LEN(&awk->token.name);
|
||||
nde->buf = ase_awk_strxdup (
|
||||
awk,
|
||||
nde->buf = ase_awk_strxdup (awk,
|
||||
ASE_AWK_STR_BUF(&awk->token.name),
|
||||
ASE_AWK_STR_LEN(&awk->token.name));
|
||||
if (nde->buf == ASE_NULL)
|
||||
@ -2213,8 +2228,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk)
|
||||
PANIC (awk, ASE_AWK_ENOMEM);
|
||||
}
|
||||
|
||||
nde->code = ase_awk_buildrex (
|
||||
awk,
|
||||
nde->code = ase_awk_buildrex (awk,
|
||||
ASE_AWK_STR_BUF(&awk->token.name),
|
||||
ASE_AWK_STR_LEN(&awk->token.name),
|
||||
&errnum);
|
||||
@ -3282,8 +3296,8 @@ static ase_awk_nde_t* __parse_print (ase_awk_t* awk, int type)
|
||||
}
|
||||
|
||||
/* print 1 > 2 would print 1 to the file named 2.
|
||||
* print (1 > 2) would print (1 > 2) in the console */
|
||||
if (awk->token.prev != TOKEN_RPAREN &&
|
||||
* print (1 > 2) would print (1 > 2) on the console */
|
||||
if (awk->token.prev.type != TOKEN_RPAREN &&
|
||||
args_tail->type == ASE_AWK_NDE_EXP_BIN)
|
||||
{
|
||||
ase_awk_nde_exp_t* ep = (ase_awk_nde_exp_t*)args_tail;
|
||||
@ -3430,6 +3444,11 @@ static int __get_token (ase_awk_t* awk)
|
||||
int n;
|
||||
|
||||
line = awk->token.line;
|
||||
|
||||
awk->token.prev.type = awk->token.type;
|
||||
awk->token.prev.line = awk->token.line;
|
||||
awk->token.prev.column = awk->token.column;
|
||||
|
||||
do
|
||||
{
|
||||
if (__skip_spaces(awk) == -1) return -1;
|
||||
@ -3840,8 +3859,7 @@ static int __get_token (ase_awk_t* awk)
|
||||
ADD_TOKEN_CHAR (awk, c);
|
||||
GET_CHAR (awk);
|
||||
}
|
||||
else if (c == ASE_T(';') ||
|
||||
(c == ASE_T('\n') && (awk->option & ASE_AWK_NEWLINE)))
|
||||
else if (c == ASE_T(';'))
|
||||
{
|
||||
/* TODO: more check on the newline terminator... */
|
||||
SET_TOKEN_TYPE (awk, TOKEN_SEMICOLON);
|
||||
@ -4206,16 +4224,7 @@ static int __unget_char (ase_awk_t* awk, ase_cint_t c)
|
||||
static int __skip_spaces (ase_awk_t* awk)
|
||||
{
|
||||
ase_cint_t c = awk->src.lex.curc;
|
||||
|
||||
if (awk->option & ASE_AWK_NEWLINE && awk->parse.nl_semicolon)
|
||||
{
|
||||
while (c != ASE_T('\n') &&
|
||||
ASE_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ASE_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
||||
}
|
||||
while (ASE_AWK_ISSPACE (awk, c)) GET_CHAR_TO (awk, c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.300 2006-12-13 14:15:24 bacon Exp $
|
||||
* $Id: run.c,v 1.301 2006-12-16 14:43:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -547,9 +547,23 @@ int ase_awk_getrunerrnum (ase_awk_run_t* run)
|
||||
return run->errnum;
|
||||
}
|
||||
|
||||
const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run)
|
||||
{
|
||||
if (run->errmsg[0] == ASE_T('\0'))
|
||||
return ase_awk_geterrstr (run->errnum);
|
||||
|
||||
return run->errmsg;
|
||||
}
|
||||
|
||||
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
|
||||
{
|
||||
run->errnum = errnum;
|
||||
run->errmsg[0] = ASE_T('\0');
|
||||
}
|
||||
|
||||
void ase_awk_setrunerrmsg (ase_awk_run_t* run, const ase_char_t* msg)
|
||||
{
|
||||
ase_awk_strxcpy (run->errmsg, ASE_COUNTOF(run->errmsg), msg);
|
||||
}
|
||||
|
||||
int ase_awk_run (ase_awk_t* awk,
|
||||
@ -562,65 +576,82 @@ int ase_awk_run (ase_awk_t* awk,
|
||||
ase_awk_run_t* run;
|
||||
int n, errnum;
|
||||
|
||||
/* clear the awk error code */
|
||||
awk->errnum = ASE_AWK_ENOERR;
|
||||
|
||||
/* check if the code has ever been parsed */
|
||||
if (awk->tree.nglobals == 0 &&
|
||||
awk->tree.begin == ASE_NULL &&
|
||||
awk->tree.end == ASE_NULL &&
|
||||
awk->tree.chain_size == 0 &&
|
||||
ase_awk_map_getsize(&awk->tree.afns) == 0)
|
||||
{
|
||||
/* the code has not been parsed. deny the run */
|
||||
/* if not, deny the run */
|
||||
awk->errnum = ASE_AWK_EACCES;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* allocate the storage for the run object */
|
||||
run = (ase_awk_run_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_run_t));
|
||||
if (run == ASE_NULL)
|
||||
{
|
||||
/* if it fails, the failure is reported thru
|
||||
* the awk object */
|
||||
awk->errnum = ASE_AWK_ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* clear the run object space */
|
||||
ASE_AWK_MEMSET (awk, run, 0, ASE_SIZEOF(ase_awk_run_t));
|
||||
|
||||
/* add the run object to the awk object */
|
||||
__add_run (awk, run);
|
||||
|
||||
/* initialize the run object */
|
||||
if (__init_run (run, awk, runios, custom_data, &errnum) == -1)
|
||||
{
|
||||
/* if it fails, the failure is still reported thru
|
||||
* the awk object */
|
||||
awk->errnum = errnum;
|
||||
__del_run (awk, run);
|
||||
|
||||
ASE_AWK_FREE (awk, run);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (runcbs != ASE_NULL && runcbs->on_start != ASE_NULL)
|
||||
{
|
||||
runcbs->on_start (awk, run, runcbs->custom_data);
|
||||
}
|
||||
/* clear the run error code */
|
||||
run->errnum = ASE_AWK_ENOERR;
|
||||
|
||||
/* execute the start callback if it exists */
|
||||
if (runcbs != ASE_NULL && runcbs->on_start != ASE_NULL)
|
||||
runcbs->on_start (awk, run, runcbs->custom_data);
|
||||
|
||||
/* enter the main run loop */
|
||||
n = __run_main (run, main, runarg);
|
||||
if (n == -1)
|
||||
{
|
||||
/* if no callback is specified, awk's error number
|
||||
* is updated with the run's error number */
|
||||
awk->errnum = (runcbs == ASE_NULL)? run->errnum: ASE_AWK_ERUNTIME;
|
||||
awk->errnum = (runcbs == ASE_NULL)?
|
||||
run->errnum: ASE_AWK_ERUNTIME;
|
||||
}
|
||||
|
||||
/* the run loop ended. execute the end callback if it exists */
|
||||
if (runcbs != ASE_NULL && runcbs->on_end != ASE_NULL)
|
||||
{
|
||||
runcbs->on_end (awk, run,
|
||||
((n == -1)? run->errnum: ASE_AWK_ENOERR),
|
||||
runcbs->custom_data);
|
||||
|
||||
/* when using callbacks, the function always returns 0 after
|
||||
* the start callbacks has been triggered */
|
||||
/* when using callbacks, this function always returns 0
|
||||
* after the start callbacks has been triggered */
|
||||
n = 0;
|
||||
}
|
||||
|
||||
|
||||
/* uninitialize the run object */
|
||||
__deinit_run (run);
|
||||
__del_run (awk, run);
|
||||
|
||||
ASE_AWK_FREE (awk, run);
|
||||
return n;
|
||||
}
|
||||
@ -2441,10 +2472,12 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
(nde->out_type == ASE_AWK_OUT_FILE_APPEND && nde->out != ASE_NULL) ||
|
||||
(nde->out_type == ASE_AWK_OUT_CONSOLE && nde->out == ASE_NULL));
|
||||
|
||||
/* check if destination has been specified. */
|
||||
if (nde->out != ASE_NULL)
|
||||
{
|
||||
ase_size_t len;
|
||||
|
||||
/* if so, resolve the destination name */
|
||||
v = __eval_expression (run, nde->out);
|
||||
if (v == ASE_NULL) return -1;
|
||||
|
||||
@ -2454,42 +2487,42 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
if (out == ASE_NULL)
|
||||
{
|
||||
ase_awk_refdownval (run, v);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
ase_awk_refdownval (run, v);
|
||||
|
||||
if (len <= 0)
|
||||
{
|
||||
/* the output destination name is empty. */
|
||||
/* if the destination name is empty, it skips the
|
||||
* writing and flags an error and ERRNO */
|
||||
ASE_AWK_FREE (run->awk, out);
|
||||
n = -1;
|
||||
ase_awk_setglobal (run, ASE_AWK_GLOBAL_ERRNO, ase_awk_val_negone);
|
||||
goto skip_write;
|
||||
}
|
||||
|
||||
/* it needs to check if the destination name contains
|
||||
* any invalid characters to the underlying system */
|
||||
while (len > 0)
|
||||
{
|
||||
if (out[--len] == ASE_T('\0'))
|
||||
{
|
||||
/* the output destination name contains a null
|
||||
* character. */
|
||||
/* if so, the error is flagged thru ERRNO */
|
||||
ASE_AWK_FREE (run->awk, out);
|
||||
n = -1;
|
||||
ase_awk_setglobal (run, ASE_AWK_GLOBAL_ERRNO, ase_awk_val_negone);
|
||||
goto skip_write;
|
||||
/* TODO: how to handle error???
|
||||
* make print return -1??? not possible.
|
||||
* throw an exception??
|
||||
* set ERRNO or what??? this seems most
|
||||
* reasonable. or can it have a global
|
||||
* flag variable for print/printf such
|
||||
* as PRINT_ERRNO? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* transforms the destination to suit the usage with extio */
|
||||
dst = (out == ASE_NULL)? ASE_T(""): out;
|
||||
|
||||
/* check if print is followed by any arguments */
|
||||
if (nde->args == ASE_NULL)
|
||||
{
|
||||
/* if it doesn't have any arguments, print the entire
|
||||
* input record */
|
||||
n = ase_awk_writeextio_str (
|
||||
run, nde->out_type, dst,
|
||||
ASE_AWK_STR_BUF(&run->inrec.line),
|
||||
@ -2497,6 +2530,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
if (n < 0 && run->errnum != ASE_AWK_EIOHANDLER)
|
||||
{
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
/* TODO: how to handle n == -1 && errnum == ASE_AWK_EIOHANDLER.
|
||||
@ -2504,6 +2538,8 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if it has any arguments, print the arguments separated by
|
||||
* the value OFS */
|
||||
ase_awk_nde_t* head, * np;
|
||||
|
||||
if (nde->args->type == ASE_AWK_NDE_GRP)
|
||||
@ -2525,6 +2561,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
if (n < 0 && run->errnum != ASE_AWK_EIOHANDLER)
|
||||
{
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2533,6 +2570,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
if (v == ASE_NULL)
|
||||
{
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
ase_awk_refupval (run, v);
|
||||
@ -2542,6 +2580,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
{
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
ase_awk_refdownval (run, v);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2553,12 +2592,14 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
}
|
||||
}
|
||||
|
||||
/* print the value ORS to terminate the operation */
|
||||
n = ase_awk_writeextio_str (
|
||||
run, nde->out_type, dst,
|
||||
run->global.ors.ptr, run->global.ors.len);
|
||||
if (n < 0 && run->errnum != ASE_AWK_EIOHANDLER)
|
||||
{
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
//ase_awk_setrunerrline (nde->line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2566,6 +2607,7 @@ static int __run_print (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
* that is the user handler returned an error... */
|
||||
|
||||
if (out != ASE_NULL) ASE_AWK_FREE (run->awk, out);
|
||||
ase_awk_setglobal (run, ASE_AWK_GLOBAL_ERRNO, ase_awk_val_zero);
|
||||
|
||||
skip_write:
|
||||
return 0;
|
||||
@ -2607,7 +2649,7 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
{
|
||||
/* the output destination name is empty. */
|
||||
ASE_AWK_FREE (run->awk, out);
|
||||
n = -1;
|
||||
ase_awk_setglobal (run, ASE_AWK_GLOBAL_ERRNO, ase_awk_val_negone);
|
||||
goto skip_write;
|
||||
}
|
||||
|
||||
@ -2618,15 +2660,8 @@ static int __run_printf (ase_awk_run_t* run, ase_awk_nde_print_t* nde)
|
||||
/* the output destination name contains a null
|
||||
* character. */
|
||||
ASE_AWK_FREE (run->awk, out);
|
||||
n = -1;
|
||||
ase_awk_setglobal (run, ASE_AWK_GLOBAL_ERRNO, ase_awk_val_negone);
|
||||
goto skip_write;
|
||||
/* TODO: how to handle error???
|
||||
* make print return -1??? not possible.
|
||||
* throw an exception??
|
||||
* set ERRNO or what??? this seems most
|
||||
* reasonable. or can it have a global
|
||||
* flag variable for print/printf such
|
||||
* as PRINT_ERRNO? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.h,v 1.83 2006-11-28 04:30:22 bacon Exp $
|
||||
* $Id: tree.h,v 1.84 2006-12-16 14:43:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_TREE_H_
|
||||
@ -130,6 +130,7 @@ struct ase_awk_afn_t
|
||||
|
||||
#define ASE_AWK_NDE_HDR \
|
||||
int type; \
|
||||
ase_size_t line; \
|
||||
ase_awk_nde_t* next
|
||||
|
||||
struct ase_awk_nde_t
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.98 2006-12-13 14:16:12 bacon Exp $
|
||||
* $Id: val.c,v 1.99 2006-12-16 14:43:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -38,6 +38,7 @@ static ase_awk_val_int_t __awk_int[] =
|
||||
{ ASE_AWK_VAL_INT, 0, 9, ASE_NULL }
|
||||
};
|
||||
|
||||
ase_awk_val_t* ase_awk_val_negone = (ase_awk_val_t*)&__awk_int[0];
|
||||
ase_awk_val_t* ase_awk_val_zero = (ase_awk_val_t*)&__awk_int[1];
|
||||
ase_awk_val_t* ase_awk_val_one = (ase_awk_val_t*)&__awk_int[2];
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.h,v 1.56 2006-12-04 12:58:24 bacon Exp $
|
||||
* $Id: val.h,v 1.57 2006-12-16 14:43:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_VAL_H_
|
||||
@ -138,6 +138,7 @@ extern "C" {
|
||||
extern ase_awk_val_t* ase_awk_val_nil;
|
||||
extern ase_awk_val_t* ase_awk_val_zls;
|
||||
extern ase_awk_val_t* ase_awk_val_nl;
|
||||
extern ase_awk_val_t* ase_awk_val_negone;
|
||||
extern ase_awk_val_t* ase_awk_val_zero;
|
||||
extern ase_awk_val_t* ase_awk_val_one;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c,v 1.137 2006-12-15 14:58:37 bacon Exp $
|
||||
* $Id: awk.c,v 1.138 2006-12-16 14:45:02 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -78,7 +78,7 @@ static FILE* fopen_t (const ase_char_t* path, const ase_char_t* mode)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int __awk_sprintf (
|
||||
static int awk_sprintf (
|
||||
ase_char_t* buf, ase_size_t len, const ase_char_t* fmt, ...)
|
||||
{
|
||||
int n;
|
||||
@ -102,7 +102,7 @@ static int __awk_sprintf (
|
||||
return n;
|
||||
}
|
||||
|
||||
static void __awk_aprintf (const ase_char_t* fmt, ...)
|
||||
static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef _WIN32
|
||||
@ -130,7 +130,7 @@ static void __awk_aprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void __awk_dprintf (const ase_char_t* fmt, ...)
|
||||
static void awk_dprintf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -146,7 +146,7 @@ static void __awk_dprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static ase_real_t __awk_pow (ase_real_t x, ase_real_t y)
|
||||
static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
@ -272,7 +272,7 @@ static ase_ssize_t process_extio_pipe (
|
||||
else if (epa->mode == ASE_AWK_EXTIO_PIPE_WRITE)
|
||||
mode = ASE_T("w");
|
||||
else return -1; /* TODO: any way to set the error number? */
|
||||
__awk_dprintf (ASE_T("opending %s of type %d (pipe)\n"), epa->name, epa->type);
|
||||
awk_dprintf (ASE_T("opending %s of type %d (pipe)\n"), epa->name, epa->type);
|
||||
handle = popen_t (epa->name, mode);
|
||||
if (handle == NULL) return -1;
|
||||
epa->handle = (void*)handle;
|
||||
@ -281,7 +281,7 @@ static ase_ssize_t process_extio_pipe (
|
||||
|
||||
case ASE_AWK_IO_CLOSE:
|
||||
{
|
||||
__awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type);
|
||||
awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type);
|
||||
fclose ((FILE*)epa->handle);
|
||||
epa->handle = NULL;
|
||||
return 0;
|
||||
@ -340,7 +340,7 @@ static ase_ssize_t process_extio_file (
|
||||
mode = ASE_T("a");
|
||||
else return -1; /* TODO: any way to set the error number? */
|
||||
|
||||
__awk_dprintf (ASE_T("opending %s of type %d (file)\n"), epa->name, epa->type);
|
||||
awk_dprintf (ASE_T("opending %s of type %d (file)\n"), epa->name, epa->type);
|
||||
handle = fopen_t (epa->name, mode);
|
||||
if (handle == NULL) return -1;
|
||||
|
||||
@ -350,7 +350,7 @@ static ase_ssize_t process_extio_file (
|
||||
|
||||
case ASE_AWK_IO_CLOSE:
|
||||
{
|
||||
__awk_dprintf (ASE_T("closing %s of type %d (file)\n"), epa->name, epa->type);
|
||||
awk_dprintf (ASE_T("closing %s of type %d (file)\n"), epa->name, epa->type);
|
||||
fclose ((FILE*)epa->handle);
|
||||
epa->handle = NULL;
|
||||
return 0;
|
||||
@ -455,7 +455,7 @@ static ase_ssize_t process_extio_console (
|
||||
FILE* fp = fopen_t (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);
|
||||
awk_dprintf (ASE_T("failed to open the next console of type %x - fopen failure\n"), epa->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ static ase_ssize_t process_extio_console (
|
||||
epa->handle != stdout &&
|
||||
epa->handle != stderr) fclose (epa->handle);
|
||||
|
||||
__awk_dprintf (ASE_T("open the next console [%s]\n"), infiles[infile_no]);
|
||||
awk_dprintf (ASE_T("open the next console [%s]\n"), infiles[infile_no]);
|
||||
epa->handle = fp;
|
||||
}
|
||||
|
||||
@ -505,20 +505,20 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
/* epa->name is always empty for console */
|
||||
assert (epa->name[0] == ASE_T('\0'));
|
||||
|
||||
__awk_dprintf (ASE_T("opening console[%s] of type %x\n"), epa->name, epa->type);
|
||||
awk_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"));;
|
||||
awk_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"));
|
||||
awk_dprintf (ASE_T(" console(r) - <standard input>\n"));
|
||||
epa->handle = stdin;
|
||||
}
|
||||
else
|
||||
@ -528,11 +528,11 @@ static int open_extio_console (ase_awk_extio_t* epa)
|
||||
FILE* fp = fopen_t (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);
|
||||
awk_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]);
|
||||
awk_dprintf (ASE_T(" console(r) - %s\n"), infiles[infile_no]);
|
||||
if (ase_awk_setfilename (
|
||||
epa->run, infiles[infile_no],
|
||||
ase_awk_strlen(infiles[infile_no])) == -1)
|
||||
@ -549,7 +549,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"));
|
||||
awk_dprintf (ASE_T(" console(w) - <standard output>\n"));
|
||||
/* TODO: does output console has a name??? */
|
||||
/*ase_awk_setconsolename (ASE_T(""));*/
|
||||
epa->handle = stdout;
|
||||
@ -561,7 +561,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);
|
||||
awk_dprintf (ASE_T("closing console of type %x\n"), epa->type);
|
||||
|
||||
if (epa->handle != ASE_NULL &&
|
||||
epa->handle != stdin &&
|
||||
@ -580,7 +580,7 @@ static int next_extio_console (ase_awk_extio_t* epa)
|
||||
int n;
|
||||
FILE* fp = epa->handle;
|
||||
|
||||
__awk_dprintf (ASE_T("switching console[%s] of type %x\n"), epa->name, epa->type);
|
||||
awk_dprintf (ASE_T("switching console[%s] of type %x\n"), epa->name, epa->type);
|
||||
|
||||
n = open_extio_console(epa);
|
||||
if (n == -1) return -1;
|
||||
@ -599,7 +599,7 @@ static int next_extio_console (ase_awk_extio_t* epa)
|
||||
|
||||
|
||||
ase_awk_t* app_awk = NULL;
|
||||
void* app_run = NULL;
|
||||
ase_awk_t* app_run = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
static BOOL WINAPI __stop_run (DWORD ctrl_type)
|
||||
@ -624,21 +624,27 @@ static void __stop_run (int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void __on_run_start (ase_awk_t* awk, void* handle, void* arg)
|
||||
static void on_run_start (
|
||||
ase_awk_t* awk, ase_awk_run_t* run, void* custom_data)
|
||||
{
|
||||
app_awk = awk;
|
||||
app_run = handle;
|
||||
app_run = run;
|
||||
|
||||
__awk_dprintf (ASE_T("AWK PRORAM ABOUT TO START...\n"));
|
||||
awk_dprintf (ASE_T("AWK ABOUT TO START...\n"));
|
||||
}
|
||||
|
||||
static void __on_run_end (ase_awk_t* awk, void* handle, int errnum, void* arg)
|
||||
static void on_run_end (
|
||||
ase_awk_t* awk, ase_awk_run_t* run,
|
||||
int errnum, void* custom_data)
|
||||
{
|
||||
if (errnum != ASE_AWK_ENOERR)
|
||||
{
|
||||
__awk_dprintf (ASE_T("AWK PRORAM ABOUT TO END WITH AN ERROR - %d - %s\n"), errnum, ase_awk_geterrstr (errnum));
|
||||
//const ase_awk_t* errmsg = ase_awk_getrunerrmsg (run);
|
||||
awk_dprintf (
|
||||
ASE_T("AWK ABOUT TO END WITH AN ERROR - [%d] %s\n"),
|
||||
errnum, ase_awk_getrunerrmsg (run));
|
||||
}
|
||||
else __awk_dprintf (ASE_T("AWK PRORAM ENDED SUCCESSFULLY\n"));
|
||||
else awk_dprintf (ASE_T("AWK ENDED SUCCESSFULLY\n"));
|
||||
|
||||
app_awk = NULL;
|
||||
app_run = NULL;
|
||||
@ -652,7 +658,7 @@ struct sysfns_data_t
|
||||
};
|
||||
#endif
|
||||
|
||||
static void* __awk_malloc (ase_size_t n, void* custom_data)
|
||||
static void* awk_malloc (ase_size_t n, void* custom_data)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return HeapAlloc (((sysfns_data_t*)custom_data)->heap, 0, n);
|
||||
@ -661,7 +667,7 @@ static void* __awk_malloc (ase_size_t n, void* custom_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* __awk_realloc (void* ptr, ase_size_t n, void* custom_data)
|
||||
static void* awk_realloc (void* ptr, ase_size_t n, void* custom_data)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* HeapReAlloc behaves differently from realloc */
|
||||
@ -674,7 +680,7 @@ static void* __awk_realloc (void* ptr, ase_size_t n, void* custom_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __awk_free (void* ptr, void* custom_data)
|
||||
static void awk_free (void* ptr, void* custom_data)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapFree (((sysfns_data_t*)custom_data)->heap, 0, ptr);
|
||||
@ -685,49 +691,49 @@ static void __awk_free (void* ptr, void* custom_data)
|
||||
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
#if (__TURBOC__<=513) /* turboc 2.01 or earlier */
|
||||
static int __awk_isupper (int c) { return isupper (c); }
|
||||
static int __awk_islower (int c) { return islower (c); }
|
||||
static int __awk_isalpha (int c) { return isalpha (c); }
|
||||
static int __awk_isdigit (int c) { return isdigit (c); }
|
||||
static int __awk_isxdigit (int c) { return isxdigit (c); }
|
||||
static int __awk_isalnum (int c) { return isalnum (c); }
|
||||
static int __awk_isspace (int c) { return isspace (c); }
|
||||
static int __awk_isprint (int c) { return isprint (c); }
|
||||
static int __awk_isgraph (int c) { return isgraph (c); }
|
||||
static int __awk_iscntrl (int c) { return iscntrl (c); }
|
||||
static int __awk_ispunct (int c) { return ispunct (c); }
|
||||
static int __awk_toupper (int c) { return toupper (c); }
|
||||
static int __awk_tolower (int c) { return tolower (c); }
|
||||
static int awk_isupper (int c) { return isupper (c); }
|
||||
static int awk_islower (int c) { return islower (c); }
|
||||
static int awk_isalpha (int c) { return isalpha (c); }
|
||||
static int awk_isdigit (int c) { return isdigit (c); }
|
||||
static int awk_isxdigit (int c) { return isxdigit (c); }
|
||||
static int awk_isalnum (int c) { return isalnum (c); }
|
||||
static int awk_isspace (int c) { return isspace (c); }
|
||||
static int awk_isprint (int c) { return isprint (c); }
|
||||
static int awk_isgraph (int c) { return isgraph (c); }
|
||||
static int awk_iscntrl (int c) { return iscntrl (c); }
|
||||
static int awk_ispunct (int c) { return ispunct (c); }
|
||||
static int awk_toupper (int c) { return toupper (c); }
|
||||
static int awk_tolower (int c) { return tolower (c); }
|
||||
#else
|
||||
#define __awk_isupper isupper
|
||||
#define __awk_islower islower
|
||||
#define __awk_isalpha isalpha
|
||||
#define __awk_isdigit isdigit
|
||||
#define __awk_isxdigit isxdigit
|
||||
#define __awk_isalnum isalnum
|
||||
#define __awk_isspace isspace
|
||||
#define __awk_isprint isprint
|
||||
#define __awk_isgraph isgraph
|
||||
#define __awk_iscntrl iscntrl
|
||||
#define __awk_ispunct ispunct
|
||||
#define __awk_toupper tolower
|
||||
#define __awk_tolower tolower
|
||||
#define awk_isupper isupper
|
||||
#define awk_islower islower
|
||||
#define awk_isalpha isalpha
|
||||
#define awk_isdigit isdigit
|
||||
#define awk_isxdigit isxdigit
|
||||
#define awk_isalnum isalnum
|
||||
#define awk_isspace isspace
|
||||
#define awk_isprint isprint
|
||||
#define awk_isgraph isgraph
|
||||
#define awk_iscntrl iscntrl
|
||||
#define awk_ispunct ispunct
|
||||
#define awk_toupper tolower
|
||||
#define awk_tolower tolower
|
||||
#endif
|
||||
#else
|
||||
#define __awk_isupper iswupper
|
||||
#define __awk_islower iswlower
|
||||
#define __awk_isalpha iswalpha
|
||||
#define __awk_isdigit iswdigit
|
||||
#define __awk_isxdigit iswxdigit
|
||||
#define __awk_isalnum iswalnum
|
||||
#define __awk_isspace iswspace
|
||||
#define __awk_isprint iswprint
|
||||
#define __awk_isgraph iswgraph
|
||||
#define __awk_iscntrl iswcntrl
|
||||
#define __awk_ispunct iswpunct
|
||||
#define awk_isupper iswupper
|
||||
#define awk_islower iswlower
|
||||
#define awk_isalpha iswalpha
|
||||
#define awk_isdigit iswdigit
|
||||
#define awk_isxdigit iswxdigit
|
||||
#define awk_isalnum iswalnum
|
||||
#define awk_isspace iswspace
|
||||
#define awk_isprint iswprint
|
||||
#define awk_isgraph iswgraph
|
||||
#define awk_iscntrl iswcntrl
|
||||
#define awk_ispunct iswpunct
|
||||
|
||||
#define __awk_toupper towlower
|
||||
#define __awk_tolower towlower
|
||||
#define awk_toupper towlower
|
||||
#define awk_tolower towlower
|
||||
#endif
|
||||
|
||||
static int __main (int argc, ase_char_t* argv[])
|
||||
@ -790,33 +796,33 @@ static int __main (int argc, ase_char_t* argv[])
|
||||
}
|
||||
|
||||
memset (&sysfns, 0, ASE_SIZEOF(sysfns));
|
||||
sysfns.malloc = __awk_malloc;
|
||||
sysfns.realloc = __awk_realloc;
|
||||
sysfns.free = __awk_free;
|
||||
sysfns.malloc = awk_malloc;
|
||||
sysfns.realloc = awk_realloc;
|
||||
sysfns.free = awk_free;
|
||||
|
||||
sysfns.lock = NULL;
|
||||
sysfns.unlock = NULL;
|
||||
|
||||
sysfns.is_upper = __awk_isupper;
|
||||
sysfns.is_lower = __awk_islower;
|
||||
sysfns.is_alpha = __awk_isalpha;
|
||||
sysfns.is_digit = __awk_isdigit;
|
||||
sysfns.is_xdigit = __awk_isxdigit;
|
||||
sysfns.is_alnum = __awk_isalnum;
|
||||
sysfns.is_space = __awk_isspace;
|
||||
sysfns.is_print = __awk_isprint;
|
||||
sysfns.is_graph = __awk_isgraph;
|
||||
sysfns.is_cntrl = __awk_iscntrl;
|
||||
sysfns.is_punct = __awk_ispunct;
|
||||
sysfns.to_upper = __awk_toupper;
|
||||
sysfns.to_lower = __awk_tolower;
|
||||
sysfns.is_upper = awk_isupper;
|
||||
sysfns.is_lower = awk_islower;
|
||||
sysfns.is_alpha = awk_isalpha;
|
||||
sysfns.is_digit = awk_isdigit;
|
||||
sysfns.is_xdigit = awk_isxdigit;
|
||||
sysfns.is_alnum = awk_isalnum;
|
||||
sysfns.is_space = awk_isspace;
|
||||
sysfns.is_print = awk_isprint;
|
||||
sysfns.is_graph = awk_isgraph;
|
||||
sysfns.is_cntrl = awk_iscntrl;
|
||||
sysfns.is_punct = awk_ispunct;
|
||||
sysfns.to_upper = awk_toupper;
|
||||
sysfns.to_lower = awk_tolower;
|
||||
|
||||
sysfns.memcpy = memcpy;
|
||||
sysfns.memset = memset;
|
||||
sysfns.pow = __awk_pow;
|
||||
sysfns.sprintf = __awk_sprintf;
|
||||
sysfns.aprintf = __awk_aprintf;
|
||||
sysfns.dprintf = __awk_dprintf;
|
||||
sysfns.pow = awk_pow;
|
||||
sysfns.sprintf = awk_sprintf;
|
||||
sysfns.aprintf = awk_aprintf;
|
||||
sysfns.dprintf = awk_dprintf;
|
||||
sysfns.abort = abort;
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -875,8 +881,8 @@ static int __main (int argc, ase_char_t* argv[])
|
||||
runios.file = process_extio_file;
|
||||
runios.console = process_extio_console;
|
||||
|
||||
runcbs.on_start = __on_run_start;
|
||||
runcbs.on_end = __on_run_end;
|
||||
runcbs.on_start = on_run_start;
|
||||
runcbs.on_end = on_run_end;
|
||||
runcbs.custom_data = ASE_NULL;
|
||||
|
||||
runarg[0].ptr = ASE_T("argument 0");
|
||||
|
@ -25,9 +25,6 @@ java:
|
||||
jrun:
|
||||
java -Xms1m -Xmx2m -classpath ../../.. ase.test.awk.Awk
|
||||
|
||||
ada:
|
||||
gnatmake -I..\.. -I..\..\awk awk
|
||||
|
||||
clean:
|
||||
del $(OBJS) *.obj *.class awk.exe
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user