*** empty log message ***

This commit is contained in:
hyung-hwan 2006-04-22 16:16:40 +00:00
parent d53cc259a6
commit 1765ee450d
5 changed files with 51 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.54 2006-04-22 13:54:52 bacon Exp $
* $Id: awk.h,v 1.55 2006-04-22 16:16:40 bacon Exp $
*/
#ifndef _XP_AWK_AWK_H_
@ -52,10 +52,12 @@ enum
XP_AWK_ESRCINOPEN,
XP_AWK_ESRCINCLOSE,
XP_AWK_ESRCINNEXT,
XP_AWK_ESRCINDATA, /* error in reading source */
XP_AWK_ETXTINOPEN,
XP_AWK_ETXTINCLOSE,
XP_AWK_ETXTINNEXT,
XP_AWK_ETXTINDATA, /* error in reading text */
XP_AWK_ELXCHR, /* lexer came accross an wrong character */

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.13 2006-04-22 13:54:52 bacon Exp $
* $Id: err.c,v 1.14 2006-04-22 16:16:40 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -18,10 +18,12 @@ const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk)
XP_TEXT("cannot open source input"),
XP_TEXT("cannot close source input"),
XP_TEXT("cannot switch to next source input"),
XP_TEXT("cannot read source input"),
XP_TEXT("cannot open text input"),
XP_TEXT("cannot close text input"),
XP_TEXT("cannot switch to next text input"),
XP_TEXT("cannot read text input"),
XP_TEXT("invalid character"),

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.86 2006-04-22 13:54:52 bacon Exp $
* $Id: parse.c,v 1.87 2006-04-22 16:16:40 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -2269,26 +2269,27 @@ static xp_awk_nde_t* __parse_delete (xp_awk_t* awk)
static xp_awk_nde_t* __parse_next (xp_awk_t* awk)
{
xp_awk_nde_t* nde;
xp_awk_nde_next_t* nde;
nde = (xp_awk_nde_t*)xp_malloc(xp_sizeof(xp_awk_nde_t));
nde = (xp_awk_nde_next_t*) xp_malloc (xp_sizeof(xp_awk_nde_next_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_NEXT;
nde->next = XP_NULL;
return nde;
return (xp_awk_nde_t*)nde;
}
static xp_awk_nde_t* __parse_nextfile (xp_awk_t* awk)
{
xp_awk_nde_t* nde;
xp_awk_nde_nextfile_t* nde;
nde = (xp_awk_nde_t*)xp_malloc(xp_sizeof(xp_awk_nde_t));
nde = (xp_awk_nde_nextfile_t*)
xp_malloc (xp_sizeof(xp_awk_nde_nextfile_t));
if (nde == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
nde->type = XP_AWK_NDE_NEXTFILE;
nde->next = XP_NULL;
return nde;
return (xp_awk_nde_t*)nde;
}
static int __get_token (xp_awk_t* awk)

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c,v 1.68 2006-04-22 13:54:52 bacon Exp $
* $Id: run.c,v 1.69 2006-04-22 16:16:40 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -50,6 +50,8 @@ static int __run_break_statement (xp_awk_run_t* run, xp_awk_nde_break_t* nde);
static int __run_continue_statement (xp_awk_run_t* run, xp_awk_nde_continue_t* nde);
static int __run_return_statement (xp_awk_run_t* run, xp_awk_nde_return_t* nde);
static int __run_exit_statement (xp_awk_run_t* run, xp_awk_nde_exit_t* nde);
static int __run_next_statement (xp_awk_run_t* run, xp_awk_nde_next_t* nde);
static int __run_nextfile_statement (xp_awk_run_t* run, xp_awk_nde_nextfile_t* nde);
static xp_awk_val_t* __eval_expression (
xp_awk_run_t* run, xp_awk_nde_t* nde);
@ -570,11 +572,13 @@ static int __run_statement (xp_awk_run_t* run, xp_awk_nde_t* nde)
break;
case XP_AWK_NDE_NEXT:
/* TODO: */
if (__run_next_statement (
run, (xp_awk_nde_next_t*)nde) == -1) return -1;
break;
case XP_AWK_NDE_NEXTFILE:
/* TODO: */
if (__run_nextfile_statement (
run, (xp_awk_nde_nextfile_t*)nde) == -1) return -1;
break;
default:
@ -809,6 +813,20 @@ static int __run_exit_statement (xp_awk_run_t* run, xp_awk_nde_exit_t* nde)
return 0;
}
static int __run_next_statement (xp_awk_run_t* run, xp_awk_nde_next_t* nde)
{
/* TODO */
return -1;
}
static int __run_nextfile_statement (xp_awk_run_t* run, xp_awk_nde_nextfile_t* nde)
{
xp_ssize_t n;
n = run->txtio (XP_AWK_INPUT_NEXT, run->txtio_arg, XP_NULL, 0);
if (n == -1) PANIC_I (run, XP_AWK_ETXTINNEXT);
return (n == -1)? -1: 0;
}
static xp_awk_val_t* __eval_expression (xp_awk_run_t* run, xp_awk_nde_t* nde)
{
static eval_expr_t __eval_func[] =

View File

@ -1,5 +1,5 @@
/*
* $Id: tree.h,v 1.35 2006-04-18 16:04:59 bacon Exp $
* $Id: tree.h,v 1.36 2006-04-22 16:16:40 bacon Exp $
*/
#ifndef _XP_AWK_TREE_H_
@ -74,6 +74,8 @@ typedef struct xp_awk_nde_break_t xp_awk_nde_break_t;
typedef struct xp_awk_nde_continue_t xp_awk_nde_continue_t;
typedef struct xp_awk_nde_return_t xp_awk_nde_return_t;
typedef struct xp_awk_nde_exit_t xp_awk_nde_exit_t;
typedef struct xp_awk_nde_next_t xp_awk_nde_next_t;
typedef struct xp_awk_nde_nextfile_t xp_awk_nde_nextfile_t;
struct xp_awk_func_t
{
@ -229,6 +231,18 @@ struct xp_awk_nde_exit_t
xp_awk_nde_t* val; /* optional (no exit code if XP_NULL) */
};
/* XP_AWK_NDE_NEXT */
struct xp_awk_nde_next_t
{
XP_AWK_NDE_HDR;
};
/* XP_AWK_NDE_NEXTFILE */
struct xp_awk_nde_nextfile_t
{
XP_AWK_NDE_HDR;
};
#ifdef __cplusplus
extern "C" {
#endif