Changeset: 82f3005bfdb2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=82f3005bfdb2
Modified Files:
        monetdb5/modules/atoms/Makefile.ag
        monetdb5/modules/atoms/colxml.c
        monetdb5/modules/atoms/colxml.h
        monetdb5/modules/atoms/colxml.mal
        monetdb5/modules/atoms/str.c
        monetdb5/modules/atoms/str.h
        monetdb5/modules/mal/Makefile.ag
        monetdb5/modules/mal/xmlcolumn.c
        monetdb5/modules/mal/xmlcolumn.h
        monetdb5/modules/mal/xmlcolumn.mal
Branch: headless
Log Message:

colxml -> modules/mal/xmlcolumn


diffs (truncated from 695 to 300 lines):

diff --git a/monetdb5/modules/atoms/Makefile.ag 
b/monetdb5/modules/atoms/Makefile.ag
--- a/monetdb5/modules/atoms/Makefile.ag
+++ b/monetdb5/modules/atoms/Makefile.ag
@@ -25,7 +25,6 @@
 lib_atoms = {
        NOINST
        SOURCES = \
-               colxml.c \
                blob.c \
                color.c \
                identifier.c \
@@ -41,7 +40,6 @@
        HEADERS = mal
        DIR = libdir/monetdb5
        SOURCES = \
-               colxml.mal \
                blob.mal \
                color.mal \
                identifier.mal \
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -66,7 +66,6 @@
 */
 #include "monetdb_config.h"
 #include "str.h"
-#include <string.h>
 
 #ifdef HAVE_LANGINFO_H
 #include <langinfo.h>
diff --git a/monetdb5/modules/atoms/str.h b/monetdb5/modules/atoms/str.h
--- a/monetdb5/modules/atoms/str.h
+++ b/monetdb5/modules/atoms/str.h
@@ -1,9 +1,9 @@
 #ifndef __string_H__
 #define __string_H__
-#include <gdk.h>
+#include <string.h>
+#include "ctype.h"
 #include "mal.h"
 #include "mal_exception.h"
-#include "ctype.h"
 
 #ifdef WIN32
 #if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5)
diff --git a/monetdb5/modules/mal/Makefile.ag b/monetdb5/modules/mal/Makefile.ag
--- a/monetdb5/modules/mal/Makefile.ag
+++ b/monetdb5/modules/mal/Makefile.ag
@@ -21,6 +21,7 @@
        ../../../common/stream \
        ../../../common/utils \
        ../../../gdk \
+   $(libxml2_CFLAGS) \
        $(pcre_CFLAGS) $(zlib_CFLAGS) $(BZIP_INCS)
 
 MTSAFE
@@ -53,6 +54,7 @@
                tablet_sql.c \
                tokenizer.c \
                trader.c \
+               xmlcolumn.c \
                zorder.c
 }
 
@@ -67,7 +69,7 @@
                sabaoth.mal remote.c  \
                txtsim.mx recycle.mal \
                trader.mal replication.mal \
-               tokenizer.mal trader.mal zorder.mal
+               tokenizer.mal trader.mal xmlcolumn.mal zorder.mal
 }
 
 EXTRA_DIST = prelude.mx histogram.mal histogram.h mal_init.mal manual.mal 
manual.h recycle.mal recycle.h sabaoth.mal sabaoth.h trader.mal trader.h
diff --git a/monetdb5/modules/atoms/colxml.c b/monetdb5/modules/mal/xmlcolumn.c
rename from monetdb5/modules/atoms/colxml.c
rename to monetdb5/modules/mal/xmlcolumn.c
--- a/monetdb5/modules/atoms/colxml.c
+++ b/monetdb5/modules/mal/xmlcolumn.c
@@ -23,11 +23,6 @@
  * The collection of routines provided here are map operations
  * for the atom xml primitives. 
  * 
