From 6eb78194c1f365597634ef7183f1da12ff158068 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 18 Jun 2006 10:53:06 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/awk.dsp | 12 ++++++++++++ ase/awk/awk.h | 3 ++- ase/awk/err.c | 3 ++- ase/awk/parse.c | 32 ++++++++++++++++++++++++++++---- ase/awk/run.c | 9 +++++++-- ase/awk/tree.c | 7 +++++-- ase/awk/tree.h | 4 +++- 7 files changed, 59 insertions(+), 11 deletions(-) diff --git a/ase/awk/awk.dsp b/ase/awk/awk.dsp index 28aedc57..26d81b13 100644 --- a/ase/awk/awk.dsp +++ b/ase/awk/awk.dsp @@ -203,6 +203,14 @@ SOURCE=.\err.c # End Source File # Begin Source File +SOURCE=.\extio.c +# End Source File +# Begin Source File + +SOURCE=.\func.c +# End Source File +# Begin Source File + SOURCE=.\map.c # End Source File # Begin Source File @@ -247,6 +255,10 @@ SOURCE=.\awk_i.h # End Source File # Begin Source File +SOURCE=.\func.h +# End Source File +# Begin Source File + SOURCE=.\map.h # End Source File # Begin Source File diff --git a/ase/awk/awk.h b/ase/awk/awk.h index f5f36f24..daee465d 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.62 2006-06-16 07:35:06 bacon Exp $ + * $Id: awk.h,v 1.63 2006-06-18 10:53:06 bacon Exp $ */ #ifndef _XP_AWK_AWK_H_ @@ -91,6 +91,7 @@ enum XP_AWK_EUNDEF, /* undefined identifier */ XP_AWK_ELVALUE, /* l-value required */ XP_AWK_ETOOMANYARGS, /* too many arguments */ + XP_AWK_EGETLINE, /* getline expected */ /* run time error */ XP_AWK_EDIVBYZERO, /* divide by zero */ diff --git a/ase/awk/err.c b/ase/awk/err.c index 250543ca..78710be3 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.19 2006-06-16 07:35:07 bacon Exp $ + * $Id: err.c,v 1.20 2006-06-18 10:53:06 bacon Exp $ */ #include @@ -56,6 +56,7 @@ const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk) XP_T("undefined identifier"), XP_T("l-value required"), XP_T("too many arguments"), + XP_T("getline expected"), XP_T("divide by zero"), XP_T("invalid operand"), diff --git a/ase/awk/parse.c b/ase/awk/parse.c index d0833075..14d40b84 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.114 2006-06-16 14:31:42 bacon Exp $ + * $Id: parse.c,v 1.115 2006-06-18 10:53:06 bacon Exp $ */ #include @@ -44,6 +44,7 @@ enum TOKEN_BOR, TOKEN_BXOR, TOKEN_BAND, + TOKEN_BORAND, TOKEN_TILDE, /* used for unary bitwise-not and regex match */ TOKEN_RSHIFT, TOKEN_LSHIFT, @@ -1455,7 +1456,13 @@ static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk) while (1) { - if (!MATCH(awk,TOKEN_BOR)) break; + int in_type; + + if (MATCH(awk,TOKEN_BOR)) + in_type = XP_AWK_GETLINE_PIPE; + else if (MATCH(awk,TOKEN_BORAND)) + in_type = XP_AWK_GETLINE_COPROC; + else break; if (__get_token(awk) == -1) { @@ -1500,7 +1507,7 @@ static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk) nde->type = XP_AWK_NDE_GETLINE; nde->next = XP_NULL; nde->var = var; - nde->in_type = XP_AWK_GETLINE_PIPE; + nde->in_type = in_type; nde->in = left; left = (xp_awk_nde_t*)nde; @@ -1509,6 +1516,12 @@ static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk) { xp_awk_nde_exp_t* nde; + if (in_type == XP_AWK_GETLINE_COPROC) + { + xp_awk_clrpt (left); + PANIC (awk, XP_AWK_EGETLINE); + } + right = __parse_bitwise_xor (awk); if (right == XP_NULL) { @@ -2762,7 +2775,8 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk) /* TODO: expression list............ */ if (!MATCH(awk,TOKEN_SEMICOLON) && !MATCH(awk,TOKEN_GT) && - !MATCH(awk,TOKEN_BOR)) + !MATCH(awk,TOKEN_BOR) && + !MATCH(awk,TOKEN_BORAND)) { args = __parse_expression (awk); if (args == XP_NULL) return XP_NULL; @@ -2776,6 +2790,10 @@ static xp_awk_nde_t* __parse_print (xp_awk_t* awk) { out_type = XP_AWK_PRINT_PIPE; } + else if (MATCH(awk,TOKEN_BORAND)) + { + out_type = XP_AWK_PRINT_COPROC; + } if (out_type != -1) { @@ -2989,6 +3007,12 @@ static int __get_token (xp_awk_t* awk) ADD_TOKEN_STR (awk, XP_T("||")); GET_CHAR_TO (awk, c); } + else if (c == XP_T('&')) + { + SET_TOKEN_TYPE (awk, TOKEN_BORAND); + ADD_TOKEN_STR (awk, XP_T("|&")); + GET_CHAR_TO (awk, c); + } else { SET_TOKEN_TYPE (awk, TOKEN_BOR); diff --git a/ase/awk/run.c b/ase/awk/run.c index 8464c7f0..05b4f0c5 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.96 2006-06-16 07:35:07 bacon Exp $ + * $Id: run.c,v 1.97 2006-06-18 10:53:06 bacon Exp $ */ #include @@ -2881,9 +2881,14 @@ static xp_awk_val_t* __eval_getline (xp_awk_run_t* run, xp_awk_nde_t* nde) return xp_awk_makeintval (run, n); } + else if (p->in_type == XP_AWK_GETLINE_COPROC) + { + xp_printf (XP_T("eval_getline coprocess not properly implemented....\n")); + return XP_NULL; + } else if (p->in_type == XP_AWK_GETLINE_FILE) { - xp_printf (XP_T("eval_getline not properly implemented....\n")); + xp_printf (XP_T("eval_getline file not properly implemented....\n")); return XP_NULL; } else diff --git a/ase/awk/tree.c b/ase/awk/tree.c index a88289a2..a17380bf 100644 --- a/ase/awk/tree.c +++ b/ase/awk/tree.c @@ -1,5 +1,5 @@ /* - * $Id: tree.c,v 1.53 2006-06-13 15:11:39 bacon Exp $ + * $Id: tree.c,v 1.54 2006-06-18 10:53:06 bacon Exp $ */ #include @@ -71,12 +71,14 @@ static const xp_char_t* __incop_str[] = static const xp_char_t* __getline_inop_str[] = { XP_T("|"), + XP_T("|&"), XP_T("<") }; static const xp_char_t* __print_outop_str[] = { XP_T("|"), + XP_T("|&"), XP_T(">") }; @@ -351,7 +353,8 @@ static int __print_expression (xp_awk_nde_t* nde) /* TODO */ xp_awk_nde_getline_t* px = (xp_awk_nde_getline_t*)nde; if (px->in != XP_NULL && - px->in_type == XP_AWK_GETLINE_PIPE) + (px->in_type == XP_AWK_GETLINE_PIPE || + px->in_type == XP_AWK_GETLINE_COPROC)) { __print_expression (px->in); xp_printf (XP_T(" %s "), diff --git a/ase/awk/tree.h b/ase/awk/tree.h index 90080770..25d73448 100644 --- a/ase/awk/tree.h +++ b/ase/awk/tree.h @@ -1,5 +1,5 @@ /* - * $Id: tree.h,v 1.44 2006-06-13 15:11:39 bacon Exp $ + * $Id: tree.h,v 1.45 2006-06-18 10:53:06 bacon Exp $ */ #ifndef _XP_AWK_TREE_H_ @@ -60,12 +60,14 @@ enum enum { XP_AWK_GETLINE_PIPE, + XP_AWK_GETLINE_COPROC, XP_AWK_GETLINE_FILE }; enum { XP_AWK_PRINT_PIPE, + XP_AWK_PRINT_COPROC, XP_AWK_PRINT_FILE };