Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28759/src/mal

Modified Files:
      Tag: GDK-2
        mal_authorize.mx mal_debugger.mx mal_instruction.mx 
        mal_parser.mx mal_session.mx 
Log Message:
propagated changes of Friday Aug 17 2007
from the development trunk to the GDK-2 branch


Index: mal_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_parser.mx,v
retrieving revision 1.200
retrieving revision 1.200.2.1
diff -u -d -r1.200 -r1.200.2.1
--- mal_parser.mx       25 Jul 2007 10:49:13 -0000      1.200
+++ mal_parser.mx       17 Aug 2007 15:36:34 -0000      1.200.2.1
@@ -1445,7 +1445,7 @@
                advance(cntxt,1); /* skip ')' */
                if( curInstr->retc == 0){
                                /* add dummy variable */
-                               pushArgument(curBlk,curInstr, 
newTmpVariable(curBlk,TYPE_any));
+                               curInstr= pushArgument(curBlk,curInstr, 
newTmpVariable(curBlk,TYPE_any));
                                curInstr->retc++;
                }
        } else { 

Index: mal_debugger.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_debugger.mx,v
retrieving revision 1.200.2.2
retrieving revision 1.200.2.3
diff -u -d -r1.200.2.2 -r1.200.2.3
--- mal_debugger.mx     15 Aug 2007 22:37:56 -0000      1.200.2.2
+++ mal_debugger.mx     17 Aug 2007 15:36:29 -0000      1.200.2.3
@@ -473,7 +473,7 @@
 mal_export void mdbCommand(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p, int pc);
 mal_export int mdbSession(void);
 mal_export void mdbStep(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc);
-mal_export void mdbDump(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc);
+mal_export void mdbDump(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 mal_export void mdbHelp(stream *f);
 mal_export void printStackElm(stream *f, MalBlkPtr mb, VarPtr n, ValPtr v, int 
index, size_t cnt, int first, int lifespan);
 mal_export void printBATelm(stream *f, int i, size_t cnt, size_t first);
@@ -759,7 +759,7 @@
 {
        str msg;
        msg = call2str(mb, stk, pc, cntxt->flags);
-       stream_printf(cntxt->fdout, "%s at %s.%s[%d]\n", msg, 
+       stream_printf(cntxt->fdout, "#%s at %s.%s[%d]\n", msg, 
                getModuleId(getInstrPtr(mb,0)),
                getFunctionId(getInstrPtr(mb,0)),pc);
        GDKfree(msg);
@@ -1376,10 +1376,12 @@
 }
 
 void 
-mdbDump(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc){
-       stream_printf(cntxt->fdout,"!MDB dump of instruction %d\n",pc);
+mdbDump(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+       Client cntxt= MCgetClient();
+       int i= getPC(mb,pci);
+       stream_printf(cntxt->fdout,"!MDB dump of instruction %d\n",i);
        printFunction(cntxt->fdout, mb, LIST_MAL_ALL | LIST_MAL_PROPS);
-       mdbBacktrace(cntxt, stk, pc);
+       mdbBacktrace(cntxt, stk, i);
        printStack(cntxt->fdout,mb,stk,0);
 }
 static int mdbSessionActive;
@@ -1476,6 +1478,7 @@
                /* return from this debugger */
                for (su = stk; su; su = su->up)
                        su->cmd = 0;
+               stream_printf(cntxt->fdout,"mdb>#EOD\n");
                stk->cmd = 'x'; /* will force a graceful termination */
        }
        if( mdbSessionActive== 0) return;

Index: mal_authorize.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_authorize.mx,v
retrieving revision 1.49.4.1
retrieving revision 1.49.4.2
diff -u -d -r1.49.4.1 -r1.49.4.2
--- mal_authorize.mx    10 Aug 2007 14:54:49 -0000      1.49.4.1
+++ mal_authorize.mx    17 Aug 2007 15:36:26 -0000      1.49.4.2
@@ -919,7 +919,7 @@
        int keylen = 0;
 
        if (vaultKey == NULL)
-               throw(MAL, "decypherValue", "The vault is still locked!");
+               throw(MAL, "cypherValue", "The vault is still locked!");
 
        keylen = strlen(vaultKey);
 

Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.282
retrieving revision 1.282.2.1
diff -u -d -r1.282 -r1.282.2.1
--- mal_instruction.mx  10 Jul 2007 11:14:11 -0000      1.282
+++ mal_instruction.mx  17 Aug 2007 15:36:32 -0000      1.282.2.1
@@ -302,7 +302,7 @@
 #endif
 
 #define DEBUG_MAL_INSTR
-#define MAXARG 9
+#define MAXARG 4
 #define STMT_INCREMENT 32
 #define STMT_MAXIMUM  1<<16
 #define MAXVARS 32
@@ -1752,7 +1752,7 @@
        return vr->vtype != type;
 }
 
-#define MAL_VAR_WINDOW  4*MAXARG
+#define MAL_VAR_WINDOW  32
 int
 fndConstant(MalBlkPtr mb, ValPtr cst)
 {
@@ -1834,10 +1834,12 @@
                pn = GDKmalloc(space + MAXARG * sizeof(int));
                memcpy((char *) pn, (char *) p, space);
                pn->maxarg = p->maxarg + MAXARG;
-               pc = getPC(mb, p);
-               if (pc >= 0)
+               /* most likely the last instruction is affected */
+               for(pc= mb->stop-1; pc >= 0; pc--)
+               if( mb->stmt[pc]== p){
                        mb->stmt[pc] = pn;
-
+                       break;
+               }
                GDKfree(p);
                p = pn;
        }

Index: mal_session.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_session.mx,v
retrieving revision 1.137
retrieving revision 1.137.4.1
diff -u -d -r1.137 -r1.137.4.1
--- mal_session.mx      2 Jun 2007 21:17:37 -0000       1.137
+++ mal_session.mx      17 Aug 2007 15:36:35 -0000      1.137.4.1
@@ -60,6 +60,7 @@
 #include "mal_namespace.h"
 #include "mal_readline.h"
 #include "mal_authorize.h"
+#include "mal_sabaoth.h"
 #include <gdk.h>       /* for opendir and friends */
 
 int
@@ -242,92 +243,38 @@
        if (database && database[0] != '\0' &&
                        strcmp(database, GDKgetenv("gdk_dbname")) != 0)
        {
-               DIR *d;
-               struct dirent *e;
-               int found = 0;
-               str buf = alloca(sizeof(char) * (PATHLENGTH + 1));
-               str p;
-               int len;
-               FILE *f;
-               str err = NULL;
-               str redir;
-
-               buf[PATHLENGTH] = '\0';
-               /* scan the parent for directories */
-               d = opendir("..");
-               while ((e = readdir(d)) != NULL) {
-                       /* skip if not the database we're looking for */
-                       if (strcmp(e->d_name, database) != 0)
-                               continue;
-
-                       /* ok, look for some files we're interested in, start
-                        * checking if the server is connectable */
-                       snprintf(buf, PATHLENGTH, "../%s/.conn", e->d_name);
-                       if ((f = fopen(buf, "r")) == NULL) {
-                               err = "database not available or cannot be 
connected to";
-                               break;  /* we don't have to look further any 
more */
-                       }
-                       if ((len = fread(buf, 1, PATHLENGTH, f)) <= 0) {
-                               /* ok, won't work */
-                               fclose(f);
-                               err = "database cannot be connected to";
-                               break;
-                       }
-                       buf[len] = '\0';
-                       /* note: in theory, multiple addresses can be in this 
file.
-                        * We ignore this for now, and just connect to the 
first one */
-                       if ((p = strchr(buf, '\n')) == NULL) {
-                               /* somehow doesn't work */
-                               fclose(f);
-                               err = "database cannot be connected to";
-                               break;
-                       }
-                       *p = '\0';
-                       fclose(f);
-
-                       /* alloc some space */
-                       redir = alloca(sizeof(char) * (strlen(buf) + 2));
-                       sprintf(redir, "^%s", buf);
+               sabdb *stats;
+               str err;
 
-                       /* see if the server supports the language we're asking 
for */
-                       snprintf(buf, PATHLENGTH, "../%s/.scen", e->d_name);
-                       if ((f = fopen(buf, "r")) == NULL) {
-                               err = "language not supported";
-                               break;
-                       }
-                       if ((len = fread(buf, 1, PATHLENGTH, f)) <= 0) {
-                               /* ok, won't work */
-                               fclose(f);
-                               err = "database cannot be connected to";
-                               break;
-                       }
-                       buf[len] = '\0';
-                       while ((p = strchr(buf, '\n')) != NULL) {
-                               *p = '\0';
-                               if (strcmp(buf, lang) == 0) {
-                                       found = 1;
-                                       break;
-                               }
-                               buf = p + 1;
-                       }
-                       fclose(f);
+               err = SABAOTHgetStatus(&stats, database);
+               if (err != MAL_SUCCEED) {
+                       /* this is kind of awful, but we need to get rid of this
+                        * message */
+                       fprintf(stderr, "!SABAOTHgetStatus: %s\n", err);
+                       GDKfree(err);
+                       GDKfree(command);
+                       return;
+               }
 
-                       if (found == 1) {
-                               stream_printf(fout, "%s%s?lang=%s&user=%s\n",
-                                               redir, database, buf, user);
-                               /* flush redirect and return */
+               if (stats != NULL) {
+                       if (stats->conns != NULL &&
+                                       stats->conns->val != NULL &&
+                                       stats->state == SABdbRunning)
+                       {
+                               stream_printf(fout, "^%s%s\n",
+                                               stats->conns->val, 
stats->dbname);
                                stream_flush(fout);
-                               closedir(d);
-                               GDKfree(command);
-                               return;
                        } else {
-                               err = "language not supported";
-                               break;
+                               stream_printf(fout, "!database %s currently "
+                                               "not available\n", 
stats->dbname);
+                               stream_flush(fout);
                        }
-               }       
-               (void) closedir(d);
-               if (err == NULL) err = "database does not exist";
-               stream_printf(fout, "!redirect to database '%s': %s\n", 
database, err);
+                       SABAOTHfreeStatus(&stats);
+                       GDKfree(command);
+                       return;
+               }
+
+               stream_printf(fout, "!database '%s' does not exist\n", 
database);
                /* flush the error to the client, and abort further execution */
                stream_flush(fout);
                GDKfree(command);
@@ -696,6 +643,8 @@
                prg->def->profiler= NULL;
        }
        prg->def->errors = 0;
+       if( c->itrace)
+               stream_printf(c->fdout,"mdb>#EOD\n");
        return msg;
 }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to