Changeset: 45d7b1e0058e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/45d7b1e0058e
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_client.h
        monetdb5/mal/mal_scenario.c
        monetdb5/mal/mal_scenario.h
        monetdb5/mal/mal_session.c
        monetdb5/mal/mal_session.h
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_scenario.h
Branch: simplify_scenario
Log Message:

removed callback (error handler from scenario).
removed unsued systemInit/exit


diffs (truncated from 315 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -740,7 +740,6 @@ str COPYrejects_clear(Client cntxt, MalB
 str GRPgroup1(bat *ngid, bat *next, bat *nhis, const bat *bid);
 str GRPsubgroup5(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat 
*sid, const bat *gid, const bat *eid, const bat *hid);
 int MAL_MAXCLIENTS;
-str MALcallback(Client c, str msg);
 int MALcommentsOnly(MalBlkPtr mb);
 lng MALdebug;
 str MALengine(Client c);
@@ -1345,12 +1344,10 @@ str SHPattach(Client cntxt, MalBlkPtr mb
 str SHPimport(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str SHPpartialimport(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str SQLautocommit(mvc *m);
-str SQLcallback(Client c, str msg);
 void SQLdestroyResult(res_table *destroy);
 str SQLengine(Client c);
 str SQLengineIntern(Client c, backend *be);
 str SQLescapeString(str s);
-str SQLexit(Client c);
 str SQLexitClient(Client c);
 str SQLinitClient(Client c, const char *passwd, const char *challenge, const 
char *algo);
 str SQLinitClientFromMAL(Client c, const char *passwd, const char *challenge, 
const char *algo);
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -61,7 +61,6 @@ typedef struct CLIENT {
         */
        str     scenario;  /* scenario management references */
        MALfcn engine;
-       MALfcn callback;
        init_client initClient;
        MALfcn exitClient;
                                                /* if set to 'S' it will put 
the process to sleep */
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
@@ -38,16 +38,9 @@
  * @+ Scenario management
  * Scenarios are captured in modules; they can be dynamically loaded
  * and remain active until the system is brought to a halt.
- * The first time a scenario @sc{xyz} is used, the system looks for a scenario
- * initialization routine @sc{xyzinitSystem()} and executes it.
- * It is typically used to prepare the server for language specific 
interactions.
  * Thereafter its components are set to those required by
  * the scenario and the client initialization takes place.
  *
- * When the last user interested in a particular scenario leaves the
- * scene, we activate its finalization routine calling @sc{xyzexitSystem()}.
- * It typically perform cleanup, backup and monitoring functions.
- *
  * A scenario is interpreted in a strictly linear fashion,
  * i.e. performing a symbolic optimization before scheduling decisions
  * are taken.
@@ -90,8 +83,6 @@ static struct SCENARIO scenarioRec[MAXSC
                .exitClientCmd = (MALfcn) MALexitClient,
                .engine = "MALengine",
                .engineCmd = (MALfcn) MALengine,
-               .callback = "MALcallback",
-               .callbackCmd = (MALfcn) MALcallback,
        },
        {
                .name = NULL,
@@ -146,11 +137,8 @@ void
 showScenario(stream *f, Scenario scen)
 {
        mnstr_printf(f, "[ \"%s\",", scen->name);
-       print_scenarioCommand(f, scen->initSystem, scen->initSystemCmd);
-       print_scenarioCommand(f, scen->exitSystem, scen->exitSystemCmd);
        print_scenarioCommand(f, scen->initClient, scen->initClientCmd);
        print_scenarioCommand(f, scen->exitClient, scen->exitClientCmd);
-       print_scenarioCommand(f, scen->callback, scen->callbackCmd);
        print_scenarioCommand(f, scen->engine, scen->engineCmd);
        mnstr_printf(f, "]\n");
 }
@@ -209,7 +197,6 @@ fillScenario(Client c, Scenario scen)
        c->scenario = scen->name;
 
        c->engine = scen->engineCmd;
-       c->callback = scen->callbackCmd;
        c->initClient = scen->initClientCmd;
        c->exitClient = scen->exitClientCmd;
        return(MAL_SUCCEED);
@@ -236,7 +223,6 @@ setScenario(Client c, str nme)
                c->initClient = NULL;
                c->exitClient = NULL;
                c->engine = NULL;
-               c->callback = NULL;
                return msg;
        }
        return MAL_SUCCEED;
@@ -266,7 +252,6 @@ resetScenario(Client c)
        c->initClient = NULL;
        c->exitClient = NULL;
        c->engine = NULL;
-       c->callback = NULL;
 }
 
 /*
@@ -294,20 +279,9 @@ runScenarioBody(Client c)
 
        MT_thread_setworking("engine");
        while (c->mode > FINISHCLIENT && !GDKexiting()) {
-               if ( c->mode <= FINISHCLIENT || (msg = c->engine(c)) != 
MAL_SUCCEED)
+               if (c->mode <= FINISHCLIENT || (msg = c->engine(c)) != 
MAL_SUCCEED)
                        goto wrapup;
        wrapup:
-               if (msg != MAL_SUCCEED) {
-                       if (c->callback) {
-                               MT_thread_setworking("callback");
-                               msg = (str)c->callback(c, msg);
-                       }
-                       if (msg) {
-                               mnstr_printf(c->fdout,"!%s%s", msg, 
(msg[strlen(msg)-1] == '\n'? "":"\n"));
-                               freeException(msg);
-                               msg = MAL_SUCCEED;
-                       }
-               }
                if( GDKerrbuf && GDKerrbuf[0])
                        mnstr_printf(c->fdout,"!GDKerror: %s\n",GDKerrbuf);
                assert(c->curprg->def->errors == NULL);
diff --git a/monetdb5/mal/mal_scenario.h b/monetdb5/mal/mal_scenario.h
--- a/monetdb5/mal/mal_scenario.h
+++ b/monetdb5/mal/mal_scenario.h
@@ -25,18 +25,12 @@
 
 typedef struct SCENARIO {
        str name, language;
-       str initSystem;
-       MALfcn initSystemCmd;
-       str exitSystem;
-       MALfcn exitSystemCmd;
        str initClient;
        init_client initClientCmd;
        str exitClient;
        MALfcn exitClientCmd;
        str engine;
        MALfcn engineCmd;
-       str callback;
-       MALfcn callbackCmd;
 } *Scenario;
 
 mal_export Scenario getFreeScenario(void);
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
@@ -745,29 +745,6 @@ MALcommentsOnly(MalBlkPtr mb)
        return 1;
 }
 
-str
-MALcallback(Client c, str msg)
-{
-       if (msg) {
-               /* don't print exception decoration, just the message */
-               char *n = NULL;
-               char *o = msg;
-               while ((n = strchr(o, '\n')) != NULL) {
-                       if (*o == '!')
-                               o++;
-                       mnstr_printf(c->fdout, "!%.*s\n", (int) (n - o), o);
-                       o = ++n;
-               }
-               if (*o != 0) {
-                       if (*o == '!')
-                               o++;
-                       mnstr_printf(c->fdout, "!%s\n", o);
-               }
-               freeException(msg);
-       }
-       return MAL_SUCCEED;
-}
-
 /*
  * The default MAL optimizer includes a final call to
  * the multiplex expander.
@@ -793,8 +770,8 @@ MALoptimizer(Client c)
        return msg;
 }
 
-str
-MALengine(Client c)
+static str
+MALengine_(Client c)
 {
        Symbol prg;
        str msg = MAL_SUCCEED;
@@ -869,6 +846,30 @@ MALengine(Client c)
        return msg;
 }
 
+str
+MALengine(Client c)
+{
+       str msg = MALengine_(c);
+       if (msg) {
+               /* don't print exception decoration, just the message */
+               char *n = NULL;
+               char *o = msg;
+               while ((n = strchr(o, '\n')) != NULL) {
+                       if (*o == '!')
+                               o++;
+                       mnstr_printf(c->fdout, "!%.*s\n", (int) (n - o), o);
+                       o = ++n;
+               }
+               if (*o != 0) {
+                       if (*o == '!')
+                               o++;
+                       mnstr_printf(c->fdout, "!%s\n", o);
+               }
+               freeException(msg);
+       }
+       return MAL_SUCCEED;
+}
+
 /* Hypothetical, optimizers may massage the plan in such a way
  * that multiple passes are needed.
  * However, the current SQL driven approach only expects a single
diff --git a/monetdb5/mal/mal_session.h b/monetdb5/mal/mal_session.h
--- a/monetdb5/mal/mal_session.h
+++ b/monetdb5/mal/mal_session.h
@@ -22,7 +22,6 @@ mal_export str MALinitClient(Client c);
 mal_export str MALexitClient(Client c);
 mal_export str MALparser(Client c);
 mal_export str MALengine(Client c);
-mal_export str MALcallback(Client c, str msg);
 mal_export void MSresetInstructions(MalBlkPtr mb, int start);
 mal_export void MSresetVariables(MalBlkPtr mb);
 mal_export void MSresetStack(Client cntxt, MalBlkPtr mb, MalStkPtr glb);
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
@@ -104,16 +104,12 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
        *s = (struct SCENARIO) {
                .name = "S_Q_L",
                .language = "sql",
-               .exitSystem = "SQLexit",
-               .exitSystemCmd = SQLexit,
                .initClient = "SQLinitClient",
                .initClientCmd = SQLinitClient,
                .exitClient = "SQLexitClient",
                .exitClientCmd = SQLexitClient,
                .engine = "SQLengine",
                .engineCmd = SQLengine,
-               .callback = "SQLcallback",
-               .callbackCmd = SQLcallback,
        };
        ms = getFreeScenario();
        if (!ms)
@@ -122,16 +118,12 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
        *ms = (struct SCENARIO) {
                .name = "M_S_Q_L",
                .language = "msql",
-               .exitSystem = "SQLexit",
-               .exitSystemCmd = SQLexit,
                .initClient = "SQLinitClientFromMAL",
                .initClientCmd = SQLinitClientFromMAL,
                .exitClient = "SQLexitClient",
                .exitClientCmd = SQLexitClient,
                .engine = "MALengine",
                .engineCmd = MALengine,
-               .callback = "MALcallback",
-               .callbackCmd = MALcallback,
        };
 
        tmp = SQLinit(cntxt, initpasswd);
@@ -174,7 +166,7 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
        return MAL_SUCCEED;
 }
 
-str
+static str
 SQLexit(Client c)
 {
        (void) c;               /* not used */
@@ -1452,8 +1444,8 @@ finalize:
        return msg;
 }
 
-str
-SQLengine(Client c)
+static str
+SQLengine_(Client c)
 {
        backend *be = (backend *) c->sqlcontext;
 
@@ -1491,8 +1483,9 @@ SQLengine(Client c)
 }
 
 str
-SQLcallback(Client c, str msg)
+SQLengine(Client c)
 {
+       char *msg = SQLengine_(c);
        if (msg) {
                /* remove exception decoration */
                for (char *m = msg; m && *m; ) {
diff --git a/sql/backends/monet5/sql_scenario.h 
b/sql/backends/monet5/sql_scenario.h
--- a/sql/backends/monet5/sql_scenario.h
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to