diff --git a/ase/awk/Makefile.cl b/ase/awk/Makefile.cl index e4887846..f508c659 100644 --- a/ase/awk/Makefile.cl +++ b/ase/awk/Makefile.cl @@ -1,4 +1,4 @@ -SRCS = awk.c parse.c tree.c sa.c +SRCS = awk.c tree.c parse.c run.c sa.c OBJS = $(SRCS:.c=.obj) OUT = xpawk.lib diff --git a/ase/awk/Makefile.lcc b/ase/awk/Makefile.lcc index 9b61d25f..65feba73 100644 --- a/ase/awk/Makefile.lcc +++ b/ase/awk/Makefile.lcc @@ -1,5 +1,5 @@ -SRCS = awk.c parse.c tree.c -OBJS = awk.obj parse.obj tree.obj +SRCS = awk.c tree.c parse.c run.c sa.c +OBJS = awk.obj tree.obj parse.obj run.obj tree.obj OUT = xpawk.lib CC = lcc diff --git a/ase/awk/awk.h b/ase/awk/awk.h index a3f4d627..aaabcf0b 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.19 2006-01-25 16:11:43 bacon Exp $ + * $Id: awk.h,v 1.20 2006-01-26 15:35:20 bacon Exp $ */ #ifndef _XP_AWK_AWK_H_ @@ -155,6 +155,7 @@ int xp_awk_attout (xp_awk_t* awk, xp_awk_io_t out, void* arg); int xp_awk_detout (xp_awk_t* awk); int xp_awk_parse (xp_awk_t* awk); +int xp_awk_run (xp_awk_t* awk); #ifdef __cplusplus } diff --git a/ase/awk/makefile.in b/ase/awk/makefile.in index 92f169ef..14d2a109 100644 --- a/ase/awk/makefile.in +++ b/ase/awk/makefile.in @@ -1,4 +1,4 @@ -SRCS = awk.c parse.c tree.c sa.c +SRCS = awk.c tree.c parse.c run.c sa.c OBJS = $(SRCS:.c=.o) OUT = libxpawk.a diff --git a/ase/awk/run.c b/ase/awk/run.c new file mode 100644 index 00000000..819d2212 --- /dev/null +++ b/ase/awk/run.c @@ -0,0 +1,45 @@ +/* + * $Id: run.c,v 1.1 2006-01-26 15:35:20 bacon Exp $ + */ + +#include +#ifndef __STAND_ALONE +#include +#endif + +static int __run_block (xp_awk_t* awk, xp_awk_node_t* node); +static int __run_statement (xp_awk_t* awk, xp_awk_node_t* node); + +int xp_awk_run (xp_awk_t* awk) +{ + if (awk->tree.begin != XP_NULL) { + if (__run_block(awk, awk->tree.begin) == -1) return -1; + } + + if (awk->tree.end != XP_NULL) { + if (__run_block(awk, awk->tree.end) == -1) return -1; + } + + return 0; +} + +static int __run_block (xp_awk_t* awk, xp_awk_node_t* node) +{ + xp_assert (node->type == XP_AWK_NODE_BLOCK); + return -1; +} + +static int __run_statement (xp_awk_t* awk, xp_awk_node_t* node) +{ + switch (node->type) { + case XP_AWK_NODE_BLOCK: + if (__run_block(awk, node) == -1) return -1; + break; + case XP_AWK_NODE_BREAK: + break; + case XP_AWK_NODE_CONTINUE: + break; + } + + return 0; +}