Changeset: f9920b32ebc9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f9920b32ebc9
Modified Files:
        monetdb5/mal/mal_embedded.c
        monetdb5/mal/mal_import.c
        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:

no more parser/reader in the scenario, just engine.


diffs (262 lines):

diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c
--- a/monetdb5/mal/mal_embedded.c
+++ b/monetdb5/mal/mal_embedded.c
@@ -130,6 +130,7 @@ malEmbeddedBoot(int workerlimit, int mem
                return msg;
        }
        pushEndInstruction(c->curprg->def);
+#if 0
        msg = chkProgram(c->usermodule, c->curprg->def);
        if ( msg != MAL_SUCCEED || (msg= c->curprg->def->errors) != MAL_SUCCEED 
) {
                MCcloseClient(c);
@@ -138,6 +139,7 @@ malEmbeddedBoot(int workerlimit, int mem
                return msg;
        }
        msg = MALengine(c);
+#endif
        if (msg == MAL_SUCCEED)
                embeddedinitialized = true;
        MCcloseClient(c);
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
@@ -343,10 +343,14 @@ compileString(Symbol *fcn, Client cntxt,
        }
 
        msg = MSinitClientPrg(c, "user", "main");/* create new context */
+       if (msg == MAL_SUCCEED)
+               msg = MALparser(c);
+       /*
        if(msg == MAL_SUCCEED && c->phase[MAL_SCENARIO_PARSER])
                msg = (str) (*c->phase[MAL_SCENARIO_PARSER])(c);
        if(msg == MAL_SUCCEED && c->phase[MAL_SCENARIO_OPTIMIZE])
                msg = (str) (*c->phase[MAL_SCENARIO_OPTIMIZE])(c);
+               */
 
        *fcn = c->curprg;
        c->curprg = 0;
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
@@ -14,8 +14,7 @@
  * In MonetDB multiple languages and execution engines can
  * be combined at run time to satisfy a wide user-community.
  * Such an assemblage of components is called a @emph{scenario}
- * and consists of a @emph{reader}, @emph{parser}
- * and @emph{engine}. These hooks allow
+ * and consists of a @emph{engine}. These hooks allow
  * for both linked-in and external components.
  *
  * The languages supported are SQL, the Monet Assembly Language (MAL), and 
profiler.
@@ -28,11 +27,6 @@
  * data in large chunks, if possible. In interactive mode the lines
  * are processed one at a time.
  *
- * The MAL parser component turns the string into
- * an internal representation of the MAL program.
- * During this phase semantic checks are performed, such that
- * we end up with a type correct program.
- *
  * The final stage is to choose an execution paradigm,
  * i.e. interpretative (default), compilation of an ad-hoc user
  * defined function, dataflow driven interpretation,
@@ -94,10 +88,6 @@ static struct SCENARIO scenarioRec[MAXSC
                .initClientCmd = (MALfcn) MALinitClient,
                .exitClient = "MALexitClient",
                .exitClientCmd = (MALfcn) MALexitClient,
-               .reader = "MALreader",
-               .readerCmd = (MALfcn) MALreader,
-               .parser = "MALparser",
-               .parserCmd = (MALfcn) MALparser,
                .engine = "MALengine",
                .engineCmd = (MALfcn) MALengine,
                .callback = "MALcallback",
@@ -160,7 +150,6 @@ showScenario(stream *f, Scenario scen)
        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->parser, scen->parserCmd);
        print_scenarioCommand(f, scen->callback, scen->callbackCmd);
        print_scenarioCommand(f, scen->engine, scen->engineCmd);
        mnstr_printf(f, "]\n");
@@ -219,8 +208,6 @@ fillScenario(Client c, Scenario scen)
 {
        c->scenario = scen->name;
 
-       c->phase[MAL_SCENARIO_READER] = scen->readerCmd;
-       c->phase[MAL_SCENARIO_PARSER] = scen->parserCmd;
        c->phase[MAL_SCENARIO_CALLBACK] = scen->callbackCmd;
        c->phase[MAL_SCENARIO_ENGINE] = scen->engineCmd;
        c->phase[MAL_SCENARIO_INITCLIENT] = scen->initClientCmd;
@@ -297,13 +284,6 @@ resetScenario(Client c)
  * The client scenario initialization and finalization brackets
  * are  @sc{xyzinitClient()} and @sc{xyzexitClient()}.
  *
- * The @sc{xyzparser(Client c)} contains the parser for language XYZ
- * and should fill the MAL program block associated with the client record.
- * The latter may have been initialized with variables.
- * Each language parser may require a catalog with information
- * on the translation of language specific datastructures into their BAT
- * equivalent.
- *
  * The @sc{xyzengine(Client c)} contains the applicable back-end engine.
  * The default is the MAL interpreter, which provides good balance
  * between speed and ability to analysis its behavior.
@@ -314,9 +294,6 @@ static const char *phases[] = {
        [MAL_SCENARIO_ENGINE] = "scenario engine",
        [MAL_SCENARIO_EXITCLIENT] = "scenario exitclient",
        [MAL_SCENARIO_INITCLIENT] = "scenario initclient",
-       [MAL_SCENARIO_OPTIMIZE] = "scenario optimize",
-       [MAL_SCENARIO_PARSER] = "scenario parser",
-       [MAL_SCENARIO_READER] = "scenario reader",
 };
 static str
 runPhase(Client c, int phase)
@@ -340,12 +317,6 @@ runScenarioBody(Client c)
 
        while (c->mode > FINISHCLIENT && !GDKexiting()) {
                /* later merge the phases */
-               if ( c->mode <= FINISHCLIENT ||  (msg = runPhase(c, 
MAL_SCENARIO_READER)) )
-                       goto wrapup;
-               if ( c->mode <= FINISHCLIENT  || (msg = runPhase(c, 
MAL_SCENARIO_PARSER)) || c->blkmode)
-                       goto wrapup;
-               if ( c->mode <= FINISHCLIENT ||  (msg = runPhase(c, 
MAL_SCENARIO_OPTIMIZE)) )
-                       goto wrapup;
                if ( c->mode <= FINISHCLIENT || (msg = runPhase(c, 
MAL_SCENARIO_ENGINE)))
                        goto wrapup;
        wrapup:
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
@@ -13,13 +13,10 @@
 
 #include "mal_import.h"
 
-#define MAL_SCENARIO_READER 0
-#define MAL_SCENARIO_PARSER  1
-#define MAL_SCENARIO_OPTIMIZE 2
-#define MAL_SCENARIO_ENGINE 3
-#define MAL_SCENARIO_INITCLIENT 4
-#define MAL_SCENARIO_EXITCLIENT 5
-#define MAL_SCENARIO_CALLBACK 6
+#define MAL_SCENARIO_ENGINE 0
+#define MAL_SCENARIO_INITCLIENT 1
+#define MAL_SCENARIO_EXITCLIENT 2
+#define MAL_SCENARIO_CALLBACK 3
 
 /*#define MAL_SCENARIO_DEBUG*/
 /*
@@ -41,10 +38,6 @@ typedef struct SCENARIO {
        MALfcn initClientCmd;
        str exitClient;
        MALfcn exitClientCmd;
-       str reader;
-       MALfcn readerCmd;
-       str parser;
-       MALfcn parserCmd;
        str engine;
        MALfcn engineCmd;
        str callback;
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
@@ -64,6 +64,7 @@ malBootstrap(char *modules[], bool embed
                MCcloseClient(c);
                return msg;
        }
+       /*
        pushEndInstruction(c->curprg->def);
        msg = chkProgram(c->usermodule, c->curprg->def);
        if ( msg != MAL_SUCCEED || (msg= c->curprg->def->errors) != MAL_SUCCEED 
) {
@@ -71,6 +72,7 @@ malBootstrap(char *modules[], bool embed
                return msg;
        }
        msg = MALengine(c);
+       */
        MCcloseClient(c);
        return msg;
 }
@@ -651,7 +653,7 @@ MALexitClient(Client c)
        return NULL;
 }
 
-str
+static str
 MALreader(Client c)
 {
        if (MCreadClient(c) > 0)
@@ -799,10 +801,20 @@ MALengine(Client c)
        Symbol prg;
        str msg = MAL_SUCCEED;
 
+       do {
+       if ((msg = MALreader(c)) != MAL_SUCCEED)
+               return msg;
+       if (c->mode == FINISHCLIENT)
+               return msg;
+       if ((msg = MALparser(c)) != MAL_SUCCEED)
+               return msg;
+       } while(c->blkmode);
+       /*
+       if (c->blkmode)
+               return MAL_SUCCEED;
+               */
        if ((msg = MALoptimizer(c)) != MAL_SUCCEED)
                return msg;
-       if (c->blkmode)
-               return MAL_SUCCEED;
        prg = c->curprg;
        if (prg == NULL)
                throw(SYNTAX, "mal.engine", SYNTAX_SIGNATURE);
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
@@ -18,11 +18,9 @@ mal_export str malBootstrap(char *module
 mal_export str MSinitClientPrg(Client cntxt, const char *mod, const char *nme);
 mal_export void MSscheduleClient(str command, str challenge, bstream *fin, 
stream *fout, protocol_version protocol, size_t blocksize);
 
-mal_export str MALreader(Client c);
 mal_export str MALinitClient(Client c);
 mal_export str MALexitClient(Client c);
 mal_export str MALparser(Client c);
-//mal_export str MALoptimizer(Client c);
 mal_export str MALengine(Client c);
 mal_export str MALcallback(Client c, str msg);
 mal_export void MSresetInstructions(MalBlkPtr mb, int start);
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
@@ -110,10 +110,6 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
                .initClientCmd = SQLinitClient,
                .exitClient = "SQLexitClient",
                .exitClientCmd = SQLexitClient,
-               //.reader = "SQLreader",
-               //.readerCmd = SQLreader,
-               //.parser = "SQLparser",
-               //.parserCmd = SQLparser,
                .engine = "SQLengine",
                .engineCmd = SQLengine,
                .callback = "SQLcallback",
@@ -132,10 +128,6 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
                .initClientCmd = SQLinitClientFromMAL,
                .exitClient = "SQLexitClient",
                .exitClientCmd = SQLexitClient,
-               .reader = "MALreader",
-               .readerCmd = MALreader,
-               .parser = "MALparser",
-               .parserCmd = MALparser,
                .engine = "MALengine",
                .engineCmd = MALengine,
                .callback = "MALcallback",
diff --git a/sql/backends/monet5/sql_scenario.h 
b/sql/backends/monet5/sql_scenario.h
--- a/sql/backends/monet5/sql_scenario.h
+++ b/sql/backends/monet5/sql_scenario.h
@@ -24,8 +24,6 @@ sql5_export str SQLexitClient(Client c);
 sql5_export str SQLresetClient(Client c);
 sql5_export str SQLinitClient(Client c, const char *passwd, const char 
*challenge, const char *algo);
 sql5_export str SQLinitClientFromMAL(Client c, const char *passwd, const char 
*challenge, const char *algo);
-//sql5_export str SQLreader(Client c);
-//sql5_export str SQLparser(Client c);
 sql5_export str SQLengine(Client c);
 sql5_export str SQLcallback(Client c, str msg);
 extern str handle_error(mvc *m, int pstatus, str msg);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to