Changeset: 871bfc5d9692 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=871bfc5d9692
Added Files:
        monetdb5/modules/atoms/00_json_hge.include
        monetdb5/modules/atoms/batxml.include
        monetdb5/modules/atoms/blob.include
        monetdb5/modules/atoms/color.include
        monetdb5/modules/atoms/identifier.include
        monetdb5/modules/atoms/inet.include
        monetdb5/modules/atoms/json.include
        monetdb5/modules/atoms/mtime.include
        monetdb5/modules/atoms/str.include
        monetdb5/modules/atoms/streams.include
        monetdb5/modules/atoms/url.include
        monetdb5/modules/atoms/uuid.include
        monetdb5/modules/atoms/xml.include
        monetdb5/modules/kernel/00_aggr_hge.include
        monetdb5/modules/kernel/aggr.include
        monetdb5/modules/kernel/alarm.include
        monetdb5/modules/kernel/algebra.include
        monetdb5/modules/kernel/bat5.include
        monetdb5/modules/kernel/batcolor.include
        monetdb5/modules/kernel/batmmath.include
        monetdb5/modules/kernel/batstr.include
        monetdb5/modules/kernel/group.include
        monetdb5/modules/kernel/logger.include
        monetdb5/modules/kernel/microbenchmark.include
        monetdb5/modules/kernel/mmath.include
        monetdb5/modules/kernel/status.include
        monetdb5/modules/mal/00_batExtensions_hge.include
        monetdb5/modules/mal/00_batcalc_hge.include
        monetdb5/modules/mal/00_calc_hge.include
        monetdb5/modules/mal/00_iterator_hge.include
        monetdb5/modules/mal/00_language_hge.include
        monetdb5/modules/mal/00_mal_mapi_hge.include
        monetdb5/modules/mal/00_mkey_hge.include
        monetdb5/modules/mal/01_batcalc.include
        monetdb5/modules/mal/01_calc.include
        monetdb5/modules/mal/batExtensions.include
        monetdb5/modules/mal/batmtime.include
        monetdb5/modules/mal/bbp.include
        monetdb5/modules/mal/clients.include
        monetdb5/modules/mal/factories.include
        monetdb5/modules/mal/groupby.include
        monetdb5/modules/mal/inspect.include
        monetdb5/modules/mal/iterator.include
        monetdb5/modules/mal/json_util.include
        monetdb5/modules/mal/language.include
        monetdb5/modules/mal/mal_io.include
        monetdb5/modules/mal/mal_mapi.include
        monetdb5/modules/mal/manifold.include
        monetdb5/modules/mal/manual.include
        monetdb5/modules/mal/mat.include
        monetdb5/modules/mal/mdb.include
        monetdb5/modules/mal/mkey.include
        monetdb5/modules/mal/oltp.include
        monetdb5/modules/mal/orderidx.include
        monetdb5/modules/mal/pcre.include
        monetdb5/modules/mal/profiler.include
        monetdb5/modules/mal/querylog.include
        monetdb5/modules/mal/remote.include
        monetdb5/modules/mal/sabaoth.include
        monetdb5/modules/mal/sample.include
        monetdb5/modules/mal/sysmon.include
        monetdb5/modules/mal/tablet.include
        monetdb5/modules/mal/tokenizer.include
        monetdb5/modules/mal/transaction.include
        monetdb5/modules/mal/txtsim.include
        monetdb5/modules/mal/wlc.include
        monetdb5/modules/prepare.sh
        monetdb5/optimizer/optimizer.include
Modified Files:
        monetdb5/mal/mal_embedded.c
        monetdb5/mal/mal_embedded.h
        monetdb5/modules/mal/mal_init.mal
Branch: mdbl-mal
Log Message:

First major step in for embedded version with MAL signatures taken
from a global array.

A few files require further analysis and the autoload files should
also be included.


diffs (truncated from 47342 to 300 lines):

diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c
--- a/monetdb5/mal/mal_embedded.c
+++ b/monetdb5/mal/mal_embedded.c
@@ -11,6 +11,8 @@
  * These routines assume that the signatures for all MAL files are defined as 
text in mal_embdded.h
  * They are parsed upon system restart without access to their source files.
  * This way the definitions are part of the library upon compilation.
+ * It assumes that all necessary libraries are already loaded.
+ * A failure to bind the address in the context of an embedded version is not 
considered an error.
  */
 #include "monetdb_config.h"
 #include "mal_type.h"
