Changeset: fe6978bb73df for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe6978bb73df
Added Files:
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/mat.h
        monetdb5/modules/mal/mat.mal
Removed Files:
        monetdb5/modules/mal/mat.mx
        monetdb5/modules/mal/prelude.mx
Modified Files:
        monetdb5/modules/kernel/algebra2.mx
        monetdb5/modules/kernel/array.mx
        monetdb5/modules/mal/Makefile.ag
Branch: default
Log Message:

De-mx the mat module
Simple straightforward expansion of the Mx macros


diffs (truncated from 1233 to 300 lines):

diff --git a/monetdb5/modules/kernel/algebra2.mx 
b/monetdb5/modules/kernel/algebra2.mx
--- a/monetdb5/modules/kernel/algebra2.mx
+++ b/monetdb5/modules/kernel/algebra2.mx
@@ -345,10 +345,6 @@ int CMDclustered_sum_@1(BAT **ret, BAT *
 @:sumcmd(flt)@
 @:sumcmd(dbl)@
 
-/*
- * @-
- */
-@include ../mal/prelude.mx
 @c
 /*
  * @-
diff --git a/monetdb5/modules/kernel/array.mx b/monetdb5/modules/kernel/array.mx
--- a/monetdb5/modules/kernel/array.mx
+++ b/monetdb5/modules/kernel/array.mx
@@ -68,7 +68,6 @@ address ARRAYproject
 comment "Fill an array representation with constants ";
 
 # @- Implementation
-@include ../mal/prelude.mx
 @c
 
/*============================================================================*/
 #include "monetdb_config.h"
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
@@ -46,7 +46,7 @@ lib_mal = {
                mal_io.c mal_io.h \
                mal_mapi.c mal_mapi.h \
                manual.c manual.h \
-               mat.mx \
+               mat.c mat.h \
                mdb.c mdb.h \
                mkey.c mkey.h \
                pcre.c \
@@ -73,7 +73,7 @@ headers_mal = {
                profiler.mal const.mal attach.mal batExtensions.mal 
algebraExtensions.mal \
                inspect.mal manual.mal mal_io.mal pqueue.mx mkey.mal \
                iterator.mal clients.mal \
-               factories.mal groupby.mal mdb.mal pcre.mal tablet.mal mat.mx \
+               factories.mal groupby.mal mdb.mal pcre.mal tablet.mal mat.mal \
                urlbox.mal transaction.mal \
                mal_mapi.mal sabaoth.mal remote.mal  \
                txtsim.mal recycle.mal \
@@ -81,6 +81,6 @@ headers_mal = {
                tokenizer.mx zorder.mal sample.mal
 }
 
-EXTRA_DIST = algebraExtensions.mal attach.mal batExtensions.mal iterator.mal 
constraints.mal groupby.mal histogram.mal mal_init.mal manual.mal mkey.mal 
pcre.mal profiler.mal recycle.mal remote.mal sabaoth.mal trader.mal 
transaction.mal txtsim.mal tablet.mal tablet.h sample.mal mal_mapi.mal
+EXTRA_DIST = algebraExtensions.mal attach.mal batExtensions.mal iterator.mal 
constraints.mal groupby.mal histogram.mal mal_init.mal manual.mal mkey.mal 
pcre.mal profiler.mal recycle.mal remote.mal sabaoth.mal trader.mal 
transaction.mal txtsim.mal tablet.mal tablet.h sample.mal mal_mapi.mal mat.mal
 
 EXTRA_DIST_DIR = Tests
diff --git a/monetdb5/modules/mal/mat.mx b/monetdb5/modules/mal/mat.c
rename from monetdb5/modules/mal/mat.mx
rename to monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.mx
+++ b/monetdb5/modules/mal/mat.c
@@ -1,29 +1,25 @@
-@/
-The contents of this file are subject to the MonetDB Public License
-Version 1.1 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-http://www.monetdb.org/Legal/MonetDBLicense
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.monetdb.org/Legal/MonetDBLicense
+ * 
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * 
+ * The Original Code is the MonetDB Database System.
+ * 
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2012 MonetDB B.V.
+ * All Rights Reserved.
+*/
 
-Software distributed under the License is distributed on an "AS IS"
-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-License for the specific language governing rights and limitations
-under the License.
-
-The Original Code is the MonetDB Database System.
-
-The Initial Developer of the Original Code is CWI.
-Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
-Copyright August 2008-2012 MonetDB B.V.
-All Rights Reserved.
-@
-
-@f mat
-
-@c
 /*
- * @a Martin Kersten
- * @v 1
- * @+ Multiple association tables
+ * Martin Kersten
+ * Multiple association tables
  * A MAT is a convenient way to deal represent horizontal fragmented
  * tables. It combines the definitions of several, type compatible
  * BATs under a single name.
@@ -41,130 +37,6 @@ All Rights Reserved.
  * The primitives below are chosen to accomodate the SQL
  * front-end to produce reasonable efficient code.
  */
-@mal
-module mat;
-
-pattern new(b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpack
-comment "Define a Merge Association Table (MAT). Faal back to the pack 
operation
-when this is called ";
-
-pattern pack(:any_2...):bat[:void,:any_2]
-address MATpackValues
-comment "Materialize the MAT (of values) into a BAT";
-
-pattern pack(:any_2...):bat[:oid,:any_2]
-address MATpackValues
-comment "Materialize the MAT (of values) into a BAT";
-
-pattern pack(b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpack
-comment "Materialize the MAT into a BAT";
-
-pattern pack2(b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpack2
-comment "Materialize the MAT into a BAT (by an append all)";
-
-pattern pack3(b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpack3
-comment "Materialize the MAT into a BAT by considering the heads as void. 
(used in centipede)";
-
-pattern slice(first:wrd, last:wrd, b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpackSlice
-comment "Materialize a sliced MAT into a BAT";
-
-pattern slice(first:int, last:int, b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpackSlice
-comment "Materialize a sliced MAT into a BAT";
-
-pattern slice(first:lng, last:lng, b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATpackSlice
-comment "Materialize a sliced MAT into a BAT";
-
-pattern project(map:bat[:void,:bte], 
b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATproject
-comment "project using the map bat (contains which bat to use in scan order)";
-
-pattern project(map:bat[:void,:bte], b:bat[:any_1,:any_2]...):bat[:void,:any_2]
-address MATproject
-comment "project using the map bat (contains which bat to use in scan order)";
-
-pattern sortTail(b:bat[:any_1,:any_2]...)
-       (sorted:bat[:void,:any_2], map:bat[:void,:bte]) 
-address MATsortTail
-comment "Returns a BAT copy sorted on the head column.";
-
-pattern sortReverseTail(b:bat[:any_1,:any_2]...)
-       (sorted:bat[:void,:any_2], map:bat[:void,:bte]) 
-address MATsortReverseTail
-comment "Returns a BAT copy sorted on the head column.";
-
-pattern refine(sorted:bat[:void,:any_2], map:bat[:void,:bte], 
b:bat[:any_1,:any_3]...)
-       (rsorted:bat[:void,:oid], rmap:bat[:void,:bte]) 
-address MATrefine
-comment "refine map.";
-
-pattern refine_reverse(sorted:bat[:void,:any_2], map:bat[:void,:bte], 
b:bat[:any_1,:any_3]...)
-       (rsorted:bat[:void,:oid], rmap:bat[:void,:bte]) 
-address MATrefineReverse
-comment "refine map.";
-
-pattern print(b:bat[:any_1,:any_2]...):void
-address MATprint;
-
-pattern newIterator(grp:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MATnewIterator
-comment "Create an iterator over a MAT";
-
-pattern hasMoreElements(grp:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
-address MAThasMoreElements
-comment "Find the next element in the merge table";
-
-command info(g:str, e:str):bat[:any_1,:any_2]
-address MATinfo
-comment "retrieve the definition from the partition catalogue";
-
-# @-
-# @+ Implementation
-@h
-#ifndef _INSPECT_H
-#define _INSPECT_H 
-#include <stdarg.h>
-#include "mal_resolve.h"
-#include "mal_exception.h"
-#include "mal_interpreter.h"
-
-#ifdef WIN32
-#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5)
-#define mat_export extern __declspec(dllimport)
-#else
-#define mat_export extern __declspec(dllexport)
-#endif
-#else
-#define mat_export extern
-#endif
-
-mat_export str MATpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-mat_export str MATpack2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-mat_export str MATpack3(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-mat_export str MATpackValues(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
-mat_export str MATpackSlice(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
-mat_export str MATnewIterator(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
-mat_export str MAThasMoreElements(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
-mat_export str MATdummy(int *ret, str *grp);
-mat_export str MATinfo(int *ret, str *grp, str *elm);
-mat_export str MATprint(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-mat_export str MATproject(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-mat_export str MATrefine(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-mat_export str MATsortReverseTail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-mat_export str MATsortTail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-mat_export str MATrefineReverse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-#endif /* _INSPECT_H */
-@c
-/*
- * @-
- * Mal symbol table and environment analysis.
- */
 #include "monetdb_config.h"
 #include "mat.h"
 #include "group.h"
@@ -202,7 +74,6 @@ MAThasMoreElements(Client cntxt, MalBlkP
        return MAL_SUCCEED;
 }
 /*
- * @-
  * The pack is an ordinary multi BAT insert. Oid synchronistion
  * between pieces should be ensured by the code generators.
  * The pack operation could be quite expensive, because it
@@ -595,18 +466,18 @@ MATproject_any( BAT *map, BAT **bats, in
        return res;
 }
 
-@= project
+/* The type-specific projection operators */
 static BAT *
-MATproject_@1( BAT *map, BAT **bats, int len, int ttpe )
+MATproject_bte( BAT *map, BAT **bats, int len, int ttpe )
 {
        BAT *res;
        int i;
        BUN j, cnt = BATcount(map);
-       @1 *resT, **batsT;
+       bte *resT, **batsT;
        bte *mapT;
 
        res = BATnew(TYPE_void, ttpe, cnt);
-       batsT = (@1**)GDKmalloc(sizeof(@1*) * len);
+       batsT = (bte**)GDKmalloc(sizeof(bte*) * len);
        if (res == NULL || batsT == NULL) {
                if (res)
                        BBPreclaim(res);
@@ -615,10 +486,10 @@ MATproject_@1( BAT *map, BAT **bats, int
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
-       resT = (@1*)Tloc(res, 0);
+       resT = (bte*)Tloc(res, 0);
        mapT = (bte*)Tloc(map, 0);
        for (i=0; i<len; i++)
-               batsT[i] = (@1*)Tloc(bats[i], 0);
+               batsT[i] = (bte*)Tloc(bats[i], 0);
        for (j=0; j<cnt; j++)
                resT[j] = *batsT[mapT[j]]++;
        BATsetcount(res, j);
@@ -626,12 +497,99 @@ MATproject_@1( BAT *map, BAT **bats, int
        GDKfree(batsT);
        return res;
 }
-@
-@c
-@:project(bte)@
-@:project(sht)@
-@:project(int)@
-@:project(lng)@
+
+static BAT *
+MATproject_sht( BAT *map, BAT **bats, int len, int ttpe )
+{
+       BAT *res;
+       int i;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to