From a966ad329669d69e885d7bc8ca4afa19ce69f227 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 30 Mar 2006 16:31:50 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/parse.c | 10 +++++----- ase/awk/run.c | 14 +++++++++++++- ase/awk/run.h | 5 ++++- ase/awk/tree.c | 7 ++++++- ase/test/awk/Makefile.cl | 2 +- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ase/awk/parse.c b/ase/awk/parse.c index e003b1c4..81c30716 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.63 2006-03-30 16:24:10 bacon Exp $ + * $Id: parse.c,v 1.64 2006-03-30 16:31:50 bacon Exp $ */ #include @@ -1118,7 +1118,7 @@ static xp_awk_nde_t* __parse_logical_or (xp_awk_t* awk) { TOKEN_EOF, 0 } }; - return __parse_binary_expr (awk, __parse_logical_and, map); + return __parse_binary_expr (awk, map, __parse_logical_and); } static xp_awk_nde_t* __parse_logical_and (xp_awk_t* awk) @@ -1129,7 +1129,7 @@ static xp_awk_nde_t* __parse_logical_and (xp_awk_t* awk) { TOKEN_EOF, 0 } }; - return __parse_binary_expr (awk, __parse_bitwise_or, map); + return __parse_binary_expr (awk, map, __parse_bitwise_or); } static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk) @@ -1140,7 +1140,7 @@ static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk) { TOKEN_EOF, 0 } }; - return __parse_binary_expr (awk, __parse_bitwise_xor, map); + return __parse_binary_expr (awk, map, __parse_bitwise_xor); } static xp_awk_nde_t* __parse_bitwise_xor (xp_awk_t* awk) @@ -1151,7 +1151,7 @@ static xp_awk_nde_t* __parse_bitwise_xor (xp_awk_t* awk) { TOKEN_EOF, 0 } }; - return __parse_binary_expr (awk, __parse_equality, map); + return __parse_binary_expr (awk, map, __parse_equality); } static xp_awk_nde_t* __parse_equality (xp_awk_t* awk) diff --git a/ase/awk/run.c b/ase/awk/run.c index c42e0b8c..85fa5349 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.26 2006-03-28 16:33:09 bacon Exp $ + * $Id: run.c,v 1.27 2006-03-30 16:31:50 bacon Exp $ */ #include @@ -670,6 +670,18 @@ static xp_awk_val_t* __eval_binary (xp_awk_t* awk, xp_awk_nde_exp_t* nde) res = xp_awk_makeintval (awk, r); } } + else if (nde->opcode == XP_AWK_BINOP_BXOR) + { + if (left->type == XP_AWK_VAL_INT && + right->type == XP_AWK_VAL_INT) + { + xp_long_t r = + ((xp_awk_val_int_t*)left)->val ^ + ((xp_awk_val_int_t*)right)->val; + res = xp_awk_makeintval (awk, r); + } + } + xp_awk_refdownval (awk, left); xp_awk_refdownval (awk, right); diff --git a/ase/awk/run.h b/ase/awk/run.h index d5047913..fa73381f 100644 --- a/ase/awk/run.h +++ b/ase/awk/run.h @@ -1,5 +1,5 @@ /* - * $Id: run.h,v 1.3 2006-03-30 16:24:10 bacon Exp $ + * $Id: run.h,v 1.4 2006-03-30 16:31:50 bacon Exp $ */ #ifndef _XP_AWK_RUN_H_ @@ -21,6 +21,9 @@ struct xp_awk_frm_t enum { + /* if you change this, you have to change + * __binop_str in tree.c accordingly */ + XP_AWK_BINOP_LOR, XP_AWK_BINOP_LAND, XP_AWK_BINOP_BOR, diff --git a/ase/awk/tree.c b/ase/awk/tree.c index aacb53a9..cab13c38 100644 --- a/ase/awk/tree.c +++ b/ase/awk/tree.c @@ -1,5 +1,5 @@ /* - * $Id: tree.c,v 1.27 2006-03-28 16:33:09 bacon Exp $ + * $Id: tree.c,v 1.28 2006-03-30 16:31:50 bacon Exp $ */ #include @@ -12,6 +12,11 @@ static const xp_char_t* __binop_str[] = { + XP_TEXT("||"), + XP_TEXT("&&"), + XP_TEXT("|"), + XP_TEXT("^"), + XP_TEXT("&"), XP_TEXT("+"), XP_TEXT("-"), XP_TEXT("*"), diff --git a/ase/test/awk/Makefile.cl b/ase/test/awk/Makefile.cl index 10fd11aa..0e8dc255 100644 --- a/ase/test/awk/Makefile.cl +++ b/ase/test/awk/Makefile.cl @@ -1,6 +1,6 @@ CC = cl #CFLAGS = /nologo /MT /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\.. -CFLAGS = /nologo /MT /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\.. -D__STAND_ALONE +CFLAGS = /nologo /MT /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\.. -D__STAND_ALONE -DXP_CHAR_IS_WCHAR LDFLAGS = /libpath:..\..\bas /libpath:..\..\awk #LIBS = xpbas.lib xpawk.lib LIBS = xpawk.lib