*** empty log message ***
This commit is contained in:
parent
e144c0ac29
commit
ef1059528f
@ -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);
|
||||
|
||||
|
@ -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 <xp/awk/awk_i.h>
|
||||
@ -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 */
|
||||
|
@ -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 <xp/awk/awk_i.h>
|
||||
@ -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;
|
||||
|
@ -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 <xp/awk/awk.h>
|
||||
@ -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 (
|
||||
|
Loading…
x
Reference in New Issue
Block a user