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

Modified Files:
        Makefile.ag batExtensions.mx bbp.mx bpm.mx chopper.mx 
        mal_init.mx pcre.mx remote.mx statistics.mx tablet.mx 
        urlbox.mx 
Log Message:
Merged GDK-2 branch into development branch.

Current changes were mostly started for
fixing the void concurrency problem

As a side action, the bun/bat layout was also changed.
We now have a split head and tail. This means many of the well known
macros are changed (ie BUN{h,t}{loc,var} BUN{head,tail})

BAT iteration now needs a special struct
BATiter which can be correctly created as

BATiter bi = bat_iterator(b);


TODO
        1 some modules aren't ported (maybe be dropped as they aren't used)

        2 some more bugs to find


Next improvements which are now possible
        views based on 2 bats
        (or a bat where head is real and the tail a view (or vs))
        many more....

For a presentation about the changes, see
http://www.cwi.nl/~niels/download/gdk2.pdf


Index: tablet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- tablet.mx   13 Sep 2007 13:45:13 -0000      1.101
+++ tablet.mx   4 Oct 2007 10:37:37 -0000       1.102
@@ -387,8 +387,8 @@
        char *type;
        int adt;                /* type index */
        BAT *c;                 /* set to NULL when scalar is meant */
-       ptr p;
-       int base;               /* of first tuple */
+       BATiter ci;
+       BUN p;
        unsigned int tabs;      /* field size in tab positions */
        str lbrk, rbrk;         /* column brackets */
        str nullstr;            /* null representation */
@@ -874,9 +874,10 @@
 static ptr
 bun_tail(BAT *b, size_t nr)
 {
-       REGISTER size_t _i = BUNindex((b), BUNfirst((b)));
+       BATiter bi = bat_iterator(b);
+       REGISTER size_t _i = BUNfirst(b);
 
-       return (ptr) BUNtail(b, BUNptr(b, _i + nr));
+       return (ptr) BUNtail(bi, _i + nr);
 }
 
 
@@ -1093,6 +1094,7 @@
                BAT *b = (BAT *) BATdescriptor(*(bat *) bun_tail(bats, i));
 
                fmt[i].c = (b);
+               fmt[i].ci = bat_iterator(b);
                if (res == ~(size_t) 0 || BATcount(fmt[i].c) < res)
                        res = BATcount(fmt[i].c);
        }
@@ -1123,12 +1125,12 @@
                b = fmt[i].c;
                if (b == NULL)
                        continue;
-               offset = BUNindex(b, BUNfirst(b)) + as->offset;
+               offset = BUNfirst(b) + as->offset;
 
                if (BATcount(b) != cnt || !BAThdense(b) || b->hseqbase != base)
                        return oid_nil;
 
-               fmt[i].p = BUNptr(b, offset);
+               fmt[i].p = offset;
        }
        return base;
 }
@@ -1141,6 +1143,7 @@
 
        for (i = 0; i < as->nr_attrs; i++) {
                fmt[i].c = void_bat_create(fmt[i].adt, est);
+               fmt[i].ci = bat_iterator(fmt[i].c);
                if (!fmt[i].c) {
                        GDKerror("TABLETcreate_bats: Failed to create bat of 
size " SZFMT "\n", as->nr);
                        return -1;
@@ -1163,6 +1166,7 @@
                BUNins(bats, (ptr) fmt[i].name, (ptr) &fmt[i].c->batCacheid, 
FALSE);
                BATsetaccess(fmt[i].c, BAT_READ);
                BATpropcheck(fmt[i].c, BATPROPS_ALL);
+               BATpropcheck(BATmirror(fmt[i].c), BATPROPS_ALL);
                if (cnt != BATcount(fmt[i].c)) {
                        GDKerror("Error: counts are not equal\n");
                        return NULL;
@@ -1232,7 +1236,7 @@
                s = lstrip(s);
                e = rstrip(e);
        }
-       if (e < s) 
+       if (e < s)
                e = s;
        adt = fmt->frstr(fmt->extra, fmt->adt, s, e, quote);
        *end = bak;
@@ -1380,7 +1384,7 @@
                        continue;
                fmt[i].p = BUNfnd(fmt[i].c, id);
 
-               if (fmt[i].p == 0)
+               if (fmt[i].p == BUN_NONE)
                        break;
        }
        lbuf[k]=0;
@@ -1392,7 +1396,7 @@
 
                        f = fmt + i;
                        if (f->c) {
-                               p = BUNtail(f->c, f->p);
+                               p = BUNtail(f->ci, f->p);
                                l = f->tostr(f->extra, buf, len, f->adt, p);
                        }
                        if( k+f->seplen+l+1 >=MB){
@@ -1420,12 +1424,12 @@
                Column *f = fmt + i;
 
                if (f->c) {
-                       char *p = BUNtail(f->c, f->p);
+                       char *p = BUNtail(f->ci, f->p);
                        int l = f->tostr(f->extra, buf, len, f->adt, p);
 
                        if (stream_write(fd, *buf, 1, l) != l)
                                return TABLET_error(fd);
-                       f->p = BUNnext(f->c, f->p);
+                       f->p++;
                }
                if (stream_write(fd, f->sep, 1, f->seplen) != f->seplen)
                        return TABLET_error(fd);
@@ -1442,8 +1446,7 @@
                Column *f = fmt + i;
 
                if (f->c) {
-                       char *p = BUNtail(f->c, BUNptr(f->c,
-                                                  id +BUNindex(f->c, 
BUNfirst(f->c))));
+                       char *p = BUNtail(f->ci, id + BUNfirst(f->c));
                        int l = f->tostr(f->extra, buf, len, f->adt, p);
 
                        if (stream_write(fd, *buf, 1, l) != l)
@@ -1590,10 +1593,11 @@
        char *buf = GDKmalloc(len);
        BUN p, q;
        size_t i = 0;
-       size_t offset = BUNindex(order, BUNfirst(order)) + as->offset;
+       size_t offset = BUNfirst(order) + as->offset;
+       BATiter orderi = bat_iterator(order);
 
-       for (q = BUNptr(order, offset + as->nr), p = BUNptr(order, offset); p < 
q; p = BUNnext(order, p)) {
-               ptr h = BUNhead(order, p);
+       for (q = offset + as->nr, p = offset; p < q; p++) {
+               ptr h = BUNhead(orderi, p);
 
                if ((res = output_line(&buf, &len, as->format, fd, 
as->nr_attrs, h)) < 0) {
                        GDKfree(buf);
@@ -1633,10 +1637,11 @@
        char *buf = GDKmalloc(len);
        BUN p, q;
        size_t i = 0;
-       size_t offset = BUNindex(order, BUNfirst(order)) + as->offset;
+       size_t offset = BUNfirst(order) + as->offset;
+       BATiter orderi = bat_iterator(order);
 
-       for (q = BUNptr(order, offset + as->nr), p = BUNptr(order, offset); p < 
q; p = BUNnext(order, p)) {
-               size_t h = *(oid *) BUNhead(order, p) - base;
+       for (q = offset + as->nr, p = offset; p < q; p++) {
+               size_t h = *(oid *) BUNhead(orderi, p) - base;
 
                if ((res = output_line_lookup(&buf, &len, as->format, fd, 
as->nr_attrs, h)) < 0) {
                        GDKfree(buf);
@@ -1947,7 +1952,8 @@
        CLEAR(c->sep);
        c->width = 0;
        c->tabs = 0;
-       c->c = c->p = 0;
+       c->c = NULL;
+       c->p = 0;
        /* keep nullstr and brackets */
 }
 static void
@@ -2063,6 +2069,7 @@
                }
 
                c->c = b;
+               c->ci = bat_iterator(b);
                /* the first column should take care of leader text size */
                if (c->c)
                        setTabwidth(c);
@@ -2078,7 +2085,7 @@
        }
        GDKfree(buf);
 
-       c->p = val;
+       c->data = val;
        if (c->scale)
                c->width = c->scale + 2;        /* decimal point  and '-' */
        c->width += (c->rbrk ? strlen(c->rbrk) : 0) + (c->lbrk ? 
strlen(c->lbrk) : 0);
@@ -2243,8 +2250,8 @@
                c = t->columns + i;
                u = 0;
                v = 0;
-               if (c->p)
-                       (*BATatoms[c->adt].atomToStr) (&buf, &zero, c->p);
+               if (c->data)
+                       (*BATatoms[c->adt].atomToStr) (&buf, &zero, c->data);
                m= (unsigned int) zero;
                if (strcmp(buf, "nil") == 0 && c->nullstr && strlen(c->nullstr) 
< m)
                        strcpy(buf, c->nullstr);
@@ -2255,7 +2262,7 @@
                                switch (c->adt) {
                                case TYPE_int:
                                {
-                                       int vi = *(int *) c->p, vj = vi, m = 1;
+                                       int vi = *(int *) c->data, vj = vi, m = 
1;
                                        int k;
 
                                        for (k = c->precision; k > 0; k--) {
@@ -2295,6 +2302,7 @@
        lng i;
        size_t j;
        oid k;
+       BATiter pi;
 
        i = BATcount(t->columns[0].c);
        if (last < 0 || last > i)
@@ -2302,16 +2310,14 @@
        if (first <= 0)
                first = 0;
 
+       pi = bat_iterator(t->pivot);
        for (i = first; i < last; i++) {
                if (t->pivot) {
-                       k = *(oid *) BUNtail(t->pivot, BUNptr(t->pivot, 
t->pivot->hseqbase + i));
+                       k = *(oid *) BUNtail(pi, i);
                } else
                        k = (oid) i;
                for (j = 0; j < t->nr_attrs; j++) {
-                       BAT *b = t->columns[j].c;
-                       int base = t->columns[j].base;
-
-                       t->columns[j].p = BUNtail(b, BUNptr(b, base + k));
+                       t->columns[j].data = BUNtail(t->columns[j].ci, k);
                }
                TABshowRow(t);
        }
@@ -2363,7 +2369,6 @@
                title = GDKmalloc(strlen(BATgetId(c->c)) + 7);
                snprintf(title, 20, "%s", BATgetId(c->c));
        }
-       c->base = BUNindex(c->c, BUNfirst(c->c));
        c->type = GDKstrdup(ATOMname(c->c->ttype));
        c->adt = c->c->ttype;
        buf = (char *) GDKmalloc(ret = strLen(title));
@@ -2376,14 +2381,14 @@
                max += strlen(c->rbrk);
 
        if (t >= 0 && t < GDKatomcnt && tostr) {
-               size_t off = BUNindex(c->c, BUNfirst(c->c));
+               size_t off = BUNfirst(c->c);
                size_t j, i, probe = MIN(10000, MAX(200, cnt / 100));
 
                for (i = 0; i < probe; i++) {
                        if (i >= cnt)
                                break;
                        j = off + ((cnt < probe) ? i : (rand() % cnt));
-                       (*tostr) (&buf, &ret, BUNtail(c->c, BUNptr(c->c, j)));
+                       (*tostr) (&buf, &ret, BUNtail(c->ci, j));
                        max = MAX(max, strlen(buf));
                }
        }

Index: chopper.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/chopper.mx,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- chopper.mx  16 May 2007 21:20:13 -0000      1.48
+++ chopper.mx  4 Oct 2007 10:37:34 -0000       1.49
@@ -122,14 +122,14 @@
 CHPnewChunkIterator(lng *res, int *vid, int *bid, lng *granule)
 {
        BAT *b, *view;
-       size_t cnt, first;
+       BUN cnt, first;
 
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "chop.newChunkIterator", "Cannot access descriptor");
        }
        cnt = BATcount(b);
-       first = BUNindex(b, BUNfirst(b));
-       view = VIEWcreate_(b, TRUE);
+       first = BUNfirst(b);
+       view = VIEWcreate_(b, b, TRUE);
 
        /*  printf("set bat chunk bound to %d %d - %d\n",
         *granule, first, MIN(cnt,(size_t) *granule)); */
@@ -151,7 +151,7 @@
 CHPhasMoreChunks(lng *res, int *vid, int *bid, lng *granule)
 {
        BAT *b, *view;
-       size_t i;
+       BUN i;
 
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "chop.newChunkMoreElements", "Cannot access 
descriptor");
@@ -160,8 +160,8 @@
                BBPunfix(b->batCacheid);
                throw(MAL, "chop.newChunkMoreElements", "Cannot access 'vid' 
descriptor");
        }
-       i = (size_t) (*res + BATcount(view));
-       if (i >= BUNindex(b, BUNlast(b))) {
+       i = (BUN) (*res + BATcount(view));
+       if (i >= BUNlast(b)) {
                *res = -1;
                BBPunfix(b->batCacheid);
                BBPunfix(view->batCacheid);
@@ -188,11 +188,11 @@
 str
 CHPbunIterator(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+       BATiter bi;
        BAT *b;
        lng *cursor;
        int *bid;
        lng yy;
-       BUN p;
        ValPtr head, tail;
        oid o;
 
@@ -210,18 +210,19 @@
                BBPunfix(b->batCacheid);
                return MAL_SUCCEED;
        }
-       *cursor = BUNindex(b, BUNfirst(b));
+       *cursor = BUNfirst(b);
 
        /* get head = ... tail = ... */
        yy = *cursor;
-       p = BUNptr(b, yy);
+       bi = bat_iterator(b);
        if( b->htype == TYPE_void){
                o= b->hseqbase;
                VALinit(head, TYPE_oid, &o);
-       } else
-               VALinit(head, getArgType(mb, pci, 1), BUNhead(b, p));
+       } else {
+               VALinit(head, getArgType(mb, pci, 1), BUNhead(bi, yy));
+       }
        assert(b->ttype == getArgType(mb,pci,2));
-       VALinit(tail, b->ttype, BUNtail(b, p));
+       VALinit(tail, b->ttype, BUNtail(bi, yy));
        BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }
@@ -229,11 +230,11 @@
 str
 CHPbunHasMoreElements(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+       BATiter bi;
        BAT *b;
        lng *cursor;
-       lng yy;
+       BUN yy;
        bat *bid;
-       BUN p;
        ValPtr head, tail;
        oid o;
 
@@ -250,21 +251,21 @@
        yy = *cursor + 1;
        *cursor = yy;
 
-       p = BUNptr(b, yy);
-       if (p >= BUNlast(b)) {
+       if (yy >= BUNlast(b)) {
                *cursor = -1;
                BBPunfix(b->batCacheid);
                return MAL_SUCCEED;
        }
+       bi = bat_iterator(b);
        if( b->htype == TYPE_void){
-               o= (oid) (yy - BUNindex(b,BUNfirst(b))+  b->hseqbase);
+               o= (oid) (yy - BUNfirst(b)+  b->hseqbase);
                VALinit(head, TYPE_oid, &o);
        } else {
                assert(b->htype == getArgType(mb,pci,1));
-               VALinit(head, getArgType(mb, pci, 1), BUNhead(b, p));
+               VALinit(head, getArgType(mb, pci, 1), BUNhead(bi, yy));
        }
        assert(b->ttype == getArgType(mb,pci,2));
-       VALinit(tail, b->ttype, BUNtail(b, p));
+       VALinit(tail, b->ttype, BUNtail(bi, yy));
        BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }
@@ -284,7 +285,6 @@
        lng *cursor;
        int *bid;
        int limit;
-       BUN p;
        ValPtr head;
        oid o;
 
@@ -295,19 +295,20 @@
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "chop.getHead", "Cannot access 'bid' descriptor");
        }
-       limit = BUNindex(b, BUNlast(b));
+       limit = BUNlast(b);
        if (*cursor < 0 || *cursor >= limit) {
                BBPunfix(b->batCacheid);
                throw(MAL, "mal.getHead", "range error");
        }
 
        /* get head = ... */
-       p = BUNptr(b, *cursor);
        if( getArgType(mb,pci,3) == TYPE_void){
-               o= BUNindex(b,p)+  b->hseqbase;
+               o = *cursor +  b->hseqbase;
                VALinit(head, TYPE_oid, &o);
-       } else
-               VALinit(head, getArgType(mb, pci, 3), BUNhead(b, p));
+       } else {
+               BATiter bi = bat_iterator(b);
+               VALinit(head, getArgType(mb, pci, 3), BUNhead(bi, *cursor));
+       }
        BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }
@@ -315,11 +316,11 @@
 str
 CHPgetTail(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+       BATiter bi; 
        BAT *b;
        lng *cursor;
        int *bid;
        int limit;
-       BUN p;
        ValPtr tail;
 
        cursor = (lng *) getArgReference(stk, pci, 2);
@@ -329,15 +330,15 @@
        if ((b = BATdescriptor(*bid)) == NULL) {
                throw(MAL, "chop.getTail", "Cannot access 'bid' descriptor");
        }
-       limit = BUNindex(b, BUNlast(b));
+       limit = BUNlast(b);
        if (*cursor < 0 || *cursor >= limit) {
                BBPunfix(b->batCacheid);
                throw(OUTOFBNDS, "mal.getTail", "range error: %d", *cursor);
        }
 
        /* get tail = ... */
-       p = BUNptr(b, *cursor);
-       VALinit(tail, getArgType(mb, pci, 3), BUNtail(b, p));
+       bi = bat_iterator(b);
+       VALinit(tail, getArgType(mb, pci, 3), BUNtail(bi, *cursor));
        BBPunfix(b->batCacheid);
        return MAL_SUCCEED;
 }

Index: bpm.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/bpm.mx,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- bpm.mx      28 Aug 2007 19:53:38 -0000      1.120
+++ bpm.mx      4 Oct 2007 10:37:33 -0000       1.121
@@ -844,8 +844,8 @@
        if ((b = BATdescriptor(idx)) == NULL) 
                throw(MAL, "bpm.loadCatalog", "Cannot access descriptor");
        BATloop(b, p, q) {
-               i = *(int *)BUNhead(b,p);
-               k = *(@2 *) BUNtail(b,p);
+               i = *(int *)Hloc(b,p);
+               k = *(@2 *) Tloc(b,p);
                newPartition(i)->@1 = k;        
                bpmcat[i]->bid = k;
        }
@@ -855,6 +855,7 @@
        idx= BBPindex("[EMAIL PROTECTED]");
         if ((@1 = BATdescriptor(idx)) == NULL) 
                 throw(MAL, "bpm.loadCatalog", "Cannot access descriptor");
+       @1i = bat_iterator(@1);
 
 @= BPMunfix
        BBPunfix(nxt->batCacheid);
@@ -866,8 +867,8 @@
 
 @= getPartitionBound
        r= BUNfnd(@3,&i); 
-       if (r){
-          val= BUNtail(@3,r);
+       if (r != BUN_NONE){
+          val= BUNtail(@3i,r);
           vl= * (@5 *) val;    
           @2= (@1) vl;
           VALset(&bpmcat[i]->@4, tp, &@2); 
@@ -888,6 +889,7 @@
        int i,k,tp,vi;
        bat idx;
        BAT *b, *pb;
+       BATiter nxti, prvi, cnti, bldi, blli, bhdi, bhli;
        BAT *nxt, *prv, *cnt, *bld, *bll, *bhd, *bhl;
        BUN p,q,r;
        str nm;
@@ -896,14 +898,16 @@
        flt vf;
        dbl vd;
        lng vl;
+       BATiter bi;
 
        assureSpace();
        idx= BBPindex("bpm_name");
        if ((b = BATdescriptor(idx)) == NULL) 
                throw(MAL, "bpm.loadCatalog", "Cannot access descriptor");
+       bi = bat_iterator(b);
        BATloop(b, p, q) {
-               i = *(int *)BUNhead(b,p);
-               nm = (str) BUNtail(b,p);
+               i = *(int *)BUNhead(bi,p);
+               nm = (str) BUNtail(bi,p);
                newPartition(i)->name = GDKstrdup(nm);  
                bpmcat[i]->type= newBatType(b->htype, b->ttype);
                bpmcat[i]->bid = i;
@@ -933,8 +937,8 @@
 @-
 @= getPartitionField
                r= BUNfnd(@1,&i);
-               if (r)
-                       bpmcat[i]->@1= *(int *) BUNtail(@1,r);
+               if (r != BUN_NONE)
+                       bpmcat[i]->@1= *(int *) BUNtail(@1i,r);
                else {  
                        @:BPMunfix@
                        throw(MAL, "bpm.loadCatalog", "Broken partition 
scheme:@1");
@@ -1205,6 +1209,7 @@
 str
 BPMrangeVector(bat *ret, bat *bid, bat *pv)
 {
+       BATiter bpvi;
        BAT *b, *bpv;
        BUN cur,q;
        ptr val;
@@ -1214,14 +1219,14 @@
        if( bpmcat[*bid] == 0)
                throw(MAL,"bpm.rangeVector","Partitioned BAT not found");
        @:getBATdescriptor(bid,b,"bpm.rangeVector");
-
        @:getBATdescriptor(pv,bpv,"bpm.range")@
        if( bpv == 0){
                BBPunfix(b->batCacheid);
                throw(MAL,"bpm.range","Cannot access BAT");
        }
+       bpvi = bat_iterator(bpv);
        BATloop(bpv,cur,q){
-               val= BUNtail(bpv,cur);
+               val= BUNtail(bpvi,cur);
                BPMsplitpartition(ret,bid,val);
        }
        *ret= 0;
@@ -1574,16 +1579,15 @@
 @c
 static void findMedian(ValPtr vp, BAT * b)
 {
-       BUN p; 
-       int c, tpe;
+       BUN c; 
        BAT *bh, *bs;
+       BATiter bsi;
 
-       tpe = b->ttype;
        bh = BATsample(b,100);
        bs = BATtsort(bh);
        c = BATcount(bh)/2;
-       p = BUNptr(bs,c);
-       VALset(vp,tpe, BUNtail(bs,p));
+       bsi = bat_iterator(bs);
+       VALset(vp, b->ttype, BUNtail(bsi,c));
 
        BBPunfix(bs->batCacheid);
        BBPunfix(bh->batCacheid);
@@ -1645,8 +1649,8 @@
        int cs=0;
        lng space, space1, space2=0;
 
-       space = BATcount(b)* (BUNsize(b) + sizeof(hash_t)) + sizeof(BATstore);
-       space1 = BATcount(bs)* (BUNsize(b) + sizeof(hash_t)) + sizeof(BATstore);
+       space = BATcount(b)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
+       space1 = BATcount(bs)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
 
 /*     stream_printf(GDKout,"tuples %d size  %d selection %d \n", 
BATcount(b),space, space1); */
        if(ov <3) {
@@ -1693,8 +1697,8 @@
        int cs=0, or, cnt=0;
        lng space, space1, space2=0;
 
-       space = BATcount(b)* (BUNsize(b) + sizeof(hash_t)) + sizeof(BATstore);
-       space1 = BATcount(bs)* (BUNsize(b) + sizeof(hash_t)) + sizeof(BATstore);
+       space = BATcount(b)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
+       space1 = BATcount(bs)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
 
        if(ov <3) {
                space2 = space -space1;
@@ -1735,7 +1739,8 @@
 
 static int 
 spread( bat *ret, int *cnt, BAT *b, ValPtr sep, int n, int skip)
-{      int xx, k=n-2, i;
+{      
+       int k=n-2, i;
        BUN p,q;
        BAT **bs = alloca(sizeof(*bs) * (n-1)); /* Visual Studio doesn't accept 
BAT *bs[n-1] */
        ptr val;
@@ -1748,17 +1753,17 @@
                        bs[i] = BATnew(b->htype, b->ttype, (size_t) 
BATcount(b)/k );
        }
 
-       BATloopFast(b, p, q, xx) {
-               val = BUNtloc(b, p);
+       BATloop(b, p, q) {
+               val = Tloc(b, p);
                for(i=0; i<k; i++) {
                        if( ((*cmp)(val,(ptr) &sep[i+1]) <0) && (i!= skip)) {
-                               BUNins(bs[i], BUNhloc(b, p), val, TRUE);
+                               BUNins(bs[i], Hloc(b, p), val, TRUE);
                                break;
                        }       
                } 
                if( (i == k) && (i!=skip) &&
                    ((*cmp)(val,(ptr) &sep[i]) >0) )
-                       BUNins(bs[k], BUNhloc(b, p), val, TRUE);
+                       BUNins(bs[k], Hloc(b, p), val, TRUE);
        }               
        
        for(i=0; i<=k; i++)
@@ -1794,7 +1799,7 @@
        tpe = rngType(b->ttype);
 
 /* baseline size, too small BATs are never broken*/
-       space = BATcount(b)* (BUNsize(b) + sizeof(hash_t)) + sizeof(BATstore);
+       space = BATcount(b)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
        if (space < Mmin) { /* no re-org.*/
                BBPkeepref(*ret = b->batCacheid);
                return MAL_SUCCEED;
@@ -3026,6 +3031,7 @@
 {
        BUN p, pprev, stop; 
        int c, tpe, quan, pertpl, s=0, cn, it =0;
+       BATiter bsi;
        BAT *bh, *bs;
        ValPtr v = vp;
 
@@ -3040,12 +3046,13 @@
 
        /* iterate on the sorted histogram */
        pprev = BUNfirst(bs);
+       bsi = bat_iterator(bs);
        BATloop(bs, p, stop) {
-               cn = * (int *) BUNtail(bs,p);
+               cn = * (int *) BUNtail(bsi,p);
                if (s + cn <quan) 
                        s += cn;
                else {
-                       VALset(v,tpe, BUNhead(bs,pprev));
+                       VALset(v,tpe, BUNhead(bsi,pprev));
                        v++; it++;
                        s = cn;
                        if (it >= maxno) break;
@@ -3093,7 +3100,7 @@
        /*      materializePartition(bpmcat[i]); */
                @:getBATdescriptor(&bpmcat[i]->bid,b,"bpm.splitquantile");
                
-               space = BATcount(b)* (BUNsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
+               space = BATcount(b)* (Hsize(b) + Tsize(b) + sizeof(hash_t)) + 
sizeof(BATstore);
                if ((b->htype == TYPE_void) || (b->ttype == TYPE_void))
                        space += BATcount(b)* sizeof(oid);
        #ifdef _DEBUG_BPM_

Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/Makefile.ag,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- Makefile.ag 12 Sep 2007 10:55:23 -0000      1.105
+++ Makefile.ag 4 Oct 2007 10:37:31 -0000       1.106
@@ -14,7 +14,7 @@
 # Portions created by CWI are Copyright (C) 1997-2007 CWI.
 # All Rights Reserved.
 
-SUBDIRS = crackers
+SUBDIRS = #crackers
 
 INCLUDES = -I../atoms -I../kernel \
         -I../../mal $(MONETDB_INCS) $(CLIENTS_INCS) \
@@ -30,9 +30,9 @@
                profiler.mx const.mx algebraExtensions.mx \
                inspect.mx manual.mx \
                factory.mx mdb.mx  \
-               urlbox.mx mat.mx batxml.mx \
-               sabaoth.mx radix.mx remote.mx
-               #datacell.mx 
+               urlbox.mx mat.mx \
+               sabaoth.mx remote.mx
+               #datacell.mx radix.mx batxml.mx 
 
        HEADERS = h 
        LIBS = ../../mal/libmal ../atoms/lib_xml $(MONETDB_LIBS) -lbat -lstream 
$(MATH_LIBS) \
@@ -160,8 +160,8 @@
                factory.mx mdb.mx pcre.mx  tablet.mx mat.mx \
                urlbox.mx statistics.mx transaction.mx \
                mserver.mx sabaoth.mx remote.mx \
-               radix.mx bpm.mx  batxml.mx
-       #datacell.mx 
+               radix.mx bpm.mx 
+       #datacell.mx #batxml.mx
 }
 
 EXTRA_DIST_DIR = Tests

Index: statistics.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/statistics.mx,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- statistics.mx       12 Apr 2007 07:16:04 -0000      1.45
+++ statistics.mx       4 Oct 2007 10:37:36 -0000       1.46
@@ -329,22 +329,23 @@
        STAT_id_max_lng= NULL;
        STAT_id_histogram= NULL;
 
-       TMcommit();
        mal_unset_lock(mal_contextLock, "statistics");
 }
 
 str
 STATdrop(str nme)
 {
-       ptr p;
+       BATiter STAT_id_nmei;
+       BUN p;
        int idx;
 
        if(STAT_id_inuse ==0) 
                throw(MAL, "statistics.drop","Statistics not initialized");
        p = BUNfnd(BATmirror(STAT_id_nme), nme);
-       if (p == 0)
+       if (p == BUN_NONE)
                throw(MAL, "statistics.drop", "BAT not enrolled");
-       idx = *(int *) BUNhead(STAT_id_nme,p);
+       STAT_id_nmei = bat_iterator(STAT_id_nme);
+       idx = *(int *) BUNhead(STAT_id_nmei,p);
        BUNdelHead(STAT_id_nme, &idx, FALSE);
        BUNdelHead(STAT_id_expire, &idx, FALSE);
        BUNdelHead(STAT_id_stamp, &idx, FALSE);
@@ -385,29 +386,30 @@
        str name;
        int i;
 
-       if (STAT_id_nme)
+       if (STAT_id_nme) {
+               BATiter STAT_id_nmei = bat_iterator(STAT_id_nme);
                BATloop(STAT_id_nme, p, q) {
-               name = (str) BUNtail(STAT_id_nme, p);
+                       name = (str) BUNtail(STAT_id_nmei, p);
 #ifdef DEBUG_STATISTICS
-               stream_printf(GDKout, "update statistics of %d\n", name);
+                       stream_printf(GDKout, "update statistics of %d\n", 
name);
 #endif
-               i = BBPindex(name);
-               if (i == 0)
-                       continue;
-               if (forced == FALSE && BUNfnd(STAT_id_inuse, &i) == 0)
-                       continue;
-               b = BATdescriptor(i);
-               if (b == 0) {
-                       /* BAT disappeared */
-                       STATdiscard2(ret, &i);
-                       continue;
-               }
-               /* check the modification time with histogram */
-               /* if BBPolder(i,j) ) */  {
-                       STATforceUpdate(ret, &name);
-               }
+                       i = BBPindex(name);
+                       if (i == 0)
+                               continue;
+                       if (forced == FALSE && BUNfnd(STAT_id_inuse, &i) == 
BUN_NONE)
+                               continue;
+                       b = BATdescriptor(i);
+                       if (b == 0) {
+                               /* BAT disappeared */
+                               STATdiscard2(ret, &i);
+                               continue;
+                       }
+                       /* check the modification time with histogram */
+                       /* if BBPolder(i,j) ) */  {
+                               STATforceUpdate(ret, &name);
+                       }
                }
-
+       }
        return MAL_SUCCEED;
 }
 
@@ -432,7 +434,7 @@
 {
        BAT *b, *h;
        char buf[PATHLENGTH];
-       ptr p;
+       BUN p;
        lng cnt;
        int idx;
 
@@ -442,26 +444,26 @@
        if (b == 0)
                throw(MAL, "statistics.forceUpdate", "Could not find BAT");
        p = BUNfnd(STAT_id_nme, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_nme, p, FALSE);
        BUNins(STAT_id_nme, &idx, *nme, FALSE);
        cnt = BATcount(b);
        p = BUNfnd(STAT_id_count, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_count, p, FALSE);
        BUNins(STAT_id_count, &idx, &cnt, FALSE);
 
        cnt = BATmemsize(b, 0);
        p = BUNfnd(STAT_id_size, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_size, p, FALSE);
        BUNins(STAT_id_size, &idx, &cnt, FALSE);
 
        p = BUNfnd(STAT_id_min_lng, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_min_lng, p, FALSE);
        p = BUNfnd(STAT_id_max_lng, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_max_lng, p, FALSE);
 
        if (b->ttype == TYPE_int) {
@@ -484,12 +486,12 @@
        BATcommit(h);
 
        p = BUNfnd(STAT_id_histogram, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_histogram, p, FALSE);
        BUNins(STAT_id_histogram, &idx, BATgetId(h), FALSE);
 
        p = BUNfnd(STAT_id_inuse, &idx);
-       if (p)
+       if (p != BUN_NONE)
                BUNdelete(STAT_id_inuse, p, FALSE);
        BUNins(STAT_id_inuse, &idx, &idx, FALSE);
        STATcommit();
@@ -610,14 +612,14 @@
        ValRecord val;
        int idx;
        str bnme;
-       ptr p;
+       BUN p;
 
        b = BATdescriptor(idx = BBPindex(*nme));
        if (b == NULL)
                throw(MAL, "statistics.deposit", "BAT unknown");
        OpenBox("deposit");
        p= BUNfnd(BATmirror(STAT_id_nme),*nme);
-       if( p) return MAL_SUCCEED;
+       if (p != BUN_NONE) return MAL_SUCCEED;
        val.val.bval = idx;
        val.vtype = TYPE_bat;
        if (depositBox(box, *nme, &val))
@@ -819,19 +821,22 @@
 @= stat
 s_export str [EMAIL PROTECTED](lng *ret, str *nme);
 str
[EMAIL PROTECTED](lng *ret, str *nme){
[EMAIL PROTECTED](lng *ret, str *nme)
+{
+       BATiter STAT_id_nmei;
        Box box;
-       ptr p;
+       BUN p;
        int i;
        OpenBox("[EMAIL PROTECTED]");
        p= BUNfnd(BATmirror(STAT_id_nme),*nme);
-       if( p == NULL)
+       if (p == BUN_NONE)
                throw(MAL, "[EMAIL PROTECTED]","Object not known");
-       i= *(int*) BUNhead(STAT_id_nme,p);
+       STAT_id_nmei = bat_iterator(STAT_id_nme);
+       i= *(int*) BUNhead(STAT_id_nmei,p);
        p= BUNfnd([EMAIL PROTECTED], &i );
-       if( p == NULL)
+       if (p == BUN_NONE)
                throw(MAL, "[EMAIL PROTECTED]","Not known");
-       *ret = *(lng*)BUNtail([EMAIL PROTECTED],p);
+       *ret = *(lng*)Tloc([EMAIL PROTECTED],p);
        return MAL_SUCCEED;
 }
 @c
@@ -844,20 +849,23 @@
 str
 STATgetHistogram(int *ret, str *nme)
 {
-       ptr p;
+       BATiter STAT_id_nmei, STAT_id_histogrami;
+       BUN p;
        int i;
        BAT *h;
        Box box;
 
        OpenBox("getHistogram");
        p = BUNfnd(BATmirror(STAT_id_nme), *nme);
-       if (p == NULL)
+       if (p == BUN_NONE)
                throw(MAL, "statistics.getHistogram", "BAT not known");
-       i= *(int*) BUNhead(STAT_id_nme,p);
+       STAT_id_nmei = bat_iterator(STAT_id_nme);
+       STAT_id_histogrami = bat_iterator(STAT_id_histogram);
+       i= *(int*) BUNhead(STAT_id_nmei,p);
        p = BUNfnd(STAT_id_histogram, &i);
-       if (p == NULL)
+       if (p == BUN_NONE)
                throw(MAL, "statistics.getHistogram", "Histogram not known");
-       i = BBPindex((str) BUNtail(STAT_id_histogram, p));
+       i = BBPindex((str) BUNtail(STAT_id_histogrami, p));
        if (i == 0)
                throw(MAL, "statistics.getHistogram", "Histogram disappeared");
        h = BATdescriptor(i);

Index: bbp.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/bbp.mx,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- bbp.mx      29 May 2007 19:41:31 -0000      1.114
+++ bbp.mx      4 Oct 2007 10:37:33 -0000       1.115
@@ -238,8 +238,6 @@
 bbp_export str CMDbbpLRefCount(int *ret);
 bbp_export str CMDgetBATrefcnt(int *res, int *bid);
 bbp_export str CMDgetBATlrefcnt(int *res, int *bid);
-bbp_export str CMDbatunpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-bbp_export str CMDbatpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 
 @-
 Access to a box calls for resolving the first parameter
@@ -1049,55 +1047,3 @@
 @c
 @:headtailProperty(htype,HeadType)@
 @:headtailProperty(ttype,TailType)@
-
-str
-CMDbatunpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       BAT *b;
-       int bid;
-       ptr p;
-       ValPtr head, tail;
-
-       bid = *(int *) getArgValue(stk, pci, 2);
-
-       if ((b = BATdescriptor(bid)) == NULL) {
-               throw(MAL, "bbp.unpack", "Cannot access descriptor");
-       }
-
-       head = &stk->stk[pci->argv[0]];
-       tail = &stk->stk[pci->argv[1]];
-       p = BUNfirst(b);
-       if (p) {
-               VALinit(head, getArgType(mb, pci, 0), BUNhead(b, p));
-               VALinit(tail, getArgType(mb, pci, 1), BUNtail(b, p));
-       }
-
-       BBPunfix(b->batCacheid);
-       return MAL_SUCCEED;
-}
-
-str
-CMDbatpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       BAT *b;
-       int *ret;
-       int ht, tt;
-       size_t cap = 0;
-
-       ht = getArgType(mb, pci, 1);
-       tt = getArgType(mb, pci, 2);
-       ret = (int *) getArgReference(stk, pci, 0);
-
-       if (ht == TYPE_any || tt == TYPE_any)
-               throw(MAL, "bbp.new", "Explicit type required");
-       if (isaBatType(ht))
-               ht = TYPE_bat;
-       if (isaBatType(tt))
-               tt = TYPE_bat;
-       b = BATnew(ht, tt, cap);
-       BUNins(b, (ptr) getArgValue(stk, pci, 1), getArgValue(stk, pci, 2), 
FALSE);
-       if (!(b->batDirty&2)) b = BATsetaccess(b, BAT_READ);
-       *ret = b->batCacheid;
-       BBPkeepref(*ret);
-       return MAL_SUCCEED;
-}

Index: batExtensions.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/batExtensions.mx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- batExtensions.mx    19 Aug 2007 19:41:18 -0000      1.18
+++ batExtensions.mx    4 Oct 2007 10:37:32 -0000       1.19
@@ -182,7 +182,7 @@
 
        /* reduce memory footprint by dropping hashes 
        of non-persistent bats */
-       if( !VIEWparent(b) && b->batSharecnt==0){
+       if( !isVIEW(b) && b->batSharecnt==0){
 #ifdef TRACE_ADVICE
                if(b->hhash)
                        printf("found hhash %s 
%d\n",BBP_logical(b->batCacheid), (int)(BATcount(b) * sizeof(hash_t)));
@@ -387,7 +387,7 @@
 {
        BAT *b;
        int bid;
-       ptr p;
+       BUN p;
        ValPtr head, tail;
 
        bid = *(int *) getArgValue(stk, pci, 2);
@@ -399,9 +399,10 @@
        head = &stk->stk[pci->argv[0]];
        tail = &stk->stk[pci->argv[1]];
        p = BUNfirst(b);
-       if (p) {
-               VALinit(head, getArgType(mb, pci, 0), BUNhead(b, p));
-               VALinit(tail, getArgType(mb, pci, 1), BUNtail(b, p));
+       if (p < BUNlast(b)) {
+               BATiter bi = bat_iterator(b);
+               VALinit(head, getArgType(mb, pci, 0), BUNhead(bi, p));
+               VALinit(tail, getArgType(mb, pci, 1), BUNtail(bi, p));
        }
 
        BBPunfix(b->batCacheid);

Index: urlbox.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/urlbox.mx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- urlbox.mx   3 Jan 2007 12:20:24 -0000       1.18
+++ urlbox.mx   4 Oct 2007 10:37:37 -0000       1.19
@@ -235,11 +235,12 @@
        return depth;
 }
 str
-URLBOXinsert(char *tuple){
+URLBOXinsert(char *tuple)
+{
        str parts[MAXURLDEPTH];
        int i=0,depth;
        BAT *b;
-       ptr p;
+       BUN p;
        int idx= 0,prv=0;
        char buf[128];
 
@@ -271,12 +272,13 @@
 Find the common prefix first
 @c
        p= BUNfnd(BATmirror(urlBAT[0]),parts[0]);
-       if( p ) 
+       if (p != BUN_NONE) 
                for( i=1; i<depth; i++){
                        /* printf("search [%d]:%s\n",i,parts[i]);*/
-                       p= BUNfnd(BATmirror(urlBAT[i]),parts[i]);
-                       if( p == 0) break;
-                       prv= *(int*) p;
+                       p = BUNfnd(BATmirror(urlBAT[i]),parts[i]);
+                       if (p == BUN_NONE) 
+                               break;
+                       prv = *(int*)Hloc(urlBAT[i], p);
                }
        else i = 0;
 @-
@@ -585,17 +587,18 @@
        for(i=0; i<urlDepth; i++){
                bn= urlBAT[i];
                size = ROUND_UP(sizeof(BATstore), blksize);
-               if (!VIEWparent(bn)) {
+               if (!isVIEW(bn)) {
                        size_t cnt = BATcapacity(bn);
 
-                       size += ROUND_UP(bn->batBuns->size, blksize);
+                       size += ROUND_UP(bn->H->heap.size, blksize);
+                       size += ROUND_UP(bn->T->heap.size, blksize);
                        if (b->hheap)
                                size += ROUND_UP(bn->hheap->size, blksize);
                        if (b->theap)
                                size += ROUND_UP(bn->theap->size, blksize);
-                       if (bn->hhash)
+                       if (bn->H->hash)
                                size += ROUND_UP(sizeof(hash_t) * cnt, blksize);
-                       if (bn->thash)
+                       if (bn->T->hash)
                                size += ROUND_UP(sizeof(hash_t) * cnt, blksize);
                }
                tot = size;

Index: remote.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/remote.mx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- remote.mx   3 Oct 2007 14:00:54 -0000       1.29
+++ remote.mx   4 Oct 2007 10:37:35 -0000       1.30
@@ -227,6 +227,7 @@
                throw(MAL, "remote.put", "cannot deal with '%s' type",
                                getTypeName(type));
        } else if (isaBatType(type)) {
+               BATiter bi;
                /* naive approach using bat.new() and bat.insert() calls */
                char head[10], tail[10];
                char qbuf[512]; /* FIXME: this should be dynamic */
@@ -262,9 +263,10 @@
                mapi_close_handle(mhdl);
 
                headv = tailv = NULL;
+               bi = bat_iterator(b);
                BATloop(b, p, q) {
-                       ATOMformat(getHeadType(type), BUNhead(b, p), &headv);
-                       ATOMformat(getTailType(type), BUNtail(b, p), &tailv);
+                       ATOMformat(getHeadType(type), BUNhead(bi, p), &headv);
+                       ATOMformat(getTailType(type), BUNtail(bi, p), &tailv);
                        snprintf(qbuf, 511, "bat.insert(%s, %s:%s, %s:%s);",
                                        ident, headv, head, tailv, tail);
                        rethrow("remote.put", tmp, RMTquery(&mhdl, 
"remote.put", mconn, qbuf));

Index: pcre.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/pcre.mx,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- pcre.mx     16 Aug 2007 07:01:57 -0000      1.49
+++ pcre.mx     4 Oct 2007 10:37:35 -0000       1.50
@@ -298,6 +298,7 @@
 str
 pcre_select(BAT **res, str pattern, BAT *strs)
 {
+       BATiter strsi = bat_iterator(strs);
        const char err[BUFSIZ], *err_p = err;
        int errpos = 0;
        BAT *r;
@@ -313,10 +314,10 @@
                        pattern, errpos, err_p);
        }
        BATloop(strs, p, q) {
-               str s = BUNtail(strs, p);
+               str s = BUNtail(strsi, p);
 
                if (pcre_exec(re, NULL, s, strlen(s), 0, 0, NULL, 0) >= 0) {
-                       BUNins(r, BUNhead(strs, p), s, FALSE);
+                       BUNins(r, BUNhead(strsi, p), s, FALSE);
                }
        }
        if (!(r->batDirty&2)) r = BATsetaccess(r, BAT_READ);
@@ -328,6 +329,7 @@
 str
 pcre_uselect(BAT **res, str pattern, BAT *strs)
 {
+       BATiter strsi = bat_iterator(strs);
        const char err[BUFSIZ], *err_p = err;
        int errpos = 0;
        BAT *r;
@@ -343,10 +345,10 @@
                        pattern, errpos, err_p);
        }
        BATloop(strs, p, q) {
-               str s = BUNtail(strs, p);
+               str s = BUNtail(strsi, p);
 
                if (pcre_exec(re, NULL, s, strlen(s), 0, 0, NULL, 0) >= 0) {
-                       BUNins(r, BUNhead(strs, p), NULL, FALSE);
+                       BUNins(r, BUNhead(strsi, p), NULL, FALSE);
                }
        }
        my_pcre_free(re);
@@ -465,6 +467,7 @@
 str
 pcre_replace_bat(BAT **res, BAT *origin_strs, str pattern, str replacement, 
str flags)
 {
+       BATiter origin_strsi = bat_iterator(origin_strs);
        const char err[BUFSIZ], *err_p = err, *err_p2 = err;
        int i, j, k, len, errpos = 0, offset = 0;
        int compile_options = PCRE_UTF8, exec_options = PCRE_NOTEMPTY;
@@ -512,7 +515,7 @@
        
        tmpbat = BATnew(origin_strs->htype, TYPE_str, BATcount(origin_strs));
        BATloop(origin_strs, p, q) {
-               origin_str = BUNtail(origin_strs, p);
+               origin_str = BUNtail(origin_strsi, p);
                len_origin_str = strlen(origin_str);
                i = ncaptures = len_del = offset = 0;
                do {
@@ -562,10 +565,10 @@
                        strncpy(replaced_str+k, origin_str+capture_offsets[j], 
len);
                        k += len;
                        replaced_str[k] = '\0';
-                       BUNins(tmpbat, BUNhead(origin_strs, p), replaced_str, 
FALSE);
+                       BUNins(tmpbat, BUNhead(origin_strsi, p), replaced_str, 
FALSE);
                        GDKfree(replaced_str);
                } else { /* no captured substrings, copy the original string 
into new bat */
-                       BUNins(tmpbat, BUNhead(origin_strs, p), origin_str, 
FALSE);
+                       BUNins(tmpbat, BUNhead(origin_strsi, p), origin_str, 
FALSE);
                }
        }
 
@@ -653,7 +656,7 @@
 
        *res = p = GDKmalloc(strlen(s) * 2 + 1); /* certainly long enough */
        if (p == NULL)
-               return -1;
+               return GDK_FAIL;
        /* quote all non-alphanumeric ASCII characters (i.e. leave
           non-ASCII and alphanumeric alone) */
        while (*s) {
@@ -665,7 +668,7 @@
                *p++ = *s++;
        }
        *p = 0;
-       return 0;
+       return GDK_SUCCEED;
 }
 
 int
@@ -674,16 +677,16 @@
        (void) tostr;
        (void) l;
        (void) p;
-       return GDK_FAIL;        /* don't generate */
+       return GDK_FAIL;
 }
 
 int
 pcre_fromstr(str instr, int *l, pcre ** val)
 {
-       (void) l;
        (void) instr;
+       (void) l;
        (void) val;
-       return GDK_FAIL;        /* don't parse */
+       return GDK_FAIL;
 }
 
 int
@@ -712,9 +715,9 @@
 }
 
 void
-pcre_del(Heap *h, var_t *index)
+pcre_del(Heap *h, var_t *idx)
 {
-       HEAP_free(h, *index);
+       HEAP_free(h, *idx);
 }
 
 #define pcresize(val) ((sht*)val)[0]
@@ -806,12 +809,12 @@
                GDKfree(*r);
                *r = GDKstrdup(str_nil);
                if (escaped)
-                       return -1; 
+                       return GDK_FAIL; 
        } else {
                *ppat++ = '$';
                *ppat = 0;
        }
-       return 0; 
+       return GDK_SUCCEED; 
 }
 @+ Wrapping
 @c

Index: mal_init.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_init.mx,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- mal_init.mx 14 Sep 2007 07:40:45 -0000      1.120
+++ mal_init.mx 4 Oct 2007 10:37:35 -0000       1.121
@@ -95,7 +95,7 @@
 library mal_memorun;
 
 library xml;
-library batxml;
+#library batxml;
 @-
 The remainder interprets the signatures and resolves the
 address bindings.
@@ -210,10 +210,10 @@
 include opt_crack;
 include opt_joinselect;
 include opt_remoteQueries;
-include crackers; 
+#include crackers; 
 
 include xml;
-include batxml;
+#include batxml;
 @-
 In practice, we have to introduce different startup for each
 client group or database.


-------------------------------------------------------------------------
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