Changeset: a0b59551d7e3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a0b59551d7e3
Modified Files:
        monetdb5/mal/mal_session.c
Branch: default
Log Message:

mal_session: uncrustify, fix comments


diffs (truncated from 509 to 300 lines):

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
@@ -17,21 +17,6 @@
  * All Rights Reserved.
  */
 
-/*
- * @a M. Kersten
- * @v 0.0
- * @- Server Bootstrapping
- *
- * The MonetDB server uses a startup script to boot the system.
- * This script is an ordinary MAL program, but will mostly
- * consist of include statements to load modules of general interest.
- * The startup script is ran as user Admin.
- * Its location is described in Monet configuration file.
- * The default location is:  !!!%%% TODO %%%!!! <-- FIXME
- *
- * It may overwritten using a command line argument.
- *
- */
 #include "monetdb_config.h"
 #include "mal_session.h"
 #include "mal_instruction.h" /* for pushEndInstruction() */
@@ -44,13 +29,19 @@
 #include "mal_sabaoth.h"
 #include <gdk.h>       /* for opendir and friends */
 
+/*
+ * The MonetDB server uses a startup script to boot the system.
+ * This script is an ordinary MAL program, but will mostly
+ * consist of include statements to load modules of general interest.
+ * The startup script is ran as user Admin.
+ */
 int
 malBootstrap(void)
 {
        Client c;
        str bootfile = "mal_init", s;
 
-       c = MCinitClient((oid)0, 0, 0);
+       c = MCinitClient((oid) 0, 0, 0);
        assert(c != NULL);
        c->nspace = newModule(NULL, putName("user", 4));
        initLibraries();
@@ -59,7 +50,7 @@ malBootstrap(void)
                return 0;
        }
        MSinitClientPrg(c, "user", "main");
-       (void)MCinitClientThread(c);
+       (void) MCinitClientThread(c);
        s = malInclude(c, bootfile, 0);
        if (s != NULL) {
                mnstr_printf(GDKout, "!%s\n", s);
@@ -77,48 +68,43 @@ malBootstrap(void)
 }
 
 /*
- * @+ Client main routine
- * Every client has a 'main' function to collect the statements.
- * Once the END instruction has been found, it is added to the
- * symbol table and a fresh container is being constructed.
- * Note, this scheme makes testing for recursive function calls a
- * little more difficult. Therefore, type checking should be performed
- * afterwards.
+ * Every client has a 'main' function to collect the statements.  Once
+ * the END instruction has been found, it is added to the symbol table
+ * and a fresh container is being constructed.  Note, this scheme makes
+ * testing for recursive function calls a little more difficult.
+ * Therefore, type checking should be performed afterwards.
  *
- * In interactive mode,  the closing statement is never reached.
- * The 'main' procedure is typically cleaned between successive external
- * messages except for its variables, which are considerd global.
- * This storage container is re-used when during the previous call
- * nothing was added.
- * At the end of the session we have to garbage collect the BATs
- * introduced.
+ * In interactive mode,  the closing statement is never reached.  The
+ * 'main' procedure is typically cleaned between successive external
+ * messages except for its variables, which are considerd global.  This
+ * storage container is re-used when during the previous call nothing
+ * was added.  At the end of the session we have to garbage collect the
+ * BATs introduced.
  */
-
 static void
 MSresetClientPrg(Client cntxt)
 {
        MalBlkPtr mb;
        InstrPtr p;
 
-       cntxt->itrace = 0;      /* turn off any debugging */
+       cntxt->itrace = 0;  /* turn off any debugging */
        mb = cntxt->curprg->def;
        mb->typefixed = 0;
        mb->flowfixed = 0;
        mb->stop = 1;
-       mb->errors=0;
-       p= mb->stmt[0];
+       mb->errors = 0;
+       p = mb->stmt[0];
 
        p->gc = 0;
-       p->retc=1;
-       p->argc=1;
+       p->retc = 1;
+       p->argc = 1;
        /* remove any MAL history */
-       if( mb->history){
+       if (mb->history) {
                freeMalBlk(mb->history);
-               mb->history=0;
+               mb->history = 0;
        }
 }
 
-
 void
 MSinitClientPrg(Client cntxt, str mod, str nme)
 {
@@ -143,9 +129,8 @@ MSinitClientPrg(Client cntxt, str mod, s
 }
 
 /*
- * @+ Client authorization
- * The default method to interact with the database server is to
- * connect using a port number. The first line received should contain
+ * The default method to interact with the database server is to connect
+ * using a port number. The first line received should contain
  * authorization information, such as user name.
  *
  * The scheduleClient receives a challenge response consisting of
@@ -227,11 +212,11 @@ MSscheduleClient(str command, str challe
        }
 
        if (!GDKembedded && database != NULL && database[0] != '\0' &&
-                       strcmp(database, GDKgetenv("gdk_dbname")) != 0)
+               strcmp(database, GDKgetenv("gdk_dbname")) != 0)
        {
                mnstr_printf(fout, "!request for database '%s', "
-                               "but this is database '%s', "
-                               "did you mean to connect to monetdbd 
instead?\n",
+                                                  "but this is database '%s', "
+                                                  "did you mean to connect to 
monetdbd instead?\n",
                                database, GDKgetenv("gdk_dbname"));
                /* flush the error to the client, and abort further execution */
                mnstr_flush(fout);
@@ -258,12 +243,12 @@ MSscheduleClient(str command, str challe
                        err = SABAOTHgetMyStatus(&stats);
                        if (err != MAL_SUCCEED) {
                                /* this is kind of awful, but we need to get 
rid of this
-                               * message */
+                                * message */
                                fprintf(stderr, "!SABAOTHgetMyStatus: %s\n", 
err);
                                if (err != M5OutOfMemory)
                                        GDKfree(err);
                                mnstr_printf(fout, "!internal server error, "
-                                               "please try again later\n");
+                                                                  "please try 
again later\n");
                                mnstr_flush(fout);
                                GDKfree(command);
                                return;
@@ -271,10 +256,10 @@ MSscheduleClient(str command, str challe
                        if (stats->locked == 1) {
                                if (uid == 0) {
                                        mnstr_printf(fout, "#server is running 
in "
-                                                       "maintenance mode\n");
+                                                                          
"maintenance mode\n");
                                } else {
                                        mnstr_printf(fout, "!server is running 
in "
-                                                       "maintenance mode, 
please try again later\n");
+                                                                          
"maintenance mode, please try again later\n");
                                        mnstr_flush(fout);
                                        SABAOTHfreeStatus(&stats);
                                        GDKfree(command);
@@ -287,7 +272,7 @@ MSscheduleClient(str command, str challe
                c = MCinitClient(uid, fin, fout);
                if (c == NULL) {
                        mnstr_printf(fout, "!maximum concurrent client limit 
reached "
-                                       "(%d), please try again later\n", 
MAL_MAXCLIENTS);
+                                                          "(%d), please try 
again later\n", MAL_MAXCLIENTS);
                        mnstr_flush(fout);
                        GDKfree(command);
                        return;
@@ -306,12 +291,12 @@ MSscheduleClient(str command, str challe
                }
        }
 
-       MSinitClientPrg(c,"user", "main");
+       MSinitClientPrg(c, "user", "main");
 
        GDKfree(command);
        if (MT_create_thread(&p, MSserveClient, (void *) c, MT_THR_DETACHED) != 
0) {
                mnstr_printf(fout, "!internal server error (cannot fork new "
-                               "client thread), please try again later\n");
+                                                  "client thread), please try 
again later\n");
                mnstr_flush(fout);
                showException(c->fdout, MAL, "initClient", "cannot fork new 
client thread");
                return;
@@ -319,27 +304,25 @@ MSscheduleClient(str command, str challe
 }
 
 /*
- * @+ Client services
- * After the client initialization has been finished, we
- * can start the interaction protocol. This involves parsing the
- * input in the context of an already defined procedure and upon
- * success, its execution.
+ * After the client initialization has been finished, we can start the
+ * interaction protocol. This involves parsing the input in the context
+ * of an already defined procedure and upon success, its execution.
  *
- * In essence, this calls for an incremental parsing operation,
- * because we should wait until a complete basic block has been detected.
- * Test, first collect the instructions before we take them all.
- * @-
+ * In essence, this calls for an incremental parsing operation, because
+ * we should wait until a complete basic block has been detected.  Test,
+ * first collect the instructions before we take them all.
+ *
  * In interactive mode, we should remove the instructions before
- * accepting new ones. The function signature remains the same
- * and the symbol table should also not be affected.
- * Aside from removing instruction, we should also condense the
- * variable stack, i.e. removing at least the temporary variables,
- * but maybe everything beyond a previous defined pont.
+ * accepting new ones. The function signature remains the same and the
+ * symbol table should also not be affected.  Aside from removing
+ * instruction, we should also condense the variable stack, i.e.
+ * removing at least the temporary variables, but maybe everything
+ * beyond a previous defined pont.
  *
- * Beware that we have to cleanup the global stack as well. This to avoid
- * subsequent calls to find garbage information.
- * However, this action is only required after a successful execution.
- * Otherwise, garbage collection is not needed.
+ * Beware that we have to cleanup the global stack as well. This to
+ * avoid subsequent calls to find garbage information.  However, this
+ * action is only required after a successful execution.  Otherwise,
+ * garbage collection is not needed.
  */
 void
 MSresetInstructions(MalBlkPtr mb, int start)
@@ -357,48 +340,46 @@ MSresetInstructions(MalBlkPtr mb, int st
 }
 
 /*
- * @-
- * Determine the variable being used and clear non-used onces.
+ * Determine the variables being used and clear non-used onces.
  */
 void
 MSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start)
 {
        int i, k;
-       bit *used= GDKzalloc(mb->vtop * sizeof(bit));
+       bit *used = GDKzalloc(mb->vtop * sizeof(bit));
 
-       for (i=0; i<start && start<mb->vtop; i++)
-               used[i]=1;
-       if (mb->errors==0)
-       for (i = start; i < mb->vtop; i++) {
-               if (used[i] || !isTmpVar(mb,i) ){
-                       VarPtr v = getVar(mb,i);
-                       assert(!mb->var[i]->value.vtype || isVarConstant(mb,i) 
);
+       for (i = 0; i < start && start < mb->vtop; i++)
+               used[i] = 1;
+       if (mb->errors == 0)
+               for (i = start; i < mb->vtop; i++) {
+                       if (used[i] || !isTmpVar(mb, i)) {
+                               VarPtr v = getVar(mb, i);
+                               assert(!mb->var[i]->value.vtype || 
isVarConstant(mb, i));
 
-                       /* keep all properties as well */
-                       for (k=0; k< v->propc; k++)
-                               used[mb->prps[k].var]=1;
-                       used[i]= 1;
+                               /* keep all properties as well */
+                               for (k = 0; k < v->propc; k++)
+                                       used[mb->prps[k].var] = 1;
+                               used[i] = 1;
+                       }
+                       if (glb && !used[i]) {
+                               if (isVarConstant(mb, i))
+                                       garbageElement(cntxt, &glb->stk[i]);
+                               /* clean stack entry */
+                               glb->stk[i].vtype = TYPE_int;
+                               glb->stk[i].len = 0;
+                               glb->stk[i].val.pval = 0;
+                       }
                }
-               if (glb && !used[i]) {
-                       if (isVarConstant(mb,i))
-                               garbageElement(cntxt, &glb->stk[i]);
-                       /* clean stack entry */
-                       glb->stk[i].vtype = TYPE_int;
-                       glb->stk[i].len = 0;
-                       glb->stk[i].val.pval = 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to