- * In line with the batcalc module, we assume that
- * if two bat operands are provided that they are already
- * aligned on the head. Moreover, the head of the BATs
- * are limited to :oid.
- * 
  * The implementation is focussed on functionality. At a later stage
  * we may postpone string contstruction until it is really needed.
 */
@@ -42,63 +37,58 @@
         throw(MAL, "xml." Z, INTERNAL_COL_ACCESS);
 
 #define prepareResult(X,Y,tpe,Z)                                       \
-    (X) = BATnew((Y)->htype, (tpe), COLcount(Y));      \
+    (X) = COLnew(COLtype(Y), (tpe), COLcount(Y));      \
     if ((X) == NULL) {                                                         
\
         CBPreleaseref((Y)->batCacheid);                                \
         throw(MAL, "xml." Z, MAL_MALLOC_FAIL); \
     }                                                                          
                \
-    if ((Y)->htype == TYPE_void)                                       \
-        COLseqbase((X), (Y)->hseqbase);                                \
-    (X)->hsorted = (Y)->hsorted;                                       \
-    (X)->tsorted =  0;                                                         
\
-    (X)->H->nonil = (Y)->H->nonil;                                     \
-       (X)->T->nonil = 1;
+    (X)->sorted = (Y)->sorted;                                 \
+    (X)->nonil = (Y)->nonil;                                   \
 
 #define finalizeResult(X,Y,Z)                                  \
     if (!((Y)->dirty & 2))                                     \
-               (Y) = COLsetaccess((Y), BAT_READ);              \
+               (Y) = COLsetaccess((Y), COL_READ);              \
     *(X) = (Y)->batCacheid;                                            \
     CBPkeepref(*(X));                                                  \
     CBPreleaseref((Z)->batCacheid);
 
 str
