*** empty log message ***

This commit is contained in:
hyung-hwan 2006-06-18 10:53:06 +00:00
parent be264c5638
commit 6eb78194c1
7 changed files with 59 additions and 11 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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 <xp/awk/awk_i.h>
@ -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"),

View File

@ -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 <xp/awk/awk_i.h>
@ -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);

View File

@ -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 <xp/awk/awk_i.h>
@ -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

View File

@ -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 <xp/awk/awk_i.h>
@ -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 "),

View File

@ -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
};