*** empty log message ***

This commit is contained in:
hyung-hwan 2007-03-09 14:19:55 +00:00
parent 295058a3e5
commit b93d0890ce
7 changed files with 34 additions and 52 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.116 2007-03-06 14:51:51 bacon Exp $ * $Id: awk.c,v 1.117 2007-03-09 14:19:54 bacon Exp $
* *
* {License} * {License}
*/ */
@ -13,34 +13,30 @@
static void __free_afn (void* awk, void* afn); static void __free_afn (void* awk, void* afn);
ase_awk_t* ase_awk_open ( ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
const ase_awk_prmfns_t* prmfns, void* custom_data, int* errnum)
{ {
ase_awk_t* awk; ase_awk_t* awk;
if (prmfns == ASE_NULL || ASE_ASSERT (
prmfns->mmgr.malloc == ASE_NULL || prmfns != ASE_NULL &&
prmfns->mmgr.free == ASE_NULL || prmfns->mmgr.malloc != ASE_NULL &&
prmfns->ccls.is_upper == ASE_NULL || prmfns->mmgr.free != ASE_NULL &&
prmfns->ccls.is_lower == ASE_NULL || prmfns->ccls.is_upper != ASE_NULL &&
prmfns->ccls.is_alpha == ASE_NULL || prmfns->ccls.is_lower != ASE_NULL &&
prmfns->ccls.is_digit == ASE_NULL || prmfns->ccls.is_alpha != ASE_NULL &&
prmfns->ccls.is_xdigit == ASE_NULL || prmfns->ccls.is_digit != ASE_NULL &&
prmfns->ccls.is_alnum == ASE_NULL || prmfns->ccls.is_xdigit != ASE_NULL &&
prmfns->ccls.is_space == ASE_NULL || prmfns->ccls.is_alnum != ASE_NULL &&
prmfns->ccls.is_print == ASE_NULL || prmfns->ccls.is_space != ASE_NULL &&
prmfns->ccls.is_graph == ASE_NULL || prmfns->ccls.is_print != ASE_NULL &&
prmfns->ccls.is_cntrl == ASE_NULL || prmfns->ccls.is_graph != ASE_NULL &&
prmfns->ccls.is_punct == ASE_NULL || prmfns->ccls.is_cntrl != ASE_NULL &&
prmfns->ccls.to_upper == ASE_NULL || prmfns->ccls.is_punct != ASE_NULL &&
prmfns->ccls.to_lower == ASE_NULL || prmfns->ccls.to_upper != ASE_NULL &&
prmfns->misc.pow == ASE_NULL || prmfns->ccls.to_lower != ASE_NULL &&
prmfns->misc.sprintf == ASE_NULL || prmfns->misc.pow != ASE_NULL &&
prmfns->misc.dprintf == ASE_NULL) prmfns->misc.sprintf != ASE_NULL &&
{ prmfns->misc.dprintf != ASE_NULL);
*errnum = ASE_AWK_EPRMFNS;
return ASE_NULL;
}
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG) #if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
awk = (ase_awk_t*) malloc (ASE_SIZEOF(ase_awk_t)); awk = (ase_awk_t*) malloc (ASE_SIZEOF(ase_awk_t));
@ -48,11 +44,7 @@ ase_awk_t* ase_awk_open (
awk = (ase_awk_t*) prmfns->mmgr.malloc ( awk = (ase_awk_t*) prmfns->mmgr.malloc (
prmfns->mmgr.custom_data, ASE_SIZEOF(ase_awk_t)); prmfns->mmgr.custom_data, ASE_SIZEOF(ase_awk_t));
#endif #endif
if (awk == ASE_NULL) if (awk == ASE_NULL) return ASE_NULL;
{
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL;
}
/* it uses the built-in ase_awk_memset because awk is not /* it uses the built-in ase_awk_memset because awk is not
* fully initialized yet */ * fully initialized yet */
@ -63,7 +55,6 @@ ase_awk_t* ase_awk_open (
&awk->token.name, 128, &awk->prmfns.mmgr) == ASE_NULL) &awk->token.name, 128, &awk->prmfns.mmgr) == ASE_NULL)
{ {
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL; return ASE_NULL;
} }
@ -73,7 +64,6 @@ ase_awk_t* ase_awk_open (
{ {
ase_str_close (&awk->token.name); ase_str_close (&awk->token.name);
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL; return ASE_NULL;
} }
@ -82,7 +72,6 @@ ase_awk_t* ase_awk_open (
ase_str_close (&awk->token.name); ase_str_close (&awk->token.name);
ase_awk_map_close (&awk->tree.afns); ase_awk_map_close (&awk->tree.afns);
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL; return ASE_NULL;
} }
@ -92,7 +81,6 @@ ase_awk_t* ase_awk_open (
ase_awk_map_close (&awk->tree.afns); ase_awk_map_close (&awk->tree.afns);
ase_awk_tab_close (&awk->parse.globals); ase_awk_tab_close (&awk->parse.globals);
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL; return ASE_NULL;
} }
@ -103,7 +91,6 @@ ase_awk_t* ase_awk_open (
ase_awk_tab_close (&awk->parse.globals); ase_awk_tab_close (&awk->parse.globals);
ase_awk_tab_close (&awk->parse.locals); ase_awk_tab_close (&awk->parse.locals);
ASE_AWK_FREE (awk, awk); ASE_AWK_FREE (awk, awk);
*errnum = ASE_AWK_ENOMEM;
return ASE_NULL; return ASE_NULL;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.h,v 1.204 2007-03-06 14:51:51 bacon Exp $ * $Id: awk.h,v 1.205 2007-03-09 14:19:55 bacon Exp $
* *
* {License} * {License}
*/ */
@ -215,7 +215,6 @@ enum
ASE_AWK_ERUNTIME, /* run-time error */ ASE_AWK_ERUNTIME, /* run-time error */
ASE_AWK_EBLKNST, /* blocke nested too deeply */ ASE_AWK_EBLKNST, /* blocke nested too deeply */
ASE_AWK_EEXPRNST, /* expression nested too deeply */ ASE_AWK_EEXPRNST, /* expression nested too deeply */
ASE_AWK_EPRMFNS, /* system functions not proper */
ASE_AWK_ESINOP, ASE_AWK_ESINOP,
ASE_AWK_ESINCL, ASE_AWK_ESINCL,
@ -376,8 +375,7 @@ enum
extern "C" { extern "C" {
#endif #endif
ase_awk_t* ase_awk_open ( ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data);
const ase_awk_prmfns_t* prmfns, void* custom_data, int* errnum);
int ase_awk_close (ase_awk_t* awk); int ase_awk_close (ase_awk_t* awk);
int ase_awk_clear (ase_awk_t* awk); int ase_awk_clear (ase_awk_t* awk);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: err.c,v 1.88 2007-03-08 14:31:34 bacon Exp $ * $Id: err.c,v 1.89 2007-03-09 14:19:55 bacon Exp $
* *
* {License} * {License}
*/ */
@ -32,7 +32,6 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("general run-time error"), ASE_T("general run-time error"),
ASE_T("block nested too deeply"), ASE_T("block nested too deeply"),
ASE_T("expressio nested too deeply"), ASE_T("expressio nested too deeply"),
ASE_T("system functions not provided or not proper"),
ASE_T("cannot open source input"), ASE_T("cannot open source input"),
ASE_T("cannot close source input"), ASE_T("cannot close source input"),

View File

@ -1,6 +1,6 @@
OUT = aseawk OUT = aseawk
C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \ C_SRCS = awk.c err.c tree.c tab.c map.c parse.c \
run.c rec.c val.c func.c misc.c extio.c rex.c run.c rec.c val.c func.c misc.c extio.c rex.c
JNI_SRCS = jni.c JNI_SRCS = jni.c
JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java

View File

@ -1,5 +1,5 @@
/* /*
* $Id: run.c,v 1.340 2007-03-06 14:51:53 bacon Exp $ * $Id: run.c,v 1.341 2007-03-09 14:19:55 bacon Exp $
* *
* {License} * {License}
*/ */
@ -588,10 +588,10 @@ int ase_awk_run (ase_awk_t* awk,
void* custom_data) void* custom_data)
{ {
ase_awk_run_t* run; ase_awk_run_t* run;
int n, errnum; int n;
/* clear the awk error code */ /* clear the awk error code */
ase_awk_seterror_old (awk, ASE_AWK_ENOERR, 0, ASE_NULL); ase_awk_seterror (awk, ASE_AWK_ENOERR, 0, ASE_NULL, 0);
/* check if the code has ever been parsed */ /* check if the code has ever been parsed */
if (awk->tree.nglobals == 0 && if (awk->tree.nglobals == 0 &&

View File

@ -6,7 +6,7 @@ C_OBJS = $(C_SRCS:.c=.obj)
CC = cl CC = cl
LD = link LD = link
CFLAGS = /nologo /O2 /MT /W3 /GR- /Za -I../.. -DNDEBUG CFLAGS = /nologo /O2 /MT /W3 /GR- /Za -I../..
all: lib all: lib

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.185 2007-03-06 14:51:04 bacon Exp $ * $Id: awk.c,v 1.186 2007-03-09 14:19:55 bacon Exp $
*/ */
#include <ase/awk/awk.h> #include <ase/awk/awk.h>
@ -868,14 +868,12 @@ static int awk_main (int argc, ase_char_t* argv[])
prmfns.misc.dprintf = custom_awk_dprintf; prmfns.misc.dprintf = custom_awk_dprintf;
prmfns.misc.custom_data = NULL; prmfns.misc.custom_data = NULL;
if ((awk = ase_awk_open(&prmfns, ASE_NULL, &errnum)) == ASE_NULL) if ((awk = ase_awk_open(&prmfns, ASE_NULL)) == ASE_NULL)
{ {
#ifdef _WIN32 #ifdef _WIN32
HeapDestroy (mmgr_data.heap); HeapDestroy (mmgr_data.heap);
#endif #endif
ase_printf ( ase_printf (ASE_T("ERROR: cannot open awk\n"));
ASE_T("ERROR: cannot open awk [%d] %s\n"),
errnum, ase_awk_geterrstr(ASE_NULL, errnum));
return -1; return -1;
} }