diff --git a/ase/awk/awk.h b/ase/awk/awk.h index 7a7fac3e..78c65735 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.89 2006-08-04 17:36:40 bacon Exp $ + * $Id: awk.h,v 1.90 2006-08-04 17:54:52 bacon Exp $ */ #ifndef _XP_AWK_AWK_H_ @@ -12,6 +12,7 @@ typedef struct xp_awk_t xp_awk_t; typedef struct xp_awk_val_t xp_awk_val_t; typedef struct xp_awk_extio_t xp_awk_extio_t; +typedef struct xp_awk_srcios_t xp_awk_srcios_t; typedef struct xp_awk_runios_t xp_awk_runios_t; typedef struct xp_awk_runcbs_t xp_awk_runcbs_t; @@ -39,6 +40,13 @@ struct xp_awk_extio_t xp_awk_extio_t* next; }; +struct xp_awk_srcios_t +{ + xp_awk_io_t in; + xp_awk_io_t out; + void* custom_data; +}; + struct xp_awk_runios_t { xp_awk_io_t pipe; @@ -233,10 +241,10 @@ xp_size_t xp_awk_getsrcline (xp_awk_t* awk); int xp_awk_setextio (xp_awk_t* awk, int id, xp_awk_io_t handler, void* arg); -int xp_awk_parse (xp_awk_t* awk); +int xp_awk_parse (xp_awk_t* awk, xp_awk_srcios_t* srcios); int xp_awk_run (xp_awk_t* awk, - xp_awk_runcbs_t* runcbs, xp_awk_runios_t* runios); + xp_awk_runios_t* runios, xp_awk_runcbs_t* runcbs); int xp_awk_stop (xp_awk_t* awk, void* run); diff --git a/ase/awk/parse.c b/ase/awk/parse.c index 9d09f4d5..c8967802 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.158 2006-08-04 17:36:40 bacon Exp $ + * $Id: parse.c,v 1.159 2006-08-04 17:54:52 bacon Exp $ */ #include @@ -408,8 +408,9 @@ static void __dump (xp_awk_t* awk) } } -int xp_awk_parse (xp_awk_t* awk) +int xp_awk_parse (xp_awk_t* awk, xp_awk_srcios_t* srcios) { +/* TODO: switch to srcios */ if (awk->srcio == XP_NULL) { /* the source code io handler is not set */ diff --git a/ase/awk/run.c b/ase/awk/run.c index 2a0ff33e..b43a6d74 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.162 2006-08-04 17:36:40 bacon Exp $ + * $Id: run.c,v 1.163 2006-08-04 17:54:52 bacon Exp $ */ #include @@ -222,7 +222,7 @@ void xp_awk_seterrnum (void* run, int errnum) r->errnum = errnum; } -int xp_awk_run (xp_awk_t* awk, xp_awk_runcbs_t* runcbs, xp_awk_runios_t* runios) +int xp_awk_run (xp_awk_t* awk, xp_awk_runios_t* runios, xp_awk_runcbs_t* runcbs) { xp_awk_run_t* run; int n; diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index aa23eb43..abf10a15 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.66 2006-08-04 17:36:40 bacon Exp $ + * $Id: awk.c,v 1.67 2006-08-04 17:54:52 bacon Exp $ */ #include @@ -514,6 +514,7 @@ static int __main (int argc, xp_char_t* argv[]) #endif { xp_awk_t* awk; + xp_awk_srcios_t srcios; xp_awk_runcbs_t runcbs; xp_awk_runios_t runios; struct src_io src_io = { NULL, NULL }; @@ -606,7 +607,11 @@ static int __main (int argc, xp_char_t* argv[]) return -1; } - if (xp_awk_parse(awk) == -1) + srcios.in = process_source; + srcios.out = XP_NULL; + srcios.custom_data = XP_NULL; + + if (xp_awk_parse (awk, &srcios) == -1) { #if defined(__STAND_ALONE) && !defined(_WIN32) && defined(XP_CHAR_IS_WCHAR) xp_printf ( @@ -634,17 +639,17 @@ static int __main (int argc, xp_char_t* argv[]) signal (SIGINT, __stop_run); - runcbs.start = __on_run_start; - runcbs.end = __on_run_end; - runcbs.custom_data = XP_NULL; - runios.pipe = process_extio_pipe; runios.coproc = XP_NULL; runios.file = process_extio_file; runios.console = process_extio_console; runios.custom_data = XP_NULL; - if (xp_awk_run (awk, &runcbs, &runios) == -1) + runcbs.start = __on_run_start; + runcbs.end = __on_run_end; + runcbs.custom_data = XP_NULL; + + if (xp_awk_run (awk, &runios, &runcbs) == -1) { #if defined(__STAND_ALONE) && !defined(_WIN32) && defined(XP_CHAR_IS_WCHAR) xp_printf (