From 36280699383726ba990d1ff7d94ed5d409733760 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 24 Dec 2006 15:14:09 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/run.c | 12 ++++++++---- ase/test/awk/awk.c | 17 +++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ase/awk/run.c b/ase/awk/run.c index 73379b75..e0d73865 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.306 2006-12-23 06:33:47 bacon Exp $ + * $Id: run.c,v 1.307 2006-12-24 15:14:08 bacon Exp $ */ #include @@ -657,6 +657,9 @@ int ase_awk_run (ase_awk_t* awk, } } + /* uninitialize the run object */ + __deinit_run (run); + /* the run loop ended. execute the end callback if it exists */ if (runcbs != ASE_NULL && runcbs->on_end != ASE_NULL) { @@ -669,8 +672,7 @@ int ase_awk_run (ase_awk_t* awk, n = 0; } - /* uninitialize the run object */ - __deinit_run (run); + /* unregister the run object */ __del_run (awk, run); ASE_AWK_FREE (awk, run); @@ -2539,7 +2541,9 @@ static int __run_delete (ase_awk_run_t* run, ase_awk_nde_delete_t* nde) ASE_AWK_ASSERTX (run->awk, !"should never happen - wrong target for delete", "the delete statement cannot be called with other nodes than the variables such as a named variable, a named indexed variable, etc"); - ase_awk_setrunerror (run, ASE_AWK_EINTERNAL, var->line, "delete statement called with a wrong target"); + ase_awk_setrunerror ( + run, ASE_AWK_EINTERNAL, var->line, + ASE_T("delete statement called with a wrong target")); return -1; } diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index 55ca103d..a7d04bd2 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.146 2006-12-23 06:33:47 bacon Exp $ + * $Id: awk.c,v 1.147 2006-12-24 15:14:09 bacon Exp $ */ #include @@ -10,6 +10,8 @@ #include #include #include +#include +#include #if defined(_WIN32) #include @@ -18,18 +20,20 @@ #pragma warning (disable: 4296) #elif defined(ASE_CHAR_IS_MCHAR) #include - #include #include #else #include #include #include + #include "printf.c" +/* #include #include #include #include #include +*/ #endif #if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG) @@ -281,6 +285,7 @@ static ase_ssize_t process_extio_pipe ( else if (epa->mode == ASE_AWK_EXTIO_PIPE_WRITE) mode = ASE_T("w"); else return -1; /* TODO: any way to set the error number? */ + awk_dprintf (ASE_T("opening %s of type %d (pipe)\n"), epa->name, epa->type); handle = awk_popen (epa->name, mode); if (handle == NULL) return -1; @@ -290,7 +295,6 @@ static ase_ssize_t process_extio_pipe ( case ASE_AWK_IO_CLOSE: { - fflush ((FILE*)epa->handle); awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type); fclose ((FILE*)epa->handle); epa->handle = NULL; @@ -299,8 +303,7 @@ static ase_ssize_t process_extio_pipe ( case ASE_AWK_IO_READ: { - if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL) - return 0; + if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL) return 0; return ase_awk_strlen(data); } @@ -310,7 +313,9 @@ static ase_ssize_t process_extio_pipe ( /* TODO: how to return error or 0 */ for (i = 0; i < size; i++) { - awk_fputc (data[i], (FILE*)epa->handle); + int n; + n = awk_fputc (data[i], (FILE*)epa->handle); + //if (n == -1) wprintf (L"errno = %d, %d\n", errno, EINVAL); } return size; }