This commit is contained in:
2008-02-09 03:04:38 +00:00
parent 04c12f891b
commit c17dc12bbd
20 changed files with 291 additions and 107 deletions

View File

@ -924,20 +924,20 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
void Awk::Run::setError (ErrorCode code)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerror (this->run, code, 0, ASE_NULL, 0);
ase_awk_setrunerror (this->run, (errnum_t)code, 0, ASE_NULL, 0);
}
void Awk::Run::setError (ErrorCode code, size_t line)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerror (this->run, code, line, ASE_NULL, 0);
ase_awk_setrunerror (this->run, (errnum_t)code, line, ASE_NULL, 0);
}
void Awk::Run::setError (ErrorCode code, size_t line, const char_t* arg)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_cstr_t x = { arg, ase_strlen(arg) };
ase_awk_setrunerror (this->run, code, line, &x, 1);
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
}
void Awk::Run::setError (
@ -945,14 +945,14 @@ void Awk::Run::setError (
{
ASE_ASSERT (this->run != ASE_NULL);
ase_cstr_t x = { arg, len };
ase_awk_setrunerror (this->run, code, line, &x, 1);
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
}
void Awk::Run::setErrorWithMessage (
ErrorCode code, size_t line, const char_t* msg)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerrmsg (this->run, code, line, msg);
ase_awk_setrunerrmsg (this->run, (errnum_t)code, line, msg);
}
int Awk::Run::setGlobal (int id, long_t v)
@ -1023,9 +1023,9 @@ void* Awk::Run::getCustom () const
// Awk
//////////////////////////////////////////////////////////////////
Awk::Awk (): awk (ASE_NULL), functionMap (ASE_NULL),
sourceIn (Source::READ), sourceOut (Source::WRITE),
errnum (ERR_NOERR), errlin (0), runCallback (false)
Awk::Awk (): /*awk (ASE_NULL), functionMap (ASE_NULL), */
sourceIn (Source::READ), sourceOut (Source::WRITE)/*,
errnum (ERR_NOERR), errlin (0), runCallback (false)*/
{
this->errmsg[0] = ASE_T('\0');
@ -1075,7 +1075,7 @@ void Awk::setError (ErrorCode code, size_t line, const char_t* arg, size_t len)
if (awk != ASE_NULL)
{
ase_cstr_t x = { arg, len };
ase_awk_seterror (awk, code, line, &x, 1);
ase_awk_seterror (awk, (errnum_t)code, line, &x, 1);
retrieveError ();
}
else
@ -1092,7 +1092,7 @@ void Awk::setErrorWithMessage (ErrorCode code, size_t line, const char_t* msg)
{
if (awk != ASE_NULL)
{
ase_awk_seterrmsg (awk, code, line, msg);
ase_awk_seterrmsg (awk, (errnum_t)code, line, msg);
retrieveError ();
}
else
@ -1692,13 +1692,13 @@ void Awk::onRunStart (run_t* run, void* custom)
r->awk->triggerOnRunStart (*r);
}
void Awk::onRunEnd (run_t* run, int errnum, void* custom)
void Awk::onRunEnd (run_t* run, errnum_t errnum, void* custom)
{
Run* r = (Run*)custom;
if (errnum == ERR_NOERR && r->callbackFailed)
{
ase_awk_setrunerrnum (r->run, ERR_NOMEM);
ase_awk_setrunerrnum (r->run, (errnum_t)ERR_NOMEM);
}
r->awk->onRunEnd (*r);

View File

@ -41,8 +41,6 @@ public:
typedef ase_awk_map_t map_t;
/** Represents a key/value pair */
typedef ase_awk_pair_t pair_t;
/** Represents the IO command */
typedef ase_awk_iocmd_t iocmd_t;
/** Represents the external I/O context */
typedef ase_awk_extio_t extio_t;
/** Represents the run-time context */
@ -50,6 +48,11 @@ public:
/** Represents the underlying interpreter */
typedef ase_awk_t awk_t;
/** Represents IO command */
typedef ase_awk_iocmd_t iocmd_t;
/** Represents the error number */
typedef ase_awk_errnum_t errnum_t;
/**
* Represents the source code I/O context for Awk::parse.
* An instance of Awk::Source is passed to Awk::openSource,
@ -1056,7 +1059,7 @@ protected:
static void freeFunctionMapValue (void* owner, void* value);
static void onRunStart (run_t* run, void* custom);
static void onRunEnd (run_t* run, int errnum, void* custom);
static void onRunEnd (run_t* run, errnum_t errnum, void* custom);
static void onRunReturn (run_t* run, val_t* ret, void* custom);
static void onRunStatement (run_t* run, size_t line, void* custom);

View File

@ -31,13 +31,15 @@ typedef struct ase_awk_runcbs_t ase_awk_runcbs_t;
typedef struct ase_awk_runarg_t ase_awk_runarg_t;
typedef struct ase_awk_rexfns_t ase_awk_rexfns_t;
typedef enum ase_awk_iocmd_t ase_awk_iocmd_t;
typedef enum ase_awk_errnum_t ase_awk_errnum_t;
typedef ase_real_t (*ase_awk_pow_t) (void* custom, ase_real_t x, ase_real_t y);
typedef int (*ase_awk_sprintf_t) (
void* custom, ase_char_t* buf, ase_size_t size,
const ase_char_t* fmt, ...);
typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
typedef enum ase_awk_iocmd_t ase_awk_iocmd_t;
typedef ase_ssize_t (*ase_awk_io_t) (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
@ -115,7 +117,7 @@ struct ase_awk_runcbs_t
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom_data);
void (*on_end) (
ase_awk_run_t* run, int errnum, void* custom_data);
ase_awk_run_t* run, ase_awk_errnum_t errnum, void* custom_data);
void* custom_data;
};
@ -472,16 +474,16 @@ int ase_awk_geterrnum (ase_awk_t* awk);
ase_size_t ase_awk_geterrlin (ase_awk_t* awk);
const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk);
void ase_awk_seterrnum (ase_awk_t* awk, int errnum);
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum);
void ase_awk_seterrmsg (ase_awk_t* awk,
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
void ase_awk_geterror (
ase_awk_t* awk, int* errnum,
ase_size_t* errlin, const ase_char_t** errmsg);
void ase_awk_seterror (
ase_awk_t* awk, int errnum, ase_size_t errlin,
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt);
int ase_awk_getoption (ase_awk_t* awk);
@ -621,16 +623,16 @@ ase_awk_map_t* ase_awk_getrunnamedvarmap (ase_awk_run_t* awk);
int ase_awk_getrunerrnum (ase_awk_run_t* run);
ase_size_t ase_awk_getrunerrlin (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_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum);
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
void ase_awk_getrunerror (
ase_awk_run_t* run, int* errnum,
ase_size_t* errlin, const ase_char_t** errmsg);
void ase_awk_setrunerror (
ase_awk_run_t* run, int errnum, ase_size_t errlin,
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt);
/* functions to manipulate intrinsic functions */

View File

@ -218,7 +218,7 @@ struct ase_awk_t
} tmp;
/* housekeeping */
int errnum;
ase_awk_errnum_t errnum;
ase_size_t errlin;
ase_char_t errmsg[256];
ase_char_t* errstr[ASE_AWK_NUMERRNUM];
@ -355,7 +355,7 @@ struct ase_awk_run_t
} max;
} depth;
int errnum;
ase_awk_errnum_t errnum;
ase_size_t errlin;
ase_char_t errmsg[256];

