From 78c911098542632ae51b679151435a7dc182ebdb Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 19 Mar 2007 03:33:54 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/jni.c | 3 ++- ase/awk/jni.dsp | 43 ++----------------------------------------- ase/awk/run.c | 28 +++++++++++++++++++++++----- ase/cmn/misc.c | 3 +-- ase/com/Awk.cpp | 30 ++++++++++++++---------------- ase/test/awk/awk.dsp | 2 +- 6 files changed, 43 insertions(+), 66 deletions(-) diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 76ffa81c..33130287 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.74 2007-03-10 15:42:00 bacon Exp $ + * $Id: jni.c,v 1.75 2007-03-19 03:33:53 bacon Exp $ * * {License} */ @@ -1569,6 +1569,7 @@ static int __handle_bfn ( (*env)->ExceptionClear (env); (*env)->DeleteLocalRef (env, args); + ase_awk_setrunerrnum (run, ASE_AWK_EBFNIMPL); return -1; } diff --git a/ase/awk/jni.dsp b/ase/awk/jni.dsp index 1680607f..c73c55ac 100644 --- a/ase/awk/jni.dsp +++ b/ase/awk/jni.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../release/win32/vs60/aseawk_jni.dll" /implib:"release/win32/vs60/aseawk_jni.lib" /libpath:"$(OutDir)" +# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../release/win32/vs60/aseawk_jni.dll" /implib:"release/win32/vs60/aseawk_jni.lib" /libpath:"$(OutDir)" !ELSEIF "$(CFG)" == "awk.jni - Win32 Debug" @@ -81,30 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../debug/win32/vs60/aseawk_jni.dll" /implib:"debug/win32/vs60/aseawk_jni.lib" /pdbtype:sept /libpath:"$(OutDir)" -# Begin Custom Build -InputPath=\projects\ase\debug\win32\vs60\aseawk_jni.dll -SOURCE="$(InputPath)" - -BuildCmds= \ - /progra~1/java/jdk1.5.0_09/bin/javac -classpath ../.. Awk.java \ - /progra~1/java/jdk1.5.0_09/bin/javac -classpath ../.. StdAwk.java \ - /progra~1/java/jdk1.5.0_09/bin/javac -classpath ../.. Extio.java \ - /progra~1/java/jdk1.5.0_09/bin/javac -classpath ../.. Exception.java \ - - -"Awk.class" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"StdAwk.class" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"Extio.class" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"Exception.class" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build +# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../debug/win32/vs60/aseawk_jni.dll" /implib:"debug/win32/vs60/aseawk_jni.lib" /pdbtype:sept /libpath:"$(OutDir)" !ENDIF @@ -132,21 +109,5 @@ SOURCE=.\jni.h # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group -# Begin Source File - -SOURCE=.\Awk.java -# End Source File -# Begin Source File - -SOURCE=.\Exception.java -# End Source File -# Begin Source File - -SOURCE=.\Extio.java -# End Source File -# Begin Source File - -SOURCE=.\StdAwk.java -# End Source File # End Target # End Project diff --git a/ase/awk/run.c b/ase/awk/run.c index b8452db5..0e82fa21 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.344 2007-03-10 15:22:54 bacon Exp $ + * $Id: run.c,v 1.345 2007-03-19 03:33:53 bacon Exp $ * * {License} */ @@ -5354,10 +5354,6 @@ static ase_awk_val_t* __eval_call ( return ASE_NULL; } - /* - nargs = 0; p = call->args; - while (p != ASE_NULL) - */ for (p = call->args, nargs = 0; p != ASE_NULL; p = p->next, nargs++) { ASE_ASSERT ( @@ -5464,10 +5460,32 @@ static ase_awk_val_t* __eval_call ( if (call->what.bfn.handler != ASE_NULL) { + run->errnum = ASE_AWK_ENOERR; + n = call->what.bfn.handler ( run, call->what.bfn.name.ptr, call->what.bfn.name.len); + + if (n <= -1) + { + if (run->errnum == ASE_AWK_ENOERR) + { + /* the handler has not set the error. + * fix it */ + ase_awk_setrunerror ( + run, ASE_AWK_EBFNIMPL, + nde->line, ASE_NULL, 0); + } + else + { + /* adjust the error line */ + run->errlin = nde->line; + } + + /* correct the return code just in case */ + if (n < -1) n = -1; + } } } diff --git a/ase/cmn/misc.c b/ase/cmn/misc.c index 52e8ac8b..005c6877 100644 --- a/ase/cmn/misc.c +++ b/ase/cmn/misc.c @@ -1,5 +1,5 @@ /* - * $Id: misc.c,v 1.2 2007-03-06 15:01:50 bacon Exp $ + * $Id: misc.c,v 1.3 2007-03-19 03:33:54 bacon Exp $ * * {License} */ @@ -8,7 +8,6 @@ #include #ifndef NDEBUG - int ase_assert_failed ( const ase_char_t* expr, const ase_char_t* desc, const ase_char_t* file, ase_size_t line) diff --git a/ase/com/Awk.cpp b/ase/com/Awk.cpp index c042e45f..26e56593 100644 --- a/ase/com/Awk.cpp +++ b/ase/com/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.27 2007-03-06 14:54:49 bacon Exp $ + * $Id: Awk.cpp,v 1.28 2007-03-19 03:33:54 bacon Exp $ * * {License} */ @@ -351,7 +351,7 @@ static int __handle_bfn ( { ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("out of memory in creating argument array for '%.*s'\n"), + _T("out of memory in creating argument array for '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -396,7 +396,7 @@ static int __handle_bfn ( ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("out of memory in handling '%.*s'\n"), + _T("out of memory in handling '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -418,7 +418,7 @@ static int __handle_bfn ( ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("out of memory in handling '%.*s'\n"), + _T("out of memory in handling '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -434,7 +434,7 @@ static int __handle_bfn ( ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("out of memory in handling '%.*s'\n"), + _T("out of memory in handling '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); @@ -447,7 +447,7 @@ static int __handle_bfn ( { ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("out of memory in handling '%.*s'\n"), + _T("out of memory in handling '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -456,7 +456,7 @@ static int __handle_bfn ( { ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("no handler for '%.*s'\n"), + _T("no handler for '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -465,7 +465,7 @@ static int __handle_bfn ( { ase_char_t buf[128]; _sntprintf (buf, ASE_COUNTOF(buf), - _T("return value not supported for '%.*s'\n"), + _T("return value not supported for '%.*s'"), fnl, fnm); ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf); return -1; @@ -507,17 +507,15 @@ HRESULT CAwk::Parse (int* ret) prmfns.misc.pow = custom_awk_pow; prmfns.misc.sprintf = custom_awk_sprintf; - prmfns.misc.aprintf = custom_awk_aprintf; prmfns.misc.dprintf = custom_awk_dprintf; - prmfns.misc.abort = custom_awk_abort; - handle = ase_awk_open (&prmfns, NULL, &errnum); + handle = ase_awk_open (&prmfns, NULL); if (handle == NULL) { errlin = 0; ase_strxcpy ( errmsg, ASE_COUNTOF(errmsg), - ase_awk_geterrstr(errnum)); + ase_awk_geterrstr(NULL, ASE_AWK_ENOMEM)); *ret = -1; @@ -806,7 +804,7 @@ STDMETHODIMP CAwk::AddBuiltinFunction ( errlin = 0; _sntprintf ( errmsg, ASE_COUNTOF(errmsg), - _T("'%.*s' added already\n"), + _T("'%.*s' added already"), bfn->name.len, bfn->name.ptr); *ret = -1; @@ -821,7 +819,7 @@ STDMETHODIMP CAwk::AddBuiltinFunction ( errlin = 0; ase_strxcpy ( errmsg, ASE_COUNTOF(errmsg), - ase_awk_geterrstr(errnum)); + ase_awk_geterrstr(NULL, errnum)); *ret = -1; return S_OK; @@ -837,7 +835,7 @@ STDMETHODIMP CAwk::AddBuiltinFunction ( errlin = 0; ase_strxcpy ( errmsg, ASE_COUNTOF(errmsg), - ase_awk_geterrstr(errnum)); + ase_awk_geterrstr(NULL, errnum)); *ret = -1; return S_OK; @@ -883,7 +881,7 @@ STDMETHODIMP CAwk::DeleteBuiltinFunction (BSTR name, int* ret) errlin = 0; ase_strxcpy ( errmsg, ASE_COUNTOF(errmsg), - ase_awk_geterrstr(errnum)); + ase_awk_geterrstr(NULL, errnum)); *ret = -1; return S_OK; diff --git a/ase/test/awk/awk.dsp b/ase/test/awk/awk.dsp index 28f0ac75..24004240 100644 --- a/ase/test/awk/awk.dsp +++ b/ase/test/awk/awk.dsp @@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /machine:I386 /out:"../../release/win32/vs60/aseawk.exe" /libpath:"$(OutDir)" +# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /machine:I386 /out:"../../release/win32/vs60/aseawk.exe" /libpath:"$(OutDir)" !ELSEIF "$(CFG)" == "awk.test - Win32 Debug"