Changeset: 6d81bf6c15af for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6d81bf6c15af
Modified Files:
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_import.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_interpreter.h
        monetdb5/mal/mal_scenario.c
        monetdb5/mal/mal_session.c
        monetdb5/optimizer/opt_evaluate.h
        monetdb5/optimizer/opt_garbageCollector.c
        monetdb5/optimizer/opt_pushselect.c
        monetdb5/optimizer/opt_remoteQueries.c
        monetdb5/scheduler/run_pipeline.c
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_optimizer.c
        sql/backends/monet5/sql_scenario.c
Branch: malparsing
Log Message:

Remove obsolete function showErrors
This is all handled at the runScenario level.


diffs (231 lines):

diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -13,7 +13,7 @@
 #include "monetdb_config.h"
 #include "mal_function.h"
 #include "mal_resolve.h"       /* for isPolymorphic() & chkProgram() */
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "mal_listing.h"
 #include "mal_namespace.h"
 #include "mal_private.h"
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -27,7 +27,7 @@
 #include "monetdb_config.h"
 #include "mal_import.h"
 #include "mal_builder.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "mal_linker.h"                /* for loadModuleLibrary() */
 #include "mal_parser.h"
 #include "mal_private.h"
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -51,20 +51,6 @@ ptr getArgReference(MalStkPtr stk, Instr
 #endif
 }
 