View File

@ -6,7 +6,7 @@
#include <ase/awk/awk_i.h>
static const ase_char_t* __geterrstr (int errnum)
static const ase_char_t* __geterrstr (ase_awk_errnum_t errnum)
{
static const ase_char_t* errstr[] =
{
@ -217,7 +217,7 @@ void ase_awk_geterror (
}
}
void ase_awk_seterrnum (ase_awk_t* awk, int errnum)
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum)
{
awk->errnum = errnum;
awk->errlin = 0;
@ -225,7 +225,7 @@ void ase_awk_seterrnum (ase_awk_t* awk, int errnum)
}
void ase_awk_seterrmsg (ase_awk_t* awk,
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
{
awk->errnum = errnum;
awk->errlin = errlin;
@ -233,7 +233,7 @@ void ase_awk_seterrmsg (ase_awk_t* awk,
}
void ase_awk_seterror (
ase_awk_t* awk, int errnum, ase_size_t errlin,
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt)
{
const ase_char_t* errfmt;
@ -352,7 +352,7 @@ const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run)
return run->errmsg;
}
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum)
{
run->errnum = errnum;
run->errlin = 0;
@ -360,7 +360,7 @@ void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
}
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
{
run->errnum = errnum;
run->errlin = errlin;
@ -383,7 +383,7 @@ void ase_awk_getrunerror (
}
void ase_awk_setrunerror (
ase_awk_run_t* run, int errnum, ase_size_t errlin,
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt)
{
const ase_char_t* errfmt;

View File

@ -110,7 +110,7 @@ struct run_data_t
jobject obj;
ase_size_t errlin;
int errnum;
ase_awk_errnum_t errnum;
ase_char_t errmsg[256];
jclass exception_class;

View File

@ -15,8 +15,21 @@ AR = tlib
JAVAC = javac
JAR = jar
CFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
CXXFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
CFLAGS = -WM -WU -RT- -w -q -I..\..
CXXFLAGS = -WM -WU -RT- -w -q -I..\..
!IF "$(MODE)" == "debug"
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
CXXFLAGS = $(CXXFLAGS) -D_DEBUG -DDEBUG
!ELSEIF "$(MODE)" == "release"
CFLAGS = $(CFLAGS) -DNDEBUG -O2
CXXFLAGS = $(CXXFLAGS) -DNDEBUG -O2
!ELSE
CFLAGS = $(CFLAGS)
CXXFLAGS = $(CXXFLAGS)
!ENDIF
JAVACFLAGS = -classpath ..\.. -Xlint:unchecked
LDFLAGS = -Tpd -ap -Gn -c -q -L..\$(MODE)\lib
@ -26,7 +39,7 @@ LIBS = import32.lib cw32mt.lib asecmn.lib aseutl.lib $(NAME).lib
OUT_DIR = ..\$(MODE)\lib
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
OUT_FILE_JNI = $(OUT_DIR)\$(NAME)_jni.dll
OUT_FILE_LIB_CXX = $(OUT_DIR)\$(NAME)++.lib
OUT_FILE_LIB_CXX = "$(OUT_DIR)\$(NAME)++.lib"
OUT_FILE_JAR = $(OUT_DIR)\$(NAME).jar
TMP_DIR = $(MODE)
@ -67,7 +80,13 @@ OBJ_FILES_JAR = \
$(TMP_DIR)\ase\awk\Pipe.class \
$(TMP_DIR)\ase\awk\Exception.class
all: lib
TARGETS = lib
!if "$(JAVA_HOME)" != ""
TARGETS = $(TARGETS) jnidll jar
JNI_INC = -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32"
!endif
all: $(TARGETS)
lib: $(TMP_DIR) $(OUT_DIR) $(OUT_DIR_CXX) $(OUT_FILE_LIB) $(OUT_FILE_LIB_CXX)
@ -82,7 +101,7 @@ $(OUT_FILE_LIB): $(OBJ_FILES_LIB)
!
$(OUT_FILE_LIB_CXX): $(OBJ_FILES_LIB_CXX)
$(AR) "$(OUT_FILE_LIB_CXX)" @&&!
$(AR) $(OUT_FILE_LIB_CXX) @&&!
+-$(**: = &^
+-)
!

View File

@ -21,6 +21,11 @@ enum
TOKEN_IDIV_ASSIGN,
TOKEN_MOD_ASSIGN,
TOKEN_EXP_ASSIGN,
TOKEN_RSHIFT_ASSIGN,
TOKEN_LSHIFT_ASSIGN,
TOKEN_BAND_ASSIGN,
TOKEN_BXOR_ASSIGN,
TOKEN_BOR_ASSIGN,
TOKEN_EQ,
TOKEN_NE,
@ -29,7 +34,7 @@ enum
TOKEN_GE,
TOKEN_GT,
TOKEN_NM, /* not match */
TOKEN_NOT,
TOKEN_LNOT, /* logical negation ! */
TOKEN_PLUS,
TOKEN_PLUSPLUS,
TOKEN_MINUS,
@ -2526,7 +2531,7 @@ static ase_awk_nde_t* parse_unary (ase_awk_t* awk, ase_size_t line)
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
(MATCH(awk,TOKEN_NOT))? ASE_AWK_UNROP_NOT:
(MATCH(awk,TOKEN_LNOT))? ASE_AWK_UNROP_LNOT:
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
/*if (opcode == -1) return parse_increment (awk);*/
@ -2584,7 +2589,7 @@ static ase_awk_nde_t* parse_unary_exp (ase_awk_t* awk, ase_size_t line)
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
(MATCH(awk,TOKEN_NOT))? ASE_AWK_UNROP_NOT:
(MATCH(awk,TOKEN_LNOT))? ASE_AWK_UNROP_LNOT:
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
if (opcode == -1) return parse_increment (awk, line);
@ -4605,7 +4610,7 @@ static int get_token (ase_awk_t* awk)
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_NOT);
SET_TOKEN_TYPE (awk, TOKEN_LNOT);
}
}
else if (c == ASE_T('>'))
@ -4614,9 +4619,18 @@ static int get_token (ase_awk_t* awk)
GET_CHAR_TO (awk, c);
if (c == ASE_T('>'))
{
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
GET_CHAR_TO (awk, c);
if ((awk->option & ASE_AWK_SHIFT) && c == ASE_T('='))
{
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT_ASSIGN);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT);
}
}
else if (c == ASE_T('='))
{
@ -4636,9 +4650,18 @@ static int get_token (ase_awk_t* awk)
if ((awk->option & ASE_AWK_SHIFT) && c == ASE_T('<'))
{
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
GET_CHAR_TO (awk, c);
if (c == ASE_T('='))
{
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT_ASSIGN);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT);
}
}
else if (c == ASE_T('='))
{
@ -4667,6 +4690,12 @@ static int get_token (ase_awk_t* awk)
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else if (c == ASE_T('='))
{
SET_TOKEN_TYPE (awk, TOKEN_BOR_ASSIGN);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_BOR);
@ -4682,23 +4711,39 @@ static int get_token (ase_awk_t* awk)
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else if (c == ASE_T('='))
{
SET_TOKEN_TYPE (awk, TOKEN_BAND_ASSIGN);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_BAND);
}
}
else if (c == ASE_T('^'))
{
ADD_TOKEN_CHAR (awk, c);
GET_CHAR_TO (awk, c);
if (c == ASE_T('='))
{
SET_TOKEN_TYPE (awk, TOKEN_BXOR_ASSIGN);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else
{
SET_TOKEN_TYPE (awk, TOKEN_BXOR);
}
}
else if (c == ASE_T('~'))
{
SET_TOKEN_TYPE (awk, TOKEN_TILDE);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else if (c == ASE_T('^'))
{
SET_TOKEN_TYPE (awk, TOKEN_BXOR);
ADD_TOKEN_CHAR (awk, c);
GET_CHAR (awk);
}
else if (c == ASE_T('+'))
{
ADD_TOKEN_CHAR (awk, c);
@ -5370,6 +5415,7 @@ static int classify_ident (
static int assign_to_opcode (ase_awk_t* awk)
{
/* synchronize it with ase_awk_assop_type_t in run.h */
static int assop[] =
{
ASE_AWK_ASSOP_NONE,
@ -5379,11 +5425,16 @@ static int assign_to_opcode (ase_awk_t* awk)
ASE_AWK_ASSOP_DIV,
ASE_AWK_ASSOP_IDIV,
ASE_AWK_ASSOP_MOD,
ASE_AWK_ASSOP_EXP
ASE_AWK_ASSOP_EXP,
ASE_AWK_ASSOP_RSHIFT,
ASE_AWK_ASSOP_LSHIFT,
ASE_AWK_ASSOP_BAND,
ASE_AWK_ASSOP_BXOR,
ASE_AWK_ASSOP_BOR
};
if (awk->token.type >= TOKEN_ASSIGN &&
awk->token.type <= TOKEN_EXP_ASSIGN)
awk->token.type <= TOKEN_BOR_ASSIGN)
{
return assop[awk->token.type - TOKEN_ASSIGN];
}

View File

@ -3204,7 +3204,7 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
if (ass->opcode != ASE_AWK_ASSOP_NONE)
{
ase_awk_val_t* val2, * tmp;
static binop_func_t __binop_func[] =
static binop_func_t binop_func[] =
{
ASE_NULL, /* ASE_AWK_ASSOP_NONE */
eval_binop_plus,
@ -3213,7 +3213,12 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
eval_binop_div,
eval_binop_idiv,
eval_binop_mod,
eval_binop_exp
eval_binop_exp,
eval_binop_rshift,
eval_binop_lshift,
eval_binop_band,
eval_binop_bxor,
eval_binop_bor
};
ASE_ASSERT (ass->left->next == ASE_NULL);
@ -3227,10 +3232,10 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
ase_awk_refupval (run, val2);
ASE_ASSERT (ass->opcode >= 0);
ASE_ASSERT (ass->opcode < ASE_COUNTOF(__binop_func));
ASE_ASSERT (__binop_func[ass->opcode] != ASE_NULL);
ASE_ASSERT (ass->opcode < ASE_COUNTOF(binop_func));
ASE_ASSERT (binop_func[ass->opcode] != ASE_NULL);
tmp = __binop_func[ass->opcode] (run, val2, val);
tmp = binop_func[ass->opcode] (run, val2, val);
if (tmp == ASE_NULL)
{
ase_awk_refdownval (run, val2);
@ -3597,7 +3602,7 @@ static ase_awk_val_t* do_assignment_pos (
static ase_awk_val_t* eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
{
static binop_func_t __binop_func[] =
static binop_func_t binop_func[] =
{
/* the order of the functions should be inline with
* the operator declaration in run.h */
@ -3678,10 +3683,10 @@ static ase_awk_val_t* eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
ase_awk_refupval (run, right);
ASE_ASSERT (exp->opcode >= 0 &&
exp->opcode < ASE_COUNTOF(__binop_func));
ASE_ASSERT (__binop_func[exp->opcode] != ASE_NULL);
exp->opcode < ASE_COUNTOF(binop_func));
ASE_ASSERT (binop_func[exp->opcode] != ASE_NULL);
res = __binop_func[exp->opcode] (run, left, right);
res = binop_func[exp->opcode] (run, left, right);
if (res == ASE_NULL)
{
/* change the error line */
@ -4832,7 +4837,7 @@ static ase_awk_val_t* eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
ASE_ASSERT (
exp->opcode == ASE_AWK_UNROP_PLUS ||
exp->opcode == ASE_AWK_UNROP_MINUS ||
exp->opcode == ASE_AWK_UNROP_NOT ||
exp->opcode == ASE_AWK_UNROP_LNOT ||
exp->opcode == ASE_AWK_UNROP_BNOT);
ASE_ASSERT (exp->left->next == ASE_NULL);
@ -4849,7 +4854,7 @@ static ase_awk_val_t* eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
res = (n == 0)? ase_awk_makeintval (run, -l):
ase_awk_makerealval (run, -r);
}
else if (exp->opcode == ASE_AWK_UNROP_NOT)
else if (exp->opcode == ASE_AWK_UNROP_LNOT)
{
if (left->type == ASE_AWK_VAL_STR)
{

View File

@ -13,21 +13,27 @@
enum ase_awk_assop_type_t
{
/* if you change this, you have to change __assop_str in tree.c */
/* if you change this, you have to change assop_str in tree.c.
* synchronize it with binop_func of eval_assignment in run.c */
ASE_AWK_ASSOP_NONE,
ASE_AWK_ASSOP_PLUS, /* += */
ASE_AWK_ASSOP_MINUS, /* -= */
ASE_AWK_ASSOP_MUL, /* *= */
ASE_AWK_ASSOP_DIV, /* /= */
ASE_AWK_ASSOP_IDIV, /* //= */
ASE_AWK_ASSOP_MOD, /* %= */
ASE_AWK_ASSOP_EXP /* **= */
ASE_AWK_ASSOP_PLUS, /* += */
ASE_AWK_ASSOP_MINUS, /* -= */
ASE_AWK_ASSOP_MUL, /* *= */
ASE_AWK_ASSOP_DIV, /* /= */
ASE_AWK_ASSOP_IDIV, /* //= */
ASE_AWK_ASSOP_MOD, /* %= */
ASE_AWK_ASSOP_EXP, /* **= */
ASE_AWK_ASSOP_RSHIFT, /* >>= */
ASE_AWK_ASSOP_LSHIFT, /* <<= */
ASE_AWK_ASSOP_BAND, /* &= */
ASE_AWK_ASSOP_BXOR, /* ^= */
ASE_AWK_ASSOP_BOR /* |= */
};
enum ase_awk_binop_type_t
{
/* if you change this, you have to change
* __binop_str in tree.c and __binop_func in run.c accordingly. */
* binop_str in tree.c and binop_func in run.c accordingly. */
ASE_AWK_BINOP_LOR,
ASE_AWK_BINOP_LAND,
ASE_AWK_BINOP_IN,
@ -65,7 +71,7 @@ enum ase_awk_unrop_type_t
* __unrop_str in tree.c accordingly. */
ASE_AWK_UNROP_PLUS,
ASE_AWK_UNROP_MINUS,
ASE_AWK_UNROP_NOT,
ASE_AWK_UNROP_LNOT,
ASE_AWK_UNROP_BNOT
};

View File

@ -15,7 +15,12 @@ static const ase_char_t* assop_str[] =
ASE_T("/="),
ASE_T("//="),
ASE_T("%="),
ASE_T("**=")
ASE_T("**="),
ASE_T(">>="),
ASE_T("<<="),
ASE_T("&="),
ASE_T("^="),
ASE_T("|=")
};
static const ase_char_t* binop_str[][2] =