*** empty log message ***

This commit is contained in:
hyung-hwan 2006-06-21 11:45:26 +00:00
parent 7ab7d14036
commit adca6e86fb
10 changed files with 263 additions and 152 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.h,v 1.67 2006-06-20 15:27:50 bacon Exp $ * $Id: awk.h,v 1.68 2006-06-21 11:44:55 bacon Exp $
*/ */
#ifndef _XP_AWK_AWK_H_ #ifndef _XP_AWK_AWK_H_
@ -158,6 +158,7 @@ int xp_awk_run (xp_awk_t* awk, xp_awk_io_t txtio, void* txtio_arg);
xp_size_t xp_awk_getnargs (void* run); xp_size_t xp_awk_getnargs (void* run);
xp_awk_val_t* xp_awk_getarg (void* run, xp_size_t idx); xp_awk_val_t* xp_awk_getarg (void* run, xp_size_t idx);
void xp_awk_setretval (void* run, xp_awk_val_t* val); void xp_awk_setretval (void* run, xp_awk_val_t* val);
void xp_awk_seterrnum (void* run, int errnum);
/* utility functions exported by awk.h */ /* utility functions exported by awk.h */
xp_long_t xp_awk_strtolong ( xp_long_t xp_awk_strtolong (

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk_i.h,v 1.19 2006-06-20 15:27:50 bacon Exp $ * $Id: awk_i.h,v 1.20 2006-06-21 11:44:55 bacon Exp $
*/ */
#ifndef _XP_AWK_AWKI_H_ #ifndef _XP_AWK_AWKI_H_
@ -10,12 +10,6 @@ typedef struct xp_awk_run_t xp_awk_run_t;
typedef struct xp_awk_tree_t xp_awk_tree_t; typedef struct xp_awk_tree_t xp_awk_tree_t;
#include <xp/awk/awk.h> #include <xp/awk/awk.h>
#include <xp/awk/map.h>
#include <xp/awk/val.h>
#include <xp/awk/func.h>
#include <xp/awk/tree.h>
#include <xp/awk/tab.h>
#include <xp/awk/run.h>
#ifdef XP_AWK_STAND_ALONE #ifdef XP_AWK_STAND_ALONE
#include <xp/awk/sa.h> #include <xp/awk/sa.h>
@ -23,6 +17,14 @@ typedef struct xp_awk_tree_t xp_awk_tree_t;
#include <xp/bas/str.h> #include <xp/bas/str.h>
#endif #endif
#include <xp/awk/map.h>
#include <xp/awk/val.h>
#include <xp/awk/func.h>
#include <xp/awk/tree.h>
#include <xp/awk/tab.h>
#include <xp/awk/run.h>
#include <xp/awk/extio.h>
#if defined(_WIN32) && defined(XP_AWK_STAND_ALONE) && defined(_DEBUG) #if defined(_WIN32) && defined(XP_AWK_STAND_ALONE) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#include <crtdbg.h> #include <crtdbg.h>

25
ase/awk/extio.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef _XP_AWK_EXTIO_H_
#define _XP_AWK_EXTIO_H_
#ifndef _XP_AWK_AWK_H_
#error Never include this file directly. Include <xp/awk/awk.h> instead
#endif
#ifdef __cplusplus
extern "C"
#endif
int xp_awk_readextio (xp_awk_run_t* run,
xp_awk_extio_t** extio, xp_awk_io_t handler,
const xp_char_t* name, int* errnum);
int xp_awk_closeextio (xp_awk_run_t* run,
xp_awk_extio_t** extio, xp_awk_io_t handler,
const xp_char_t* name, int* errnum);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: func.c,v 1.2 2006-06-20 15:27:50 bacon Exp $ * $Id: func.c,v 1.3 2006-06-21 11:44:55 bacon Exp $
*/ */
#include <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -7,6 +7,7 @@
#ifndef XP_AWK_STAND_ALONE #ifndef XP_AWK_STAND_ALONE
#include <xp/bas/memory.h> #include <xp/bas/memory.h>
#include <xp/bas/string.h> #include <xp/bas/string.h>
#include <xp/bas/str.h>
#endif #endif
static int __bfn_close (void* run); static int __bfn_close (void* run);
@ -33,16 +34,48 @@ xp_awk_bfn_t* xp_awk_getbfn (const xp_char_t* name)
static int __bfn_close (void* run) static int __bfn_close (void* run)
{ {
xp_size_t nargs, i; xp_size_t nargs;
xp_str_t buf;
xp_awk_val_t* v;
int errnum, n;
nargs = xp_awk_getnargs (run); nargs = xp_awk_getnargs (run);
for (i = 0; i < nargs; i++) xp_assert (nargs == 1);
if (xp_str_open (&buf, 256) == XP_NULL)
{ {
xp_printf (XP_T("arg %d => "), (int)i); xp_awk_seterrnum (run, XP_AWK_ENOMEM);
xp_awk_printval (xp_awk_getarg (run, i)); return -1;
xp_printf (XP_T("\n"));
} }
xp_awk_setretval (run, xp_awk_makeintval(run,10)); if (xp_awk_valtostr (xp_awk_getarg(run, 0), &errnum, &buf) == XP_NULL)
{
xp_str_close (&buf);
xp_awk_seterrnum (run, errnum);
return -1;
}
/*
n = xp_awk_closeextio (run, XP_STR_BUF(&buf), &errnum);
if (n == -1 && errnum != XP_AWK_ENOERR)
{
xp_str_close (&buf);
xp_awk_seterrnum (run, errnum);
return -1;
}
*/
n = -1;
xp_printf (XP_T("closing %s\n"), XP_STR_BUF(&buf));
xp_str_close (&buf);
v = xp_awk_makeintval (run, n);
if (v == XP_NULL)
{
xp_awk_seterrnum (run, XP_AWK_ENOMEM);
return -1;
}
xp_awk_setretval (run, v);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: run.c,v 1.101 2006-06-20 15:27:50 bacon Exp $ * $Id: run.c,v 1.102 2006-06-21 11:44:55 bacon Exp $
*/ */
#include <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -147,7 +147,6 @@ static void __raw_pop_times (xp_awk_run_t* run, xp_size_t times);
static int __read_text_input (xp_awk_run_t* run); static int __read_text_input (xp_awk_run_t* run);
static int __val_to_num (xp_awk_val_t* v, xp_long_t* l, xp_real_t* r); static int __val_to_num (xp_awk_val_t* v, xp_long_t* l, xp_real_t* r);
static xp_char_t* __val_to_str (xp_awk_val_t* v, int* errnum, xp_str_t* buf);
static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde); static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde);
typedef xp_awk_val_t* (*binop_func_t) ( typedef xp_awk_val_t* (*binop_func_t) (
@ -182,6 +181,12 @@ void xp_awk_setretval (void* run, xp_awk_val_t* val)
xp_awk_refupval (val); xp_awk_refupval (val);
} }
void xp_awk_seterrnum (void* run, int errnum)
{
xp_awk_run_t* r = (xp_awk_run_t*)run;
r->errnum = errnum;
}
int xp_awk_run (xp_awk_t* awk, xp_awk_io_t txtio, void* txtio_arg) int xp_awk_run (xp_awk_t* awk, xp_awk_io_t txtio, void* txtio_arg)
{ {
xp_awk_run_t* run; xp_awk_run_t* run;
@ -545,7 +550,7 @@ static int __run_pattern_block_chain (xp_awk_run_t* run, xp_awk_chain_t* chain)
if (ptn->next == XP_NULL) if (ptn->next == XP_NULL)
{ {
if (xp_awk_boolval(v1)) if (xp_awk_valtobool(v1))
{ {
if (__run_block (run, (xp_awk_nde_blk_t*)chain->action) == -1) if (__run_block (run, (xp_awk_nde_blk_t*)chain->action) == -1)
{ {
@ -749,7 +754,7 @@ static int __run_if_statement (xp_awk_run_t* run, xp_awk_nde_if_t* nde)
if (test == XP_NULL) return -1; if (test == XP_NULL) return -1;
xp_awk_refupval (test); xp_awk_refupval (test);
if (xp_awk_boolval(test)) if (xp_awk_valtobool(test))
{ {
n = __run_statement (run, nde->then_part); n = __run_statement (run, nde->then_part);
} }
@ -780,7 +785,7 @@ static int __run_while_statement (xp_awk_run_t* run, xp_awk_nde_while_t* nde)
xp_awk_refupval (test); xp_awk_refupval (test);
if (xp_awk_boolval(test)) if (xp_awk_valtobool(test))
{ {
if (__run_statement(run,nde->body) == -1) if (__run_statement(run,nde->body) == -1)
{ {
@ -835,7 +840,7 @@ static int __run_while_statement (xp_awk_run_t* run, xp_awk_nde_while_t* nde)
xp_awk_refupval (test); xp_awk_refupval (test);
if (!xp_awk_boolval(test)) if (!xp_awk_valtobool(test))
{ {
xp_awk_refdownval (run, test); xp_awk_refdownval (run, test);
break; break;
@ -877,7 +882,7 @@ static int __run_for_statement (xp_awk_run_t* run, xp_awk_nde_for_t* nde)
if (test == XP_NULL) return -1; if (test == XP_NULL) return -1;
xp_awk_refupval (test); xp_awk_refupval (test);
if (xp_awk_boolval(test)) if (xp_awk_valtobool(test))
{ {
if (__run_statement(run,nde->body) == -1) if (__run_statement(run,nde->body) == -1)
{ {
@ -1448,7 +1453,7 @@ static xp_awk_val_t* __eval_binop_lor (
xp_awk_val_t* res = XP_NULL; xp_awk_val_t* res = XP_NULL;
res = xp_awk_makeintval (run, res = xp_awk_makeintval (run,
xp_awk_boolval(left) || xp_awk_boolval(right)); xp_awk_valtobool(left) || xp_awk_valtobool(right));
if (res == XP_NULL) PANIC (run, XP_AWK_ENOMEM); if (res == XP_NULL) PANIC (run, XP_AWK_ENOMEM);
return res; return res;
@ -1462,7 +1467,7 @@ static xp_awk_val_t* __eval_binop_lor (
if (lv == XP_NULL) return XP_NULL; if (lv == XP_NULL) return XP_NULL;
xp_awk_refupval (lv); xp_awk_refupval (lv);
if (xp_awk_boolval(lv)) if (xp_awk_valtobool(lv))
{ {
res = xp_awk_makeintval (run, 1); res = xp_awk_makeintval (run, 1);
} }
@ -1477,7 +1482,7 @@ static xp_awk_val_t* __eval_binop_lor (
} }
xp_awk_refupval (rv); xp_awk_refupval (rv);
res = xp_awk_makeintval (run, (xp_awk_boolval(rv)? 1: 0)); res = xp_awk_makeintval (run, (xp_awk_valtobool(rv)? 1: 0));
xp_awk_refdownval (run, rv); xp_awk_refdownval (run, rv);
} }
@ -1492,7 +1497,7 @@ static xp_awk_val_t* __eval_binop_land (
xp_awk_val_t* res = XP_NULL; xp_awk_val_t* res = XP_NULL;
res = xp_awk_makeintval (run, res = xp_awk_makeintval (run,
xp_awk_boolval(left) && xp_awk_boolval(right)); xp_awk_valtobool(left) && xp_awk_valtobool(right));
if (res == XP_NULL) PANIC (run, XP_AWK_ENOMEM); if (res == XP_NULL) PANIC (run, XP_AWK_ENOMEM);
return res; return res;
@ -1506,7 +1511,7 @@ static xp_awk_val_t* __eval_binop_land (
if (lv == XP_NULL) return XP_NULL; if (lv == XP_NULL) return XP_NULL;
xp_awk_refupval (lv); xp_awk_refupval (lv);
if (!xp_awk_boolval(lv)) if (!xp_awk_valtobool(lv))
{ {
res = xp_awk_makeintval (run, 0); res = xp_awk_makeintval (run, 0);
} }
@ -1521,7 +1526,7 @@ static xp_awk_val_t* __eval_binop_land (
} }
xp_awk_refupval (rv); xp_awk_refupval (rv);
res = xp_awk_makeintval (run, (xp_awk_boolval(rv)? 1: 0)); res = xp_awk_makeintval (run, (xp_awk_valtobool(rv)? 1: 0));
xp_awk_refdownval (run, rv); xp_awk_refdownval (run, rv);
} }
@ -2544,7 +2549,7 @@ static xp_awk_val_t* __eval_cnd (xp_awk_run_t* run, xp_awk_nde_t* nde)
xp_assert (cnd->left->next == XP_NULL && xp_assert (cnd->left->next == XP_NULL &&
cnd->right->next == XP_NULL); cnd->right->next == XP_NULL);
v = (xp_awk_boolval(tv))? v = (xp_awk_valtobool(tv))?
__eval_expression (run, cnd->left): __eval_expression (run, cnd->left):
__eval_expression (run, cnd->right); __eval_expression (run, cnd->right);
@ -2930,7 +2935,7 @@ static xp_awk_val_t* __eval_getline (xp_awk_run_t* run, xp_awk_nde_t* nde)
if (in == XP_NULL) return XP_NULL; if (in == XP_NULL) return XP_NULL;
xp_awk_refupval (in); xp_awk_refupval (in);
str = __val_to_str (in, &errnum, XP_NULL); str = xp_awk_valtostr (in, &errnum, XP_NULL);
if (str == XP_NULL) if (str == XP_NULL)
{ {
xp_awk_refdownval (run, in); xp_awk_refdownval (run, in);
@ -2961,7 +2966,7 @@ static xp_awk_val_t* __eval_getline (xp_awk_run_t* run, xp_awk_nde_t* nde)
if (in == XP_NULL) return XP_NULL; if (in == XP_NULL) return XP_NULL;
xp_awk_refupval (in); xp_awk_refupval (in);
str = __val_to_str (in, &errnum, XP_NULL); str = xp_awk_valtostr (in, &errnum, XP_NULL);
if (str == XP_NULL) if (str == XP_NULL)
{ {
xp_awk_refdownval (run, in); xp_awk_refdownval (run, in);
@ -3101,121 +3106,6 @@ static int __val_to_num (xp_awk_val_t* v, xp_long_t* l, xp_real_t* r)
return -1; /* error */ return -1; /* error */
} }
static xp_char_t* __val_to_str (xp_awk_val_t* v, int* errnum, xp_str_t* buf)
{
if (v->type == XP_AWK_VAL_INT)
{
xp_char_t* tmp;
xp_long_t t;
xp_size_t len = 0;
t = ((xp_awk_val_int_t*)v)->val;
if (t == 0)
{
/* handle zero */
if (buf == XP_NULL)
{
tmp = xp_malloc (2 * xp_sizeof(xp_char_t));
if (tmp == XP_NULL)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
tmp[0] = XP_T('0');
tmp[1] = XP_T('\0');
return tmp;
}
else
{
if (xp_str_cat (buf, XP_T("0")) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
return XP_STR_BUF(buf);
}
}
/* non-zero values */
if (t < 0) { t = -t; len++; }
while (t > 0) { len++; t /= 10; }
if (buf == XP_NULL)
{
tmp = xp_malloc (len + 1 * xp_sizeof(xp_char_t));
if (tmp == XP_NULL)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
tmp[len] = XP_T('\0');
}
else
{
/* get the current end of the buffer */
tmp = XP_STR_BUF(buf) + XP_STR_LEN(buf);
/* extend the buffer */
if (xp_str_nccat (
buf, XP_T(' '), len) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
}
t = ((xp_awk_val_int_t*)v)->val;
if (t < 0) t = -t;
while (t > 0)
{
tmp[--len] = (xp_char_t)(t % 10) + XP_T('0');
t /= 10;
}
if (((xp_awk_val_int_t*)v)->val < 0) tmp[--len] = XP_T('-');
/*return (buf == XP_NULL) tmp: XP_STR_BUF(buf);*/
return tmp;
}
if (v->type == XP_AWK_VAL_STR)
{
xp_char_t* tmp;
if (buf == XP_NULL)
{
tmp = xp_strxdup (
((xp_awk_val_str_t*)v)->buf,
((xp_awk_val_str_t*)v)->len);
if (tmp == XP_NULL) *errnum = XP_AWK_ENOMEM;
}
else
{
tmp = XP_STR_BUF(buf) + XP_STR_LEN(buf);
if (xp_str_ncat (buf,
((xp_awk_val_str_t*)v)->buf,
((xp_awk_val_str_t*)v)->len) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
tmp = XP_NULL;
}
}
return tmp;
}
/* TODO: process more value types */
*errnum = XP_AWK_EWRONGINDEX;
return XP_NULL;
}
static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde) static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde)
{ {
xp_char_t* str; xp_char_t* str;
@ -3232,7 +3122,7 @@ static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde)
xp_awk_refupval (idx); xp_awk_refupval (idx);
str = __val_to_str (idx, &errnum, XP_NULL); str = xp_awk_valtostr (idx, &errnum, XP_NULL);
if (str == XP_NULL) if (str == XP_NULL)
{ {
xp_awk_refdownval (run, idx); xp_awk_refdownval (run, idx);
@ -3271,7 +3161,7 @@ static xp_char_t* __idxnde_to_str (xp_awk_run_t* run, xp_awk_nde_t* nde)
PANIC (run, XP_AWK_ENOMEM); PANIC (run, XP_AWK_ENOMEM);
} }
if (__val_to_str (idx, &errnum, &idxstr) == XP_NULL) if (xp_awk_valtostr (idx, &errnum, &idxstr) == XP_NULL)
{ {
xp_awk_refdownval (run, idx); xp_awk_refdownval (run, idx);
xp_str_close (&idxstr); xp_str_close (&idxstr);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: val.c,v 1.30 2006-05-13 16:33:07 bacon Exp $ * $Id: val.c,v 1.31 2006-06-21 11:44:55 bacon Exp $
*/ */
#include <xp/awk/awk_i.h> #include <xp/awk/awk_i.h>
@ -299,7 +299,7 @@ xp_awk_val_t* xp_awk_cloneval (xp_awk_run_t* run, xp_awk_val_t* val)
return XP_NULL; return XP_NULL;
} }
xp_bool_t xp_awk_boolval (xp_awk_val_t* val) xp_bool_t xp_awk_valtobool (xp_awk_val_t* val)
{ {
if (val == XP_NULL) return xp_false; if (val == XP_NULL) return xp_false;
@ -321,6 +321,121 @@ xp_bool_t xp_awk_boolval (xp_awk_val_t* val)
return xp_false; return xp_false;
} }
xp_char_t* xp_awk_valtostr (xp_awk_val_t* v, int* errnum, xp_str_t* buf)
{
if (v->type == XP_AWK_VAL_INT)
{
xp_char_t* tmp;
xp_long_t t;
xp_size_t len = 0;
t = ((xp_awk_val_int_t*)v)->val;
if (t == 0)
{
/* handle zero */
if (buf == XP_NULL)
{
tmp = xp_malloc (2 * xp_sizeof(xp_char_t));
if (tmp == XP_NULL)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
tmp[0] = XP_T('0');
tmp[1] = XP_T('\0');
return tmp;
}
else
{
if (xp_str_cat (buf, XP_T("0")) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
return XP_STR_BUF(buf);
}
}
/* non-zero values */
if (t < 0) { t = -t; len++; }
while (t > 0) { len++; t /= 10; }
if (buf == XP_NULL)
{
tmp = xp_malloc (len + 1 * xp_sizeof(xp_char_t));
if (tmp == XP_NULL)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
tmp[len] = XP_T('\0');
}
else
{
/* get the current end of the buffer */
tmp = XP_STR_BUF(buf) + XP_STR_LEN(buf);
/* extend the buffer */
if (xp_str_nccat (
buf, XP_T(' '), len) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
return XP_NULL;
}
}
t = ((xp_awk_val_int_t*)v)->val;
if (t < 0) t = -t;
while (t > 0)
{
tmp[--len] = (xp_char_t)(t % 10) + XP_T('0');
t /= 10;
}
if (((xp_awk_val_int_t*)v)->val < 0) tmp[--len] = XP_T('-');
/*return (buf == XP_NULL) tmp: XP_STR_BUF(buf);*/
return tmp;
}
if (v->type == XP_AWK_VAL_STR)
{
xp_char_t* tmp;
if (buf == XP_NULL)
{
tmp = xp_strxdup (
((xp_awk_val_str_t*)v)->buf,
((xp_awk_val_str_t*)v)->len);
if (tmp == XP_NULL) *errnum = XP_AWK_ENOMEM;
}
else
{
tmp = XP_STR_BUF(buf) + XP_STR_LEN(buf);
if (xp_str_ncat (buf,
((xp_awk_val_str_t*)v)->buf,
((xp_awk_val_str_t*)v)->len) == (xp_size_t)-1)
{
*errnum = XP_AWK_ENOMEM;
tmp = XP_NULL;
}
}
return tmp;
}
/* TODO: process more value types */
*errnum = XP_AWK_EWRONGINDEX;
return XP_NULL;
}
static int __print_pair (xp_awk_pair_t* pair, void* arg) static int __print_pair (xp_awk_pair_t* pair, void* arg)
{ {
xp_printf (XP_T(" %s=>"), pair->key); xp_printf (XP_T(" %s=>"), pair->key);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: val.h,v 1.23 2006-06-20 15:27:50 bacon Exp $ * $Id: val.h,v 1.24 2006-06-21 11:44:55 bacon Exp $
*/ */
#ifndef _XP_AWK_VAL_H_ #ifndef _XP_AWK_VAL_H_
@ -110,7 +110,10 @@ void xp_awk_refdownval (xp_awk_run_t* run, xp_awk_val_t* val);
void xp_awk_refdownval_nofree (xp_awk_run_t* run, xp_awk_val_t* val); void xp_awk_refdownval_nofree (xp_awk_run_t* run, xp_awk_val_t* val);
xp_awk_val_t* xp_awk_cloneval (xp_awk_run_t* run, xp_awk_val_t* val); xp_awk_val_t* xp_awk_cloneval (xp_awk_run_t* run, xp_awk_val_t* val);
xp_bool_t xp_awk_boolval (xp_awk_val_t* val);
xp_bool_t xp_awk_valtobool (xp_awk_val_t* val);
xp_char_t* xp_awk_valtostr (xp_awk_val_t* val, int* errnum, xp_str_t* buf);
void xp_awk_printval (xp_awk_val_t* val); void xp_awk_printval (xp_awk_val_t* val);
#ifdef __cplusplus #ifdef __cplusplus

10
ase/test/awk/t10.awk Normal file
View File

@ -0,0 +1,10 @@
BEGIN
{
getline x < "abc"; /* open("abc", O_RDONLY|O_LARGEFILE) = 3 */
print 10 >> "abc"; /* open("abc", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = 4 */
getline x < "abc";
print x;
close ("abc"); /* close(4) */
print "hey"
close ("abc"); /* close(3) */
}

26
ase/test/awk/t9.awk Normal file
View File

@ -0,0 +1,26 @@
BEGIN
{
while (("xxx /p" | getline var) > 0) ;
while (("dir /w" | getline var) > 0) ;
while ((getline var < "t9.awk") > 0) ;
zzz = close ("xxx /p");
/*
while ("ls -l" | getline var)
{
"ls -l" | getline x;
print var; print x;
}
while (getline < "/etc/passwd")
{
print $0;
}
while (getline x < "/etc/shadow")
{
print x;
}
*/
}

6
ase/test/awk/x.awk Normal file
View File

@ -0,0 +1,6 @@
BEGIN
{
print 1
|
"test";
}