-/* code is obsolete, because all should be handled as exceptions */
-void showErrors(Client cntxt)
-{
-       int i;
-       char *errbuf = GDKerrbuf;
-       if (errbuf && *errbuf) {
-               i = (int)strlen(errbuf);
-               mnstr_printf(cntxt->fdout, "%s", errbuf);
-               if (errbuf[i - 1] != '\n')
-                       mnstr_printf(cntxt->fdout, "\n");
-               errbuf[0] = '\0';
-       }
-}
-
 str malCommandCall(MalStkPtr stk, InstrPtr pci)
 {
        str ret= MAL_SUCCEED;
diff --git a/monetdb5/mal/mal_interpreter.h b/monetdb5/mal/mal_interpreter.h
--- a/monetdb5/mal/mal_interpreter.h
+++ b/monetdb5/mal/mal_interpreter.h
@@ -25,7 +25,6 @@
 
 /* #define DEBUG_FLOW */
 
-mal_export void showErrors(Client cntxt);
 mal_export MalStkPtr prepareMALstack(MalBlkPtr mb, int size);
 mal_export str runMAL(Client c, MalBlkPtr mb, MalBlkPtr mbcaller, MalStkPtr 
env);
 mal_export str runMALsequence(Client cntxt, MalBlkPtr mb, int startpc, int 
stoppc, MalStkPtr stk, MalStkPtr env, InstrPtr pcicaller);
diff --git a/monetdb5/mal/mal_scenario.c b/monetdb5/mal/mal_scenario.c
--- a/monetdb5/mal/mal_scenario.c
+++ b/monetdb5/mal/mal_scenario.c
@@ -92,7 +92,7 @@
  */
 #include "monetdb_config.h"
 #include "mal_scenario.h"
-#include "mal_interpreter.h" /* for showErrors */
+#include "mal_interpreter.h" 
 #include "mal_linker.h"                /* for getAddress() */
 #include "mal_client.h"
 #include "mal_authorize.h"
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -11,7 +11,7 @@
 #include "monetdb_config.h"
 #include "mal_session.h"
 #include "mal_instruction.h" /* for pushEndInstruction() */
-#include "mal_interpreter.h" /* for showErrors(), runMAL(), garbageElement() */
+#include "mal_interpreter.h" /* for runMAL(), garbageElement() */
 #include "mal_parser.h"             /* for parseMAL() */
 #include "mal_namespace.h"
 #include "mal_builder.h"
@@ -64,7 +64,12 @@ malBootstrap(void)
        pushEndInstruction(c->curprg->def);
        chkProgram(c->usermodule, c->curprg->def);
        if (c->curprg->def->errors != MAL_SUCCEED ) {
-               showErrors(c);
+               mnstr_printf(c->fdout,"!%s%s",msg, (msg[strlen(msg)-1] == '\n'? 
"":"\n"));
+               mnstr_flush(c->fdout);
+               if( GDKerrbuf && GDKerrbuf[0]){
+                       mnstr_printf(c->fdout,"!GDKerror: %s\n",GDKerrbuf);
+                       mnstr_flush(c->fdout);
+               }
 #ifdef HAVE_EMBEDDED
                return ;
 #endif
@@ -694,7 +699,6 @@ MALparser(Client cntxt)
        // Any error encountered should reset the function under construction
        msg = cntxt->curprg->def->errors;
        if( msg != MAL_SUCCEED){
-               showErrors(cntxt);
                cntxt->curprg->def->errors = MAL_SUCCEED;
                MSresetVariables(cntxt, cntxt->curprg->def, cntxt->glb, 
oldstate.vtop);
                resetMalBlk(cntxt->curprg->def, 1);
@@ -717,7 +721,6 @@ MALparser(Client cntxt)
                // A compound block is ready for execution once it has been 
type checked.
                chkProgram(cntxt->usermodule, cntxt->curprg->def);
                if (cntxt->curprg->def->errors) {
-                       showErrors(cntxt);
                        msg = cntxt->curprg->def->errors;
                        cntxt->curprg->def->errors = MAL_SUCCEED;
                        MSresetVariables(cntxt, cntxt->curprg->def, cntxt->glb, 
oldstate.vtop);
@@ -739,7 +742,6 @@ MALparser(Client cntxt)
                msg = cntxt->curprg->def->errors;
                cntxt->curprg->def->errors = 0;
                if (msg) {
-                       showErrors(cntxt);
                } 
                (void) MSinitClientPrg(cntxt,"user","main");
        }
@@ -775,7 +777,6 @@ MALengine(Client c)
                throw(SYNTAX, "mal.engine", SYNTAX_SIGNATURE);
 
        if (prg->def->errors ) {
-               showErrors(c);
                MSresetVariables(c, c->curprg->def, c->glb, oldstate.vtop);
                resetMalBlk(c->curprg->def, 1);
                throw(MAL, "mal.engine", "%s", prg->def->errors);
@@ -808,7 +809,6 @@ MALengine(Client c)
                /* ignore "internal" exceptions */
                if (strstr(msg, "client.quit") )
                        msg = MAL_SUCCEED;
-               showErrors(c);
        }
        MSresetVariables(c, prg->def, c->glb, 0);
        resetMalBlk(prg->def, 1);
diff --git a/monetdb5/optimizer/opt_evaluate.h 
b/monetdb5/optimizer/opt_evaluate.h
--- a/monetdb5/optimizer/opt_evaluate.h
+++ b/monetdb5/optimizer/opt_evaluate.h
@@ -9,7 +9,7 @@
 #ifndef _OPT_CX_
 #define _OPT_CX_
 #include "mal_stack.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "opt_prelude.h"
 #include "opt_support.h"
 
diff --git a/monetdb5/optimizer/opt_garbageCollector.c 
b/monetdb5/optimizer/opt_garbageCollector.c
--- a/monetdb5/optimizer/opt_garbageCollector.c
+++ b/monetdb5/optimizer/opt_garbageCollector.c
@@ -8,7 +8,7 @@
 
 #include "monetdb_config.h"
 #include "opt_garbageCollector.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "mal_builder.h"
 #include "mal_function.h"
 #include "opt_prelude.h"
diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -8,7 +8,7 @@
 
 #include "monetdb_config.h"
 #include "opt_pushselect.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 
 static InstrPtr
 PushArgument(MalBlkPtr mb, InstrPtr p, int arg, int pos)
diff --git a/monetdb5/optimizer/opt_remoteQueries.c 
b/monetdb5/optimizer/opt_remoteQueries.c
--- a/monetdb5/optimizer/opt_remoteQueries.c
+++ b/monetdb5/optimizer/opt_remoteQueries.c
@@ -8,7 +8,7 @@
 
 #include "monetdb_config.h"
 #include "opt_remoteQueries.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "mal_builder.h"
 
 /*
diff --git a/monetdb5/scheduler/run_pipeline.c 
b/monetdb5/scheduler/run_pipeline.c
--- a/monetdb5/scheduler/run_pipeline.c
+++ b/monetdb5/scheduler/run_pipeline.c
@@ -125,7 +125,7 @@
 
 #include "monetdb_config.h"
 #include "run_pipeline.h"
-#include "mal_interpreter.h"   /* for showErrors() */
+#include "mal_interpreter.h"
 #include "opt_prelude.h"
 #include "opt_macro.h"
 
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -675,7 +675,6 @@ cleanup_engine:
                }
                if (*o != 0)
                        mnstr_printf(c->fdout, "!%s\n", getExceptionMessage(o));
-               showErrors(c);
                m->session->status = -10;
        }
 
diff --git a/sql/backends/monet5/sql_optimizer.c 
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -241,8 +241,6 @@ SQLoptimizeQuery(Client c, MalBlkPtr mb)
         * to allow inspection.
         */
        if (mb->errors) {
-               showErrors(c);
-
                if (c->listing)
                        printFunction(c->fdout, mb, 0, c->listing);
                if (be->mvc->debug) {
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1180,7 +1180,6 @@ SQLparser(Client c)
                //printFunction(c->fdout, c->curprg->def, 0, LIST_MAL_ALL);
                /* we know more in this case than chkProgram(c, 
c->curprg->def); */
                if (c->curprg->def->errors) {
-                       showErrors(c);
                        /* restore the state */
                        MSresetInstructions(c->curprg->def, oldstop);
                        freeVariables(c, c->curprg->def, NULL, oldvtop);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to