From 3079f4aac4512576da535378561e873ce7103bfe Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 31 Mar 2006 16:35:37 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/awk.c | 35 ++++++----- ase/awk/awk.h | 126 +-------------------------------------- ase/awk/awk_i.h | 106 ++++++++++++++++++++++++++++++++ ase/awk/err.c | 4 +- ase/awk/map.c | 4 +- ase/awk/parse.c | 47 +++++++++++++-- ase/awk/run.c | 4 +- ase/awk/sa.c | 4 +- ase/awk/sa.h | 92 ++++++++++++---------------- ase/awk/tab.c | 4 +- ase/awk/tree.c | 4 +- ase/awk/val.c | 4 +- ase/test/awk/Makefile.cl | 6 +- ase/test/awk/awk.c | 32 ++++++---- 14 files changed, 244 insertions(+), 228 deletions(-) create mode 100644 ase/awk/awk_i.h diff --git a/ase/awk/awk.c b/ase/awk/awk.c index 9cab8131..6adccec7 100644 --- a/ase/awk/awk.c +++ b/ase/awk/awk.c @@ -1,8 +1,8 @@ /* - * $Id: awk.c,v 1.36 2006-03-29 16:37:31 bacon Exp $ + * $Id: awk.c,v 1.37 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include @@ -12,30 +12,28 @@ static void __free_func (xp_awk_t* awk, void* func); static void __free_namedval (xp_awk_t* awk, void* val); -xp_awk_t* xp_awk_open (xp_awk_t* awk) +xp_awk_t* xp_awk_open (void) { - if (awk == XP_NULL) { - awk = (xp_awk_t*) xp_malloc (xp_sizeof(awk)); - if (awk == XP_NULL) return XP_NULL; - awk->__dynamic = xp_true; - } - else awk->__dynamic = xp_false; + xp_awk_t* awk; + + awk = (xp_awk_t*) xp_malloc (xp_sizeof(awk)); + if (awk == XP_NULL) return XP_NULL; if (xp_str_open(&awk->token.name, 128) == XP_NULL) { - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } if (xp_awk_map_open (&awk->tree.funcs, awk, 256, __free_func) == XP_NULL) { xp_str_close (&awk->token.name); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } if (xp_awk_tab_open(&awk->parse.globals) == XP_NULL) { xp_str_close (&awk->token.name); xp_awk_map_close (&awk->tree.funcs); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } @@ -43,7 +41,7 @@ xp_awk_t* xp_awk_open (xp_awk_t* awk) xp_str_close (&awk->token.name); xp_awk_map_close (&awk->tree.funcs); xp_awk_tab_close (&awk->parse.globals); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } @@ -52,7 +50,7 @@ xp_awk_t* xp_awk_open (xp_awk_t* awk) xp_awk_map_close (&awk->tree.funcs); xp_awk_tab_close (&awk->parse.globals); xp_awk_tab_close (&awk->parse.locals); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } @@ -63,7 +61,7 @@ xp_awk_t* xp_awk_open (xp_awk_t* awk) xp_awk_tab_close (&awk->parse.globals); xp_awk_tab_close (&awk->parse.locals); xp_awk_tab_close (&awk->parse.params); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return XP_NULL; } @@ -112,7 +110,7 @@ int xp_awk_close (xp_awk_t* awk) xp_awk_tab_close (&awk->parse.params); xp_str_close (&awk->token.name); - if (awk->__dynamic) xp_free (awk); + xp_free (awk); return 0; } @@ -157,6 +155,11 @@ void xp_awk_clear (xp_awk_t* awk) /* TODO: destroy function list */ } +void xp_awk_setparseopt (xp_awk_t* awk, int opt) +{ + awk->opt.parse = opt; +} + int xp_awk_attsrc (xp_awk_t* awk, xp_awk_io_t src, void* arg) { if (xp_awk_detsrc(awk) == -1) return -1; diff --git a/ase/awk/awk.h b/ase/awk/awk.h index 627c920f..a22e0954 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,34 +1,15 @@ /* - * $Id: awk.h,v 1.38 2006-03-28 16:33:09 bacon Exp $ + * $Id: awk.h,v 1.39 2006-03-31 16:35:37 bacon Exp $ */ #ifndef _XP_AWK_AWK_H_ #define _XP_AWK_AWK_H_ -#ifdef __STAND_ALONE -#include -#else #include #include -#include -#endif -/* - * TYPE: xp_awk_t - */ typedef struct xp_awk_t xp_awk_t; -typedef struct xp_awk_chain_t xp_awk_chain_t; -#include -#include -#include -#include -#include -#include - -/* - * TYPE: xp_awk_io_t - */ typedef xp_ssize_t (*xp_awk_io_t) ( int cmd, void* arg, xp_char_t* data, xp_size_t count); @@ -50,124 +31,23 @@ enum XP_AWK_SHIFT = (1 << 4) /* support shift operators */ }; -struct xp_awk_t -{ - /* options */ - struct - { - int parse; - int run; - } opt; - - /* io functions */ - xp_awk_io_t src_func; - xp_awk_io_t in_func; - xp_awk_io_t out_func; - - void* src_arg; - void* in_arg; - void* out_arg; - - /* parse tree */ - struct - { - xp_size_t nglobals; - xp_awk_map_t funcs; - xp_awk_nde_t* begin; - xp_awk_nde_t* end; - xp_awk_chain_t* chain; - xp_awk_chain_t* chain_tail; - } tree; - - /* temporary information that the parser needs */ - struct - { - xp_awk_tab_t globals; - xp_awk_tab_t locals; - xp_awk_tab_t params; - xp_size_t nlocals_max; - } parse; - - /* run-time data structure */ - struct - { - xp_awk_map_t named; - - void** stack; - xp_size_t stack_top; - xp_size_t stack_base; - xp_size_t stack_limit; - int exit_level; - - xp_awk_val_int_t* icache[100]; // TODO: ... - xp_awk_val_real_t* rcache[100]; // TODO: ... - xp_size_t icache_count; - xp_size_t rcache_count; - } run; - - /* source buffer management */ - struct - { - xp_cint_t curc; - xp_cint_t ungotc[5]; - xp_size_t ungotc_count; - } lex; - - /* token */ - struct - { - int type; - xp_str_t name; - } token; - - /* housekeeping */ - int errnum; - xp_bool_t __dynamic; -}; - -struct xp_awk_chain_t -{ - xp_awk_nde_t* pattern; - xp_awk_nde_t* action; - xp_awk_chain_t* next; -}; - #ifdef __cplusplus extern "C" { #endif -/* - * FUNCTION: xp_awk_open - */ -xp_awk_t* xp_awk_open (xp_awk_t* awk); - -/* - * FUNCTION: xp_awk_close - */ +xp_awk_t* xp_awk_open (void); int xp_awk_close (xp_awk_t* awk); - int xp_awk_geterrnum (xp_awk_t* awk); const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk); -/* - * FUNCTION: xp_awk_clear - */ void xp_awk_clear (xp_awk_t* awk); +void xp_awk_setparseopt (xp_awk_t* awk, int opt); -/* - * FUNCTION: xp_awk_attsrc - */ int xp_awk_attsrc (xp_awk_t* awk, xp_awk_io_t src, void* arg); - -/* - * FUNCTION: xp_awk_detsrc - */ int xp_awk_detsrc (xp_awk_t* awk); - int xp_awk_attin (xp_awk_t* awk, xp_awk_io_t in, void* arg); int xp_awk_detin (xp_awk_t* awk); - int xp_awk_attout (xp_awk_t* awk, xp_awk_io_t out, void* arg); int xp_awk_detout (xp_awk_t* awk); diff --git a/ase/awk/awk_i.h b/ase/awk/awk_i.h new file mode 100644 index 00000000..0529a65e --- /dev/null +++ b/ase/awk/awk_i.h @@ -0,0 +1,106 @@ +/* + * $Id: awk_i.h,v 1.1 2006-03-31 16:35:37 bacon Exp $ + */ + +#ifndef _XP_AWK_AWKI_H_ +#define _XP_AWK_AWKI_H_ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __STAND_ALONE +#include +#else +#include +#endif + +typedef struct xp_awk_chain_t xp_awk_chain_t; + +struct xp_awk_t +{ + /* options */ + struct + { + int parse; + int run; + } opt; + + /* io functions */ + xp_awk_io_t src_func; + xp_awk_io_t in_func; + xp_awk_io_t out_func; + + void* src_arg; + void* in_arg; + void* out_arg; + + /* parse tree */ + struct + { + xp_size_t nglobals; + xp_awk_map_t funcs; + xp_awk_nde_t* begin; + xp_awk_nde_t* end; + xp_awk_chain_t* chain; + xp_awk_chain_t* chain_tail; + } tree; + + /* temporary information that the parser needs */ + struct + { + xp_awk_tab_t globals; + xp_awk_tab_t locals; + xp_awk_tab_t params; + xp_size_t nlocals_max; + } parse; + + /* run-time data structure */ + struct + { + xp_awk_map_t named; + + void** stack; + xp_size_t stack_top; + xp_size_t stack_base; + xp_size_t stack_limit; + int exit_level; + + xp_awk_val_int_t* icache[100]; // TODO: ... + xp_awk_val_real_t* rcache[100]; // TODO: ... + xp_size_t icache_count; + xp_size_t rcache_count; + } run; + + /* source buffer management */ + struct + { + xp_cint_t curc; + xp_cint_t ungotc[5]; + xp_size_t ungotc_count; + } lex; + + /* token */ + struct + { + int type; + xp_str_t name; + } token; + + /* housekeeping */ + int errnum; + xp_bool_t __dynamic; +}; + +struct xp_awk_chain_t +{ + xp_awk_nde_t* pattern; + xp_awk_nde_t* action; + xp_awk_chain_t* next; +}; + +#endif diff --git a/ase/awk/err.c b/ase/awk/err.c index 04b6544d..2ed0fcba 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,8 +1,8 @@ /* - * $Id: err.c,v 1.1 2006-03-04 10:08:13 bacon Exp $ + * $Id: err.c,v 1.2 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include int xp_awk_geterrnum (xp_awk_t* awk) { diff --git a/ase/awk/map.c b/ase/awk/map.c index 75f0b00f..c8636102 100644 --- a/ase/awk/map.c +++ b/ase/awk/map.c @@ -1,8 +1,8 @@ /* - * $Id: map.c,v 1.8 2006-03-27 14:14:00 bacon Exp $ + * $Id: map.c,v 1.9 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include diff --git a/ase/awk/parse.c b/ase/awk/parse.c index 25f44684..ea0d73af 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,8 +1,8 @@ /* - * $Id: parse.c,v 1.66 2006-03-31 12:04:14 bacon Exp $ + * $Id: parse.c,v 1.67 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include @@ -137,6 +137,7 @@ static xp_awk_nde_t* __parse_break (xp_awk_t* awk); static xp_awk_nde_t* __parse_continue (xp_awk_t* awk); static xp_awk_nde_t* __parse_return (xp_awk_t* awk); static xp_awk_nde_t* __parse_exit (xp_awk_t* awk); +static xp_awk_nde_t* __parse_delete (xp_awk_t* awk); static xp_awk_nde_t* __parse_next (xp_awk_t* awk); static xp_awk_nde_t* __parse_nextfile (xp_awk_t* awk); @@ -944,13 +945,11 @@ static xp_awk_nde_t* __parse_statement_nb (xp_awk_t* awk) if (__get_token(awk) == -1) return XP_NULL; nde = __parse_exit(awk); } -/* TODO: else if (MATCH(awk,TOKEN_DELETE)) { if (__get_token(awk) == -1) return XP_NULL; nde = __parse_delete(awk); } -*/ else if (MATCH(awk,TOKEN_NEXT)) { if (__get_token(awk) == -1) return XP_NULL; @@ -1088,8 +1087,40 @@ static xp_awk_nde_t* __parse_binary_expr ( return XP_NULL; } - // TODO: constant folding -> in other parts of the program also... + /* TODO: enhance constant folding. do it in a better way */ + /* TODO: differentiate different types of numbers ... */ + if (left->type == XP_AWK_NDE_INT && + right->type == XP_AWK_NDE_INT) + { + xp_long_t l, r; + l = ((xp_awk_nde_int_t*)left)->val; + r = ((xp_awk_nde_int_t*)right)->val; + + /* TODO: more operators */ + if (opcode == XP_AWK_BINOP_PLUS) l += r; + else if (opcode == XP_AWK_BINOP_MINUS) l -= r; + else if (opcode == XP_AWK_BINOP_MUL) l *= r; + else if (opcode == XP_AWK_BINOP_DIV) l /= r; + else if (opcode == XP_AWK_BINOP_MOD) l %= r; + else goto skip_constant_folding; + + xp_awk_clrpt (right); + ((xp_awk_nde_int_t*)left)->val = l; + continue; + } + /* TODO: + else if (left->type == XP_AWK_NDE_REAL && + right->type == XP_AWK_NDE_REAL) + { + } + else if (left->type == XP_AWK_NDE_STR && + right->type == XP_AWK_NDE_STR) + { + // TODO: string concatenation operator.... + } */ + + skip_constant_folding: nde = (xp_awk_nde_exp_t*)xp_malloc(xp_sizeof(xp_awk_nde_exp_t)); if (nde == XP_NULL) { @@ -2081,6 +2112,12 @@ static xp_awk_nde_t* __parse_exit (xp_awk_t* awk) return (xp_awk_nde_t*)nde; } +static xp_awk_nde_t* __parse_delete (xp_awk_t* awk) +{ +// TODO: implement this... + return XP_NULL; +} + static xp_awk_nde_t* __parse_next (xp_awk_t* awk) { xp_awk_nde_t* nde; diff --git a/ase/awk/run.c b/ase/awk/run.c index 85fa5349..e75dba76 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,8 +1,8 @@ /* - * $Id: run.c,v 1.27 2006-03-30 16:31:50 bacon Exp $ + * $Id: run.c,v 1.28 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include diff --git a/ase/awk/sa.c b/ase/awk/sa.c index 886aaf23..89609e0f 100644 --- a/ase/awk/sa.c +++ b/ase/awk/sa.c @@ -1,8 +1,8 @@ /* - * $Id: sa.c,v 1.12 2006-03-31 12:04:14 bacon Exp $ + * $Id: sa.c,v 1.13 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifdef __STAND_ALONE diff --git a/ase/awk/sa.h b/ase/awk/sa.h index f74b9626..d84f78eb 100644 --- a/ase/awk/sa.h +++ b/ase/awk/sa.h @@ -1,5 +1,5 @@ /* - * $Id: sa.h,v 1.16 2006-03-31 12:04:14 bacon Exp $ + * $Id: sa.h,v 1.17 2006-03-31 16:35:37 bacon Exp $ */ #ifndef _XP_AWK_SA_H_ @@ -59,59 +59,6 @@ #define xp_va_end(pvar) va_end(pvar) #define xp_va_arg(pvar,type) va_arg(pvar,type) -#define xp_main main - -#define XP_NULL NULL - -#define xp_sizeof(n) (sizeof(n)) -#define xp_countof(n) (sizeof(n) / sizeof(n[0])) - -#define xp_true (0 == 0) -#define xp_false (0 != 0) - -typedef unsigned char xp_byte_t; -typedef int xp_bool_t; -typedef size_t xp_size_t; - -#ifdef XP_CHAR_IS_MCHAR - typedef char xp_char_t; - typedef int xp_cint_t; -#else - typedef wchar_t xp_char_t; - typedef wint_t xp_cint_t; -#endif - -#if defined(_WIN32) || defined(vms) || defined(__vms) - typedef long xp_ssize_t; -#else - typedef ssize_t xp_ssize_t; -#endif - -#if defined(_WIN32) - typedef __int64 xp_long_t; - typedef long double xp_real_t; -#elif defined(vax) || defined(__vax) - typedef long xp_long_t; - typedef long double xp_real_t; -#else - typedef long long xp_long_t; - typedef long double xp_real_t; -#endif - -#ifdef XP_CHAR_IS_MCHAR - #define XP_CHAR(c) c - #define XP_TEXT(c) c - #define XP_CHAR_EOF EOF -#else - #define XP_CHAR(c) L##c - #define XP_TEXT(c) L##c - #ifdef WEOF - #define XP_CHAR_EOF WEOF - #else - #define XP_CHAR_EOF ((xp_char_t)-1) - #endif -#endif - #define XP_STR_LEN(x) ((x)->size) #define XP_STR_SIZE(x) ((x)->size + 1) #define XP_STR_CAPA(x) ((x)->capa) @@ -131,29 +78,64 @@ struct xp_str_t extern "C" { #endif +#define xp_strlen xp_awk_strlen xp_size_t xp_strlen (const xp_char_t* str); + +#define xp_strdup xp_awk_strdup xp_char_t* xp_strdup (const xp_char_t* str); + +#define xp_strxdup xp_awk_strxdup xp_char_t* xp_strxdup (const xp_char_t* str, xp_size_t len); +#define xp_strcpy xp_awk_strcpy xp_size_t xp_strcpy (xp_char_t* buf, const xp_char_t* str); + +#define xp_strxncpy xp_awk_strxncpy xp_size_t xp_strxncpy ( xp_char_t* buf, xp_size_t bsz, const xp_char_t* str, xp_size_t len); +#define xp_strcmp xp_awk_strcmp int xp_strcmp (const xp_char_t* s1, const xp_char_t* s2); + +#define xp_strtolong xp_awk_strtolong xp_long_t xp_strtolong (xp_char_t* str); + +#define xp_strtoreal xp_awk_strtoreal xp_real_t xp_strtoreal (xp_char_t* str); +#define xp_printf xp_awk_printf int xp_printf (const xp_char_t* fmt, ...); + +#define xp_vprintf xp_awk_vprintf int xp_vprintf (const xp_char_t* fmt, xp_va_list ap); -int xp_sprintf (xp_char_t* buf, xp_size_t size, const xp_char_t* fmt, ...); + +#define xp_sprintf xp_awk_sprintf +int xp_sprintf ( + xp_char_t* buf, xp_size_t size, const xp_char_t* fmt, ...); + +#define xp_vsprintf xp_awk_vsprintf int xp_vsprintf ( xp_char_t* buf, xp_size_t size, const xp_char_t* fmt, xp_va_list ap); +#define xp_str_open xp_awk_str_open xp_str_t* xp_str_open (xp_str_t* str, xp_size_t capa); + +#define xp_str_close xp_awk_str_close void xp_str_close (xp_str_t* str); + +#define xp_str_forfeit xp_awk_str_forfeit +void xp_str_forfeit (xp_str_t* str); + +#define xp_str_cat xp_awk_str_cat xp_size_t xp_str_cat (xp_str_t* str, const xp_char_t* s); + +#define xp_str_ncat xp_awk_str_ncat xp_size_t xp_str_ncat (xp_str_t* str, const xp_char_t* s, xp_size_t len); + +#define xp_str_ccat xp_awk_str_ccat xp_size_t xp_str_ccat (xp_str_t* str, xp_char_t c); + +#define xp_str_clear xp_awk_str_clear void xp_str_clear (xp_str_t* str); #ifdef __cplusplus diff --git a/ase/awk/tab.c b/ase/awk/tab.c index 19092969..30d72ece 100644 --- a/ase/awk/tab.c +++ b/ase/awk/tab.c @@ -1,8 +1,8 @@ /* - * $Id: tab.c,v 1.6 2006-03-07 15:55:14 bacon Exp $ + * $Id: tab.c,v 1.7 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include diff --git a/ase/awk/tree.c b/ase/awk/tree.c index 6020f4d1..e2def01a 100644 --- a/ase/awk/tree.c +++ b/ase/awk/tree.c @@ -1,8 +1,8 @@ /* - * $Id: tree.c,v 1.29 2006-03-31 12:04:14 bacon Exp $ + * $Id: tree.c,v 1.30 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include diff --git a/ase/awk/val.c b/ase/awk/val.c index 9f8f10d3..e08c6b9b 100644 --- a/ase/awk/val.c +++ b/ase/awk/val.c @@ -1,8 +1,8 @@ /* - * $Id: val.c,v 1.13 2006-03-28 16:33:09 bacon Exp $ + * $Id: val.c,v 1.14 2006-03-31 16:35:37 bacon Exp $ */ -#include +#include #ifndef __STAND_ALONE #include diff --git a/ase/test/awk/Makefile.cl b/ase/test/awk/Makefile.cl index 0e8dc255..ac53ef07 100644 --- a/ase/test/awk/Makefile.cl +++ b/ase/test/awk/Makefile.cl @@ -1,9 +1,9 @@ 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 -DXP_CHAR_IS_WCHAR +CFLAGS = /nologo /MT /W3 /GR- /D_WIN32_WINNT=0x0400 -I..\..\.. LDFLAGS = /libpath:..\..\bas /libpath:..\..\awk -#LIBS = xpbas.lib xpawk.lib -LIBS = xpawk.lib +LIBS = xpbas.lib xpawk.lib +#LIBS = xpawk.lib all: awk diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index 0d0561d2..21480e7c 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,4 +1,10 @@ +/* + * $Id: awk.c,v 1.14 2006-03-31 16:35:37 bacon Exp $ + */ + #include +#include +#include #ifdef __STAND_ALONE @@ -62,7 +68,7 @@ int xp_main (int argc, xp_char_t* argv[]) int xp_main (int argc, char* argv[]) #endif { - xp_awk_t awk; + xp_awk_t* awk; #ifdef __linux mtrace (); @@ -75,35 +81,37 @@ int xp_main (int argc, char* argv[]) } #endif - if (xp_awk_open(&awk) == XP_NULL) { + if ((awk = xp_awk_open()) == XP_NULL) { xp_printf (XP_TEXT("Error: cannot open awk\n")); return -1; } - if (xp_awk_attsrc(&awk, process_source, XP_NULL) == -1) { - xp_awk_close (&awk); + if (xp_awk_attsrc(awk, process_source, XP_NULL) == -1) { + xp_awk_close (awk); xp_printf (XP_TEXT("error: cannot attach source\n")); return -1; } -awk.opt.parse = XP_AWK_EXPLICIT | XP_AWK_UNIQUE | XP_AWK_SHADING | XP_AWK_IMPLICIT; + xp_awk_setparseopt (awk, + XP_AWK_EXPLICIT | XP_AWK_UNIQUE | + XP_AWK_SHADING | XP_AWK_IMPLICIT); - if (xp_awk_parse(&awk) == -1) { + if (xp_awk_parse(awk) == -1) { xp_printf ( XP_TEXT("error: cannot parse program - [%d] %s\n"), - xp_awk_geterrnum(&awk), xp_awk_geterrstr(&awk)); - xp_awk_close (&awk); + xp_awk_geterrnum(awk), xp_awk_geterrstr(awk)); + xp_awk_close (awk); return -1; } - if (xp_awk_run(&awk) == -1) { + if (xp_awk_run(awk) == -1) { xp_printf ( XP_TEXT("error: cannot run program - [%d] %s\n"), - xp_awk_geterrnum(&awk), xp_awk_geterrstr(&awk)); - xp_awk_close (&awk); + xp_awk_geterrnum(awk), xp_awk_geterrstr(awk)); + xp_awk_close (awk); } - xp_awk_close (&awk); + xp_awk_close (awk); #ifdef __linux muntrace ();