Changeset: 7011c3667bb1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7011c3667bb1
Modified Files:
monetdb5/modules/mal/inout.c
monetdb5/modules/mal/inspect.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/replication.c
Branch: headless
Log Message:
Convert to MALtype
diffs (256 lines):
diff --git a/monetdb5/modules/mal/inout.c b/monetdb5/modules/mal/inout.c
--- a/monetdb5/modules/mal/inout.c
+++ b/monetdb5/modules/mal/inout.c
@@ -78,15 +78,15 @@
str
IOprintBoth(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int indx,
str hd, str tl, int nobat)
{
- int tpe = getArgType(mb, pci, indx);
+ MALtype tpe = getArgType(mb, pci, indx);
ptr val = (ptr) getArgReference(stk, pci, indx);
stream *fp = cntxt->fdout;
(void) mb;
- if (tpe == TYPE_any)
- tpe = stk->stk[pci->argv[indx]].vtype;
- if (val == NULL || tpe == TYPE_void) {
+ if (tpe.type == TYPE_any)
+ tpe.type = stk->stk[pci->argv[indx]].vtype;
+ if (val == NULL || tpe.type == TYPE_void) {
if (hd)
mnstr_printf(fp, "%s", hd);
mnstr_printf(fp, "nil");
@@ -94,7 +94,7 @@
mnstr_printf(fp, "%s", tl);
return MAL_SUCCEED;
}
- if (isaColType(tpe) ) {
+ if (tpe.col ) {
COL *b;
if (*(int *) val == 0) {
@@ -123,10 +123,10 @@
if (hd)
mnstr_printf(fp, "%s", hd);
- if (ATOMvarsized(tpe))
- ATOMprint(tpe, *(str *) val, fp);
+ if (ATOMvarsized(tpe.type))
+ ATOMprint(tpe.type, *(str *) val, fp);
else
- ATOMprint(tpe, val, fp);
+ ATOMprint(tpe.type, val, fp);
if (tl)
mnstr_printf(fp, "%s", tl);
@@ -533,15 +533,15 @@
IOtableAll(stream *f, Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci,
int i)
{
COL *piv[MAXPARAMS], *b;
- int nbats = 0;
- int tpe, k = i;
+ int nbats = 0, k=i;
+ MALtype tpe;
ptr val;
(void) cntxt;
for (; i < pci->argc; i++) {
tpe = getArgType(mb, pci, i);
val = (ptr) getArgReference(stk, pci, i);
- if (!isaColType(tpe))
+ if (!tpe.col)
throw(MAL, "io.table", ILLEGAL_ARGUMENT " column
expected");
b = COLdescriptor(*(int *) val);
if (b == NULL) {
diff --git a/monetdb5/modules/mal/inspect.c b/monetdb5/modules/mal/inspect.c
--- a/monetdb5/modules/mal/inspect.c
+++ b/monetdb5/modules/mal/inspect.c
@@ -606,7 +606,7 @@
str
INSPECTtypename(str *ret, int *tpe)
{
- *ret = getTypeName(*tpe);
+ *ret = getTypeName(newMALtype(*tpe));
return MAL_SUCCEED;
}
str
@@ -616,7 +616,7 @@
(void) cntxt;
ret = (int *) getArgReference(stk, pci, 0);
- *ret = getColType(getArgType(mb, pci, 1));
+ *ret = getArgType(mb, pci, 1).type;
return MAL_SUCCEED;
}
str
@@ -626,7 +626,7 @@
(void) stk;
(void) cntxt;
ret = (bit *) getArgReference(stk, pci, 0);
- *ret = getArgType(mb,pci,1)== getArgType(mb,pci,2);
+ *ret = CMPMALtype(getArgType(mb,pci,1), getArgType(mb,pci,2));
return MAL_SUCCEED;
}
@@ -638,11 +638,11 @@
hn = (str *) getArgReference(stk, pci, 0);
(void) cntxt;
- if (isaColType(getArgType(mb,pci,1) ) ){
+ if (getArgType(mb,pci,1).col ){
int *bid= (int*) getArgReference(stk,pci,1);
COL *b;
if ((b = CBPquickdesc(*bid, FALSE)) )
- *hn = getTypeName(newColType(COLtype(b)));
+ *hn = getTypeName(newMALtype(COLtype(b)));
else
*hn = getTypeName(getArgType(mb, pci, 1));
} else
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -488,7 +488,7 @@
mal_unset_lock(c->lock, "remote.get");
throw(MAL, "remote.get", tmp);
}
- h = getColType(rtype);
+ h = rtype.type;
b = COLnew(h, 32);
while (mapi_fetch_row(mhdl)) {
@@ -563,7 +563,7 @@
char ident[BUFSIZ];
connection c;
ValPtr v;
- int type;
+ MALtype tpe;
ptr value;
MapiHdl mhdl = NULL;
@@ -577,7 +577,7 @@
rethrow("remote.put", tmp, RMTfindconn(&c, conn));
/* put the thing */
- type = getArgType(mb, pci, 2);
+ tpe = getArgType(mb, pci, 2);
value = getArgReference(stk, pci, 2);
/* this call should be a single transaction over the channel*/
@@ -588,11 +588,11 @@
/* depending on the input object generate actions to store the
* object remotely*/
- if (isaTypeVar(type)) {
+ if (tpe.type == TYPE_any {
mal_unset_lock(c->lock, "remote.put");
throw(MAL, "remote.put", "unsupported type: %s",
- getTypeName(type));
- } else if (isaColType(type)) {
+ getTypeName(tpe));
+ } else if (tpe.col) {
COLiter bi;
/* naive approach using bat.new() and bat.insert() calls */
char *head;
@@ -603,7 +603,7 @@
str headv;
stream *sout;
- head = getTypeIdentifier(getColType(type));
+ head = getTypeIdentifier(tpe.type);
bid = *(int *)value;
if (bid != 0 && (b = COLdescriptor(bid)) == NULL){
@@ -626,10 +626,10 @@
bi = col_iterator(b);
COLloop(b, p, q) {
headv = NULL;
- ATOMformat(getColType(type), BUNhead(bi, p),
&headv);
- if ( getColType(type) <= TYPE_str)
+ ATOMformat(tpe.type, BUNhead(bi, p), &headv);
+ if ( tpe.type <= TYPE_str)
mnstr_printf(sout, "%s\n", headv);
- else if ( getColType(type) > TYPE_str)
+ else if ( tpe.type > TYPE_str)
mnstr_printf(sout, "\"%s\"\n", headv);
GDKfree(headv);
}
@@ -649,15 +649,15 @@
} else {
str val = NULL;
char qbuf[BUFSIZ + 1]; /* FIXME: this should be dynamic */
- if (ATOMvarsized(type)) {
- ATOMformat(type, *(str *)value, &val);
+ if (ATOMvarsized(tpe)) {
+ ATOMformat(tpe.type, *(str *)value, &val);
} else {
- ATOMformat(type, value, &val);
+ ATOMformat(tpe.type, value, &val);
}
- if (type <= TYPE_str)
- snprintf(qbuf, BUFSIZ, "%s := %s:%s;\n", ident, val,
getTypeIdentifier(type));
+ if (tpe.type <= TYPE_str)
+ snprintf(qbuf, BUFSIZ, "%s := %s:%s;\n", ident, val,
getTypeIdentifier(tpe));
else
- snprintf(qbuf, BUFSIZ, "%s := \"%s\":%s;\n", ident,
val, getTypeIdentifier(type));
+ snprintf(qbuf, BUFSIZ, "%s := \"%s\":%s;\n", ident,
val, getTypeIdentifier(tpe));
qbuf[BUFSIZ] = '\0';
GDKfree(val);
#ifdef _DEBUG_REMOTE
diff --git a/monetdb5/modules/mal/replication.c
b/monetdb5/modules/mal/replication.c
--- a/monetdb5/modules/mal/replication.c
+++ b/monetdb5/modules/mal/replication.c
@@ -552,12 +552,12 @@
}
static str
-MASTERdump(COL *b, str buf, int type, int tag)
+MASTERdump(COL *b, str buf, MALtype tpe, int tag)
{
COLiter bi;
BUN p, q;
char *headv = 0;
- str head = getTypeName(getColType(type));
+ str head = getTypeName(tpe.type);
int i, l, len;
i = MASTERgetBuffer(tag);
@@ -565,9 +565,9 @@
COLaccessBegin(b, USE_HEAP, MMAP_SEQUENTIAL);
COLloop(b, p, q)
{
- ATOMformat(getColType(type), BUNhead(bi, p), &headv);
+ ATOMformat(tpe.type, BUNhead(bi, p), &headv);
len = master[i].limit - master[i].top - 1;
- if ( getColType(type) <= TYPE_str) {
+ if ( tpe.type <= TYPE_str) {
while ((l = snprintf(master[i].buf + master[i].top,
len, "bat.insert(%s, %s:%s);\n", buf, headv, head)) >= len) {
master[i].buf =
(char*)GDKrealloc(master[i].buf, master[i].limit + 1024);
if (master[i].buf == NULL)
@@ -575,7 +575,7 @@
master[i].limit += 1024;
len = master[i].limit - master[i].top - 1;
}
- } else if ( getColType(type) > TYPE_str) {
+ } else if ( tpe.type > TYPE_str) {
while ((l = snprintf(master[i].buf + master[i].top,
len, "bat.insert(%s, \"%s\":%s);\n",
buf, headv, head)) >= len) {
master[i].buf =
(char*)GDKrealloc(master[i].buf, master[i].limit + 1024);
@@ -639,7 +639,7 @@
COL *b;
char buf[BUFSIZ];
int type = getArgType(mb, pci, 4);
- str head = getTypeName(getColType(type));
+ str head = getTypeName(tpe.type);
int i, l, len;
str msg;
@@ -694,7 +694,7 @@
COL *b;
char buf[BUFSIZ];
int type = getArgType(mb, pci, 3);
- str head = getTypeName(getColType(type));
+ str head = getTypeName(tpe.type);
str msg;
int i, l, len;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list