@@ -21,25 +23,111 @@
 
 static int embeddedinitialized = 0;
 
-/* The source for the MAL signatures */
+/* The source for the MAL signatures*/
 static struct{
-       str filename, source;
+       str modnme, source;
 } malSignatures[] = 
 {
-{ "welcome", "io.print(\"Load MAL signatures\");"},
+// Include the MAL definitions files in the proper order.
+
+#include "../modules/mal/mdb.include"
+#include "../modules/kernel/alarm.include"
+#include "../modules/kernel/mmath.include"
+#include "../modules/atoms/streams.include"
+
+#include "../modules/kernel/bat5.include"
+#include "../modules/mal/batExtensions.include"
+#include "../modules/kernel/algebra.include"
+#include "../modules/mal/orderidx.include"
+#include "../modules/kernel/status.include"
+#include "../modules/mal/groupby.include"
+#include "../modules/kernel/group.include"
+#include "../modules/kernel/aggr.include"
+#include "../modules/mal/mkey.include"
+
+#include "../modules/atoms/blob.include"
+#include "../modules/atoms/color.include"
+#include "../modules/atoms/str.include"
+#include "../modules/atoms/url.include"
+#include "../modules/atoms/uuid.include"
+#include "../modules/atoms/json.include"
+#include "../modules/mal/json_util.include"
+//#include "../modules/atoms/mtime.include"
+#include "../modules/atoms/inet.include"
+#include "../modules/atoms/identifier.include"
+#include "../modules/atoms/xml.include"
+#include "../modules/atoms/batxml.include"
+
+#include "../modules/kernel/batmmath.include"
+#include "../modules/mal/batmtime.include"
+#include "../modules/kernel/batstr.include"
+#include "../modules/kernel/batcolor.include"
+
+#include "../modules/mal/sabaoth.include"
+#include "../modules/mal/pcre.include"
+#include "../modules/mal/clients.include"
+#include "../modules/mal/bbp.include"
+#include "../modules/mal/mal_io.include"
+#include "../modules/mal/manifold.include"
+#include "../modules/mal/factories.include"
+#include "../modules/mal/remote.include"
+
+#include "../modules/mal/mat.include"
+#include "../modules/mal/inspect.include"
+#include "../modules/mal/manual.include"
+#include "../modules/mal/language.include"
+
+#include "../modules/mal/profiler.include"
+#include "../modules/mal/querylog.include"
+#include "../modules/mal/sysmon.include"
+#include "../modules/mal/sample.include"
+
+//#include "../optimizer/optimizer.include"
+
+#include "../modules/mal/iterator.include"
+#include "../modules/mal/txtsim.include"
+#include "../modules/mal/tokenizer.include"
+
+//#include "../modules/mal/mal_mapi.include"
+#include "../modules/mal/oltp.include"
+//#include "../modules/mal/wlc.include"
+
+// Any extensions (MAL scripts) that should be automatically loaded upon
+// startup can be placed in the autoload directory.  One typically finds
+// the SQL module in here, but it can also be used to load custom scripts.
+
+//include calc; --- moved to autoload/01_calc
+//include batcalc; -- moved to autoload/01_batcalc
+// include autoload;
+// test case
+//{ "mdbextension", "module dummy; pattern dummy.embed(mod:str, fcn:str): void 
address MDBstartFactory; "
+//"pattern dummy.genius():void address MDBnotknown;"},
 { 0, 0}
 }
 ;