-BATXMLxml2str(int *ret, int *bid)
+COLXMLxml2str(int *ret, int *bid)
 {
-       BAT *b, *bn;
-       BUN p, q;
+       COL *b, *bn;
+       oid p, q;
        COLiter bi;
 
        prepareOperand(b, bid, "str");
        prepareResult(bn, b, TYPE_str, "str");
        bi = col_iterator(b);
-       COLaccessBegin(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessBegin(b,USE_HEAP,MMAP_SEQUENTIAL);
        COLloop(b, p, q) {
                ptr h = BUNhead(bi, p);
-               str t = (str) BUNtail(bi, p);
 
-               if (strNil(t)) {
-                       bunfastins(bn, h, t);
-                       bn->T->nonil = 0;
+               if (strNil(h)) {
+                       bunfastins(bn, h);
+                       bn->nonil = 0;
                } else {
-                       assert(*t == 'A' || *t == 'C' || *t == 'D');
-                       bunfastins(bn, h, t + 1);
+                       assert(*h == 'A' || *h == 'C' || *h == 'D');
+                       bunfastins(bn, h + 1);
                }
        }
-       COLaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessEnd(b,USE_HEAP,MMAP_SEQUENTIAL);
        finalizeResult(ret, bn, b);
        return MAL_SUCCEED;
   bunins_failed:
-       COLaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessEnd(b,USE_HEAP,MMAP_SEQUENTIAL);
        CBPreleaseref(b->batCacheid);
        CBPunfix(bn->batCacheid);
        throw(MAL, "xml.str", OPERATION_FAILED " During bulk coercion");
 }
 
 str
-BATXMLxmltext(int *ret, int *bid)
+COLXMLxmltext(int *ret, int *bid)
 {
-       BAT *b, *bn;
-       BUN p, q;
+       COL *b, *bn;
+       oid p, q;
        COLiter bi;
        size_t size = 0;
        str buf = NULL;
@@ -109,21 +99,20 @@
        prepareOperand(b, bid, "text");
        prepareResult(bn, b, TYPE_str, "text");
        bi = col_iterator(b);
-       COLaccessBegin(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessBegin(b,USE_HEAP,MMAP_SEQUENTIAL);
        COLloop(b, p, q) {
-               ptr h = BUNhead(bi, p);
-               str t = (str) BUNtail(bi, p);
+               str h = (str) BUNhead(bi, p);
                size_t len;
 
-               if (strNil(t)) {
-                       bunfastins(bn, h, t);
-                       bn->T->nonil = 0;
+               if (strNil(h)) {
+                       bunfastins(bn, h);
+                       bn->nonil = 0;
                        continue;
                }
-               assert(*t == 'A' || *t == 'C' || *t == 'D');
-               len = strlen(t);
-               if (*t == 'D') {
-                       xmlDocPtr d = xmlParseMemory(t + 1, (int) (len - 1));
+               assert(*h == 'A' || *h == 'C' || *h == 'D');
+               len = strlen(h);
+               if (*h == 'D') {
+                       xmlDocPtr d = xmlParseMemory(h + 1, (int) (len - 1));
                        elem = xmlDocGetRootElement(d);
                        content = (str) xmlNodeGetContent(elem);
                        xmlFreeDoc(d);
@@ -131,7 +120,7 @@
                                err= MAL_MALLOC_FAIL;
                                goto bunins_failed;
                        }
-               } else if (*t == 'C') {
+               } else if (*h == 'C') {
                        if (doc == NULL)
                                doc = xmlParseMemory("<doc/>", 6);
                        xmlParseInNodeContext(xmlDocGetRootElement(doc), t + 1, 
(int) (len - 1), 0, &elem);
@@ -155,10 +144,10 @@
                                }
                        }
                        s = buf;
-                       t++;
-                       while (*t) {
-                               if (*t == '"' || *t == '\'') {
-                                       char q = *t++;
+                       h++;
+                       while (*h) {
+                               if (*h == '"' || *h == '\'') {
+                                       char q = *h++;
 
                                        s += XMLunquotestring(&t, q, s);
                                }
@@ -167,12 +156,12 @@
                        *s = 0;
                }
                assert(content != NULL || buf != NULL);
-               bunfastins(bn, h, content != NULL ? content : buf);
+               bunfastins(bn, content != NULL ? content : buf);
                if (content != NULL)
                        GDKfree(content);
                content = NULL;
        }
-       COLaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessEnd(b,USE_HEAP,MMAP_SEQUENTIAL);
        finalizeResult(ret, bn, b);
        if (buf != NULL)
                GDKfree(buf);
@@ -180,7 +169,7 @@
                xmlFreeDoc(doc);
        return MAL_SUCCEED;
   bunins_failed:
-       COLaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
+       COLaccessEnd(b,USE_HEAP,MMAP_SEQUENTIAL);
        CBPreleaseref(b->batCacheid);
        CBPunfix(bn->batCacheid);
        if (buf != NULL)
@@ -205,10 +194,10 @@
 */
 
 str
-BATXMLstr2xml(int *ret, int *bid)
+COLXMLstr2xml(int *ret, int *bid)
 {
-       BAT *b, *bn;
-       BUN p, q;
+       COL *b, *bn;
+       oid p, q;
        size_t size = BUFSIZ;
        str buf, err= OPERATION_FAILED;
        COLiter bi;
@@ -256,10 +245,10 @@
 }
 
 str
-BATXMLdocument(int *ret, int *bid)
+COLXMLdocument(int *ret, int *bid)
 {
-       BAT *b, *bn;
-       BUN p, q;
+       COL *b, *bn;
+       oid p, q;
        COLiter bi;
        size_t size = BUFSIZ;
        str buf = GDKmalloc(size);
@@ -315,10 +304,10 @@
 }
 
 str
-BATXMLcontent(int *ret, int *bid)
+COLXMLcontent(int *ret, int *bid)
 {
-       BAT *b, *bn;
-       BUN p, q;
+       COL *b, *bn;
+       oid p, q;
        COLiter bi;
        xmlDocPtr doc;
        xmlNodePtr root;
@@ -394,10 +383,10 @@
 }
 
 str
-BATXMLisdocument(int *ret, int *bid)
+COLXMLisdocument(int *ret, int *bid)
 {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to