Changeset: 7c38d9c2f6a0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7c38d9c2f6a0
Modified Files:
monetdb5/extras/dvf/dvf.c
monetdb5/extras/dvf/opt_dvf.mx
sql/backends/monet5/miniseed/miniseed.c
sql/backends/monet5/miniseed/registrar.c
Branch: DVframework
Log Message:
indentation clean up.
diffs (truncated from 1713 to 300 lines):
diff --git a/monetdb5/extras/dvf/dvf.c b/monetdb5/extras/dvf/dvf.c
--- a/monetdb5/extras/dvf/dvf.c
+++ b/monetdb5/extras/dvf/dvf.c
@@ -17,7 +17,7 @@ int get_column_type(str schema_name, str
{
if(strcmp(schema_name, "mseed") != 0 || strcmp(table_name, "data") != 0)
return -1;
-
+
switch(column_num)
{
case 0:
@@ -37,7 +37,7 @@ int get_column_num(str schema_name, str
{
if(strcmp(schema_name, "mseed") != 0 || strcmp(table_name, "data") != 0)
return -1;
-
+
if(strcmp(column_name, "file_location") == 0)
return 0;
else if(strcmp(column_name, "seq_no") == 0)
@@ -57,12 +57,12 @@ str plan_modifier(Client cntxt, MalBlkPt
str miniseedRef = putName("miniseed", 8);
str dvfRef = putName("dvf", 3);
str planmodifierRef = putName("plan_modifier", 13);
-
+
InstrPtr *old = NULL, *mounts = NULL, q = NULL, r = NULL, s = NULL, o =
NULL;
int i, j, k, limit, slimit, actions = 0;
int num_fl = 0;
BUN b1 = 0, b2 = 0;
-
+
/* Declarations for copying of vars into stack and making a recursive
runMALsequence call */
str msg = MAL_SUCCEED;
MalStkPtr stk_new;
@@ -70,76 +70,76 @@ str plan_modifier(Client cntxt, MalBlkPt
int startpc = 1000000, old_vtop = 0;
MalBlkPtr copy_old, copy_mb;
bit is_stack_new = FALSE;
-
+
BAT *BAT_fl = NULL; //BAT for file_locations
-
+
bit after_first_data_bind = FALSE;
-
+
str *schema_name = (str*) getArgReference(stk,pci,1); //arg 1:
schema_name
int bat_fl = *(int*) getArgReference(stk,pci,2); //arg 2: bat of
file_locations
-
+
BATiter fli;
-
+
VarRecord low, high;
-
+
/* prepare to set low and high oids of return vars of mounts */
high.value.vtype= low.value.vtype= TYPE_oid;
high.value.val.oval = 0;
low.value.val.oval = 0;
-
+
/* check for logical error: mb must never be NULL */
assert (mb != NULL);
-
+
cntxt = cntxt; //to escape 'unused' parameter error.
stk = stk; //to escape 'unused' parameter error.
pci = pci; //to escape 'unused' parameter error.
-
+
if ((BAT_fl = BATdescriptor(bat_fl)) == NULL)
throw(MAL, "dvf.plan_modifier", RUNTIME_OBJECT_MISSING);
-
+
/* check tail type */
- if (BAT_fl->ttype != TYPE_str)
+ if (BAT_fl->ttype != TYPE_str)
{
throw(MAL, "dvf.plan_modifier",
"tail-type of input BAT must be TYPE_str");
}
-
+
BBPincref(bat_fl, TRUE);
-
+
num_fl = BAT_fl->U->count;
-
+
// when number of files to be mounted is 0.
if(num_fl == 0)
goto finish;
-
+
/* prepare to keep the potential mount instructions */
mounts = (InstrPtr*)GDKmalloc(num_fl*sizeof(InstrPtr));
if(mounts == NULL)
throw(MAL, "dvf.plan_modifier", MAL_MALLOC_FAIL);
-
+
/* save the old stage of the MAL block */
copy_mb = copyMalBlk(mb);
copy_old = mb;
mb = copy_mb;
-
+
old = mb->stmt;
limit= mb->stop;
slimit = mb->ssize;
-
-
+
+
/* initialize the statement list. Notice, the symbol table remains
intact */
if (newMalBlkStmt(mb, slimit) < 0)
return 0;
-
+
/* iterate over the instructions of the input MAL program, skip the
dvf.plan_modifier itself. */
- for (i = 0; i < limit; i++)
+ for (i = 0; i < limit; i++)
{
InstrPtr p = old[i];
-
+
/* check for
* dvf.plan_modifier(...);
*/
- if(getModuleId(p) == dvfRef &&
+ if(getModuleId(p) == dvfRef &&
getFunctionId(p) == planmodifierRef)
{
startpc = i;
@@ -148,7 +148,7 @@ str plan_modifier(Client cntxt, MalBlkPt
/* check for
* v7 := sql.bind(..., schema_name, data_table_name, ..., ...);
*/
- else if(getModuleId(p) == sqlRef &&
+ else if(getModuleId(p) == sqlRef &&
getFunctionId(p) == bindRef &&
p->argc == 6 &&
p->retc == 1 &&
@@ -164,16 +164,16 @@ str plan_modifier(Client cntxt, MalBlkPt
// push mount instructions
/* create BAT iterator */
fli = bat_iterator(BAT_fl);
-
+
/* advice on sequential scan */
BATaccessBegin(BAT_fl, USE_TAIL,
MMAP_SEQUENTIAL);
-
- BATloop(BAT_fl, b1, b2)
+
+ BATloop(BAT_fl, b1, b2)
{
int a = 0, type;
/* get tail value */
str t = (str) BUNtail(fli, b1);
-
+
//create mount instruction
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, miniseedRef);
@@ -187,47 +187,47 @@ str plan_modifier(Client cntxt, MalBlkPt
varSetProp(mb, getArg(q, a),
PropertyIndex("hlb"), op_gte, (ptr) &low.value);
varSetProp(mb, getArg(q, a),
PropertyIndex("hub"), op_lt, (ptr) &high.value);
}
-
+
q = pushStr(mb, q, t);
-
+
low.value.val.oval += 1;
high.value.val.oval += 1;
-
+
mounts[which_fl] = q;
which_fl++;
// push the new instruction
pushInstruction(mb, q);
actions++;
}
-
+
BATaccessEnd(BAT_fl, USE_TAIL, MMAP_SEQUENTIAL);
-
+
/* check for logical error */
assert(which_fl == num_fl);
-
+
}
-
+
// new mat.new for the column being binded
r = newInstruction(mb, ASSIGNsymbol);
setModuleId(r, matRef);
setFunctionId(r, newRef);
r = pushReturn(mb, r, newTmpVariable(mb, TYPE_any)); //
push tmp var to pass to markH.
- which_column = get_column_num(*schema_name,
getVarConstant(mb, getArg(p, 3)).val.sval,
+ which_column = get_column_num(*schema_name,
getVarConstant(mb, getArg(p, 3)).val.sval,
getVarConstant(mb,
getArg(p, 4)).val.sval);
if(which_column < 0)
- throw(MAL, "dvf.get_column_num", "is not
defined yet for schema: %s and table: %s and column: %s.",
+ throw(MAL, "dvf.get_column_num", "is not
defined yet for schema: %s and table: %s and column: %s.",
*schema_name, getVarConstant(mb,
getArg(p, 3)).val.sval, getVarConstant(mb, getArg(p, 4)).val.sval);
for(; which_mount < num_fl; which_mount++)
{
r = pushArgument(mb, r,
getArg(mounts[which_mount], which_column));
}
-
+
setVarInit(mb, getArg(r, 0));
-
+
// push the new instruction
pushInstruction(mb, r);
actions++;
-
+
// arrange oids of return val of mat.new
s = newInstruction(mb, ASSIGNsymbol);
setModuleId(s, algebraRef);
@@ -235,23 +235,23 @@ str plan_modifier(Client cntxt, MalBlkPt
s = pushReturn(mb, s, getArg(p, 0)); // push the ret of
sql.bind as ret of (mat.new + algebra.markH)
s = pushArgument(mb, s, getArg(r, 0));
s = pushOid(mb, s, 0);
-
+
// push the new instruction
pushInstruction(mb, s);
actions++;
// s = s;
-
+
// comment out in the old for reusing the old
copy_old->stmt[i]->token = REMsymbol;
-
+
}
else
{
// push instruction
pushInstruction(mb, copyInstruction(old[i]));
-
+
if (p->token == ENDsymbol) break;
-
+
// comment out in the old for reusing the old
if(i > startpc)
{
@@ -267,22 +267,22 @@ str plan_modifier(Client cntxt, MalBlkPt
for(i++; i<limit; i++)
if (old[i])
pushInstruction(mb, copyInstruction(old[i]));
-
-
+
+
/* save the vtop before calling any optimizer. */
old_vtop = mb->vtop;
-
+
/* call necessary optimizers
*
*optimizer.inline();optimizer.remap();optimizer.evaluate();optimizer.costModel();optimizer.coercions();optimizer.emptySet();optimizer.aliases();
optimizer.mergetable();optimizer.deadcode();optimizer.commonTerms();optimizer.groups();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.history();optimizer.multiplex();optimizer.accumulators();optimizer.garbageCollector();
*/
-
+
o = newFcnCall(mb, "optimizer", "mergetable");
typeChecker(cntxt->fdout, cntxt->nspace, mb, o, FALSE);
optimizeMALBlock(cntxt, mb);
-
+
/* New variables might have been created by the optimizers, so their
values has to be copied into the stack. However, there might not be enough
space in stack for them. We cannot reallocate the stack, but we may create our
own enlarged stack, then run the rest of the plan with our own stack. */
-
+
// arrange the new stack without freeing the old one.
if (stk->stksize > mb->vsize)
stk_new = stk;
@@ -294,7 +294,7 @@ str plan_modifier(Client cntxt, MalBlkPt
stk_new->stksize = k;
is_stack_new = TRUE;
}
-
+
//copy values into the new stack
for (j = 0; j < mb->vtop; j++) {
lhs = &stk_new->stk[j];
@@ -303,15 +303,15 @@ str plan_modifier(Client cntxt, MalBlkPt
rhs = &getVarConstant(mb, j);
VALcopy(lhs, rhs);
}
- }
- else
- {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list