*** empty log message ***

This commit is contained in:
hyung-hwan 2006-12-24 15:14:09 +00:00
parent eaf49fce98
commit 3628069938
2 changed files with 19 additions and 10 deletions

View File

@ -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 <ase/awk/awk_i.h> #include <ase/awk/awk_i.h>
@ -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 */ /* the run loop ended. execute the end callback if it exists */
if (runcbs != ASE_NULL && runcbs->on_end != ASE_NULL) if (runcbs != ASE_NULL && runcbs->on_end != ASE_NULL)
{ {
@ -669,8 +672,7 @@ int ase_awk_run (ase_awk_t* awk,
n = 0; n = 0;
} }
/* uninitialize the run object */ /* unregister the run object */
__deinit_run (run);
__del_run (awk, run); __del_run (awk, run);
ASE_AWK_FREE (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, ASE_AWK_ASSERTX (run->awk,
!"should never happen - wrong target for delete", !"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"); "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; return -1;
} }

View File

@ -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 <ase/awk/awk.h> #include <ase/awk/awk.h>
@ -10,6 +10,8 @@
#include <math.h> #include <math.h>
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <stdlib.h>
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
@ -18,18 +20,20 @@
#pragma warning (disable: 4296) #pragma warning (disable: 4296)
#elif defined(ASE_CHAR_IS_MCHAR) #elif defined(ASE_CHAR_IS_MCHAR)
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <locale.h> #include <locale.h>
#else #else
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <locale.h> #include <locale.h>
#include "printf.c"
/*
#include <xp/bas/stdio.h> #include <xp/bas/stdio.h>
#include <xp/bas/stdlib.h> #include <xp/bas/stdlib.h>
#include <xp/bas/string.h> #include <xp/bas/string.h>
#include <xp/bas/memory.h> #include <xp/bas/memory.h>
#include <xp/bas/sysapi.h> #include <xp/bas/sysapi.h>
*/
#endif #endif
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG) #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) else if (epa->mode == ASE_AWK_EXTIO_PIPE_WRITE)
mode = ASE_T("w"); mode = ASE_T("w");
else return -1; /* TODO: any way to set the error number? */ 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); awk_dprintf (ASE_T("opening %s of type %d (pipe)\n"), epa->name, epa->type);
handle = awk_popen (epa->name, mode); handle = awk_popen (epa->name, mode);
if (handle == NULL) return -1; if (handle == NULL) return -1;
@ -290,7 +295,6 @@ static ase_ssize_t process_extio_pipe (
case ASE_AWK_IO_CLOSE: case ASE_AWK_IO_CLOSE:
{ {
fflush ((FILE*)epa->handle);
awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type); awk_dprintf (ASE_T("closing %s of type (pipe) %d\n"), epa->name, epa->type);
fclose ((FILE*)epa->handle); fclose ((FILE*)epa->handle);
epa->handle = NULL; epa->handle = NULL;
@ -299,8 +303,7 @@ static ase_ssize_t process_extio_pipe (
case ASE_AWK_IO_READ: case ASE_AWK_IO_READ:
{ {
if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL) if (awk_fgets (data, size, (FILE*)epa->handle) == ASE_NULL) return 0;
return 0;
return ase_awk_strlen(data); return ase_awk_strlen(data);
} }
@ -310,7 +313,9 @@ static ase_ssize_t process_extio_pipe (
/* TODO: how to return error or 0 */ /* TODO: how to return error or 0 */
for (i = 0; i < size; i++) 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; return size;
} }