+
+
 str
 malEmbeddedBoot(Client c)
 {
        int i;
+       str s;
+       Symbol fcn;
 
        (void) c;
        if( embeddedinitialized )
                return MAL_SUCCEED;
-       for(i = 0; malSignatures[i].filename; i++){
-               fprintf(stderr, "Load the file %s\n", malSignatures[i].source);
+       for(i = 0; malSignatures[i].modnme; i++){
+               // fprintf(stderr, "Module %s", malSignatures[i].modnme);
+
+               s = loadLibrary(malSignatures[i].modnme, FALSE);
+               if (s) {
+                       fprintf(stderr,"%s\n", s);
+                       GDKfree(s);
+               }
+
+               // fprintf(stderr, "Parse the source %s\n", 
malSignatures[i].source);
+               compileString(&fcn, c, malSignatures[i].source);
        }
        embeddedinitialized = 1;
        return MAL_SUCCEED;
diff --git a/monetdb5/mal/mal_embedded.h b/monetdb5/mal/mal_embedded.h
--- a/monetdb5/mal/mal_embedded.h
+++ b/monetdb5/mal/mal_embedded.h
@@ -14,6 +14,7 @@
 #include "mal_client.h"
 #include "mal_namespace.h"
 #include "mal_exception.h"
+#include "mal_linker.h"
 #include "mal_import.h"
 #include "mal_private.h"
 
diff --git a/monetdb5/modules/atoms/00_json_hge.include 
b/monetdb5/modules/atoms/00_json_hge.include
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/00_json_hge.include
@@ -0,0 +1,11 @@
+{ "00_json_hge",
+"# This Source Code Form is subject to the terms of the Mozilla Public \n"
+"# License, v. 2.0.  If a copy of the MPL was not distributed with this \n"
+"# file, You can obtain one at http://mozilla.org/MPL/2.0/. \n"
+"# \n"
+"# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. \n"
+"command filter(name:json, idx:hge) :json \n"
+"address JSONfilterArray_hge; \n"
+"command filter(name:json, idx:hge, other:str) :json \n"
+"address JSONfilterArrayDefault_hge; \n"
+},
diff --git a/monetdb5/modules/atoms/batxml.include 
b/monetdb5/modules/atoms/batxml.include
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/batxml.include
@@ -0,0 +1,77 @@
+{ "batxml",
+"# This Source Code Form is subject to the terms of the Mozilla Public \n"
+"# License, v. 2.0.  If a copy of the MPL was not distributed with this \n"
+"# file, You can obtain one at http://mozilla.org/MPL/2.0/. \n"
+"# \n"
+"# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. \n"
+"module batxml; \n"
+"command batxml.xml(src:bat[:str]):bat[:xml] \n"
+"address BATXMLstr2xml \n"
+"comment \"Cast the string to an xml compliant string.\"; \n"
+"command batxml.str(src:bat[:xml]):bat[:str] \n"
+"address BATXMLxml2str \n"
+"comment \"Cast the xml to a string.\"; \n"
+"command batxml.document(src:bat[:str]):bat[:xml] \n"
+"address BATXMLdocument \n"
+"comment \"Parse the string as an XML document.\"; \n"
+"command batxml.content(src:bat[:str]):bat[:xml] \n"
+"address BATXMLcontent \n"
+"comment \"Parse the string as XML element content.\"; \n"
+"command batxml.comment(val:bat[:str]):bat[:xml] \n"
+"address BATXMLcomment \n"
+"comment \"Create an XML comment element.\"; \n"
+"command batxml.parse(doccont:str,val:bat[:str],option:str):bat[:xml] \n"
+"address BATXMLparse \n"
+"comment \"Parse the XML document or element string values.\"; \n"
+"command batxml.serialize(val:bat[:xml]):bat[:str] \n"
+"address BATXMLxml2str \n"
+"comment \"Serialize the XML object to a string.\"; \n"
+"command batxml.text(val:bat[:xml]):bat[:str] \n"
+"address BATXMLxmltext \n"
+"comment \"Serialize the XML object to a string.\"; \n"
+"command batxml.xquery(val:bat[:str],expr:str):bat[:xml] \n"
+"address BATXMLxquery \n"
+"comment \"Execute the XQuery against the elements.\"; \n"
+"# todo \n"
+"# command batxml.table(val:bat[:str],expr:str):bat[:xml] \n"
+"# address BATXMLquery \n"
+"# comment \"Execute the XQuery against the elements\"; \n"
+"command batxml.pi(target:str, val:bat[:xml]):bat[:xml] \n"
+"address BATXMLpi \n"
+"comment \"Construct a processing instruction.\"; \n"
+"command batxml.attribute(name:str, val:bat[:str]):bat[:xml] \n"
+"address BATXMLattribute \n"
+"comment \"Construct an attribute value pair.\"; \n"
+"command batxml.element(name:str, s:bat[:xml]) :bat[:xml] \n"
+"address BATXMLelementSmall \n"
+"comment \"The basic building block for XML elements are namespaces, 
attributes and a sequence of XML elements. The name space and the attributes 
may be left unspecified.\";  \n"
+"command batxml.options(tag:str, option:str,left:bat[:xml]):bat[:xml] \n"
+"address BATXMLoptions \n"
+"comment \"Create the components including NULL conversions.\"; \n"
+"command batxml.element(name:str, ns:xml, attr:xml, s:bat[:xml]):bat[:xml] \n"
+"address BATXMLelement \n"
+"comment \"The basic building block for XML elements are namespaces, 
attributes and a sequence of XML elements. The name space and the attributes 
may be left unspecified(=nil).\"; \n"
+"command batxml.concat(left:bat[:xml],right:bat[:xml] ):bat[:xml] \n"
+"address BATXMLconcat \n"
+"comment \"Concatenate the XML values.\"; \n"
+"pattern batxml.forest(val:bat[:xml]...):bat[:xml] \n"
+"address BATXMLforest \n"
+"comment \"Construct an element list.\"; \n"
+"command batxml.root(val:bat[:xml], version:str, standalone:str):bat[:xml] \n"
+"address BATXMLroot \n"
+"comment \"Contruct the root nodes.\"; \n"
+"command batxml.isdocument(val:bat[:str]):bat[:bit] \n"
+"address BATXMLisdocument \n"
+"comment \"Validate the string as a XML document.\"; \n"
+"command xml.aggr(val:bat[:xml]):xml \n"
+"address BATXMLgroup \n"
+"comment \"Aggregate the XML values.\"; \n"
+"command xml.subaggr(val:bat[:xml],g:bat[:oid],e:bat[:any_1], skip_nils:bit) 
:bat[:xml] \n"
+"address AGGRsubxml \n"
+"comment \"Grouped aggregation of XML values.\"; \n"
+"command xml.subaggr(val:bat[:xml],g:bat[:oid],e:bat[:any_1],s:bat[:oid], 
skip_nils:bit) :bat[:xml] \n"
+"address AGGRsubxmlcand \n"
+"comment \"Grouped aggregation of XML values with candidates list.\"; \n"
+"module batcalc; \n"
+"command xml(src:bat[:str]):bat[:xml] address BATXMLstr2xml; \n"
+},
diff --git a/monetdb5/modules/atoms/blob.include 
b/monetdb5/modules/atoms/blob.include
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/blob.include
@@ -0,0 +1,42 @@
+{ "blob",
+"# This Source Code Form is subject to the terms of the Mozilla Public \n"
+"# License, v. 2.0.  If a copy of the MPL was not distributed with this \n"
+"# file, You can obtain one at http://mozilla.org/MPL/2.0/. \n"
+"# \n"
+"# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. \n"
+"module blob; \n"
+"atom blob; \n"
+"command tostr()   address BLOBtostr; \n"
+"command fromstr() address BLOBfromstr; \n"
+"command cmp()     address BLOBcmp; \n"
+"command hash()    address BLOBhash; \n"
+"command null()    address BLOBnull; \n"
+"command read()    address BLOBread; \n"
+"command write()   address BLOBwrite; \n"
+"command put()     address BLOBput; \n"
+"command del()     address BLOBdel; \n"
+"command length()  address BLOBlength; \n"
+"command heap()    address BLOBheap; \n"
+"command blob(s:blob):blob \n"
+"address BLOBblob_blob \n"
+"comment \"Noop routine.\"; \n"
+"command blob(s:str):blob \n"
+"address BLOBblob_fromstr; \n"
+"# @+ string functions \n"
+"# Manipulation function to convert strings to blobs. \n"
+"# Not to be confused with blob parsing and printing. \n"
+"# Note, a function tostring(b:blob):str is not possible since the \n"
+"# string would not be guaranteed UTF-8 encoded. \n"
+"command toblob(v:str) :blob \n"
+"address BLOBtoblob \n"
+"comment \"store a string as a blob.\"; \n"
+"command nitems(b:blob):int \n"
+"address BLOBnitems \n"
+"comment \"get the number of bytes in this blob.\"; \n"
+"command prelude() :void \n"
+"address BLOBprelude; \n"
+"blob.prelude(); \n"
+"module calc; \n"
+"command blob(b:blob):blob address BLOBblob_blob; \n"
+"command blob(s:str):blob address BLOBblob_fromstr; \n"
+},
diff --git a/monetdb5/modules/atoms/color.include 
b/monetdb5/modules/atoms/color.include
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/color.include
@@ -0,0 +1,62 @@
+{ "color",
+"# This Source Code Form is subject to the terms of the Mozilla Public \n"
+"# License, v. 2.0.  If a copy of the MPL was not distributed with this \n"
+"# file, You can obtain one at http://mozilla.org/MPL/2.0/. \n"
+"# \n"
+"# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. \n"
+"module color; \n"
+"atom color:int; \n"
+"command tostr() address color_tostr; \n"
+"command fromstr() address color_fromstr; \n"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to