Changeset: d172232603c6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d172232603c6
Added Files:
        monetdb5/modules/kernel/batcolor.c
        monetdb5/modules/kernel/batcolor.h
        monetdb5/modules/kernel/batcolor.mal
        monetdb5/modules/kernel/batmmath.c
        monetdb5/modules/kernel/batmmath.h
        monetdb5/modules/kernel/batmmath.mal
Removed Files:
        monetdb5/modules/kernel/batcolor.mx
        monetdb5/modules/kernel/batmmath.mx
Modified Files:
        monetdb5/modules/kernel/Makefile.ag
        monetdb5/optimizer/Tests/CXerror1.mal
        monetdb5/optimizer/Tests/CXerror1.stable.out
        monetdb5/tests/gdkTests/Tests/void.stable.out
Branch: default
Log Message:

De-Mx batcolor and batmmath


diffs (truncated from 1100 to 300 lines):

diff --git a/monetdb5/modules/kernel/Makefile.ag 
b/monetdb5/modules/kernel/Makefile.ag
--- a/monetdb5/modules/kernel/Makefile.ag
+++ b/monetdb5/modules/kernel/Makefile.ag
@@ -43,9 +43,9 @@ lib_kernel = {
                array.c array.h \
                bat5.c bat5.h \
                batcalc.c \
-               batcolor.mx \
+               batcolor.c batcolor.h \
                batifthen.mx \
-               batmmath.mx \
+               batmmath.c batmmath.h \
                batmtime.mx \
                batstr.mx \
                calc.c \
@@ -65,7 +65,7 @@ headers_mal = {
        DIR = libdir/monetdb5
        SOURCES = calc.mal bat5.mal algebra.mx status.mal unix.mal \
                mmath.mal lock.mal sema.mal alarm.mal batstr.mx batmtime.mx \
-               batcolor.mx batifthen.mx batcalc.mal batmmath.mx \
+               batcolor.mal batifthen.mx batcalc.mal batmmath.mal \
                group.mx aggr.mx array.mal \
                counters.mal logger.mal microbenchmark.mal
 }
diff --git a/monetdb5/modules/kernel/batcolor.mx 
b/monetdb5/modules/kernel/batcolor.c
rename from monetdb5/modules/kernel/batcolor.mx
rename to monetdb5/modules/kernel/batcolor.c
--- a/monetdb5/modules/kernel/batcolor.mx
+++ b/monetdb5/modules/kernel/batcolor.c
@@ -1,28 +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 batcolor
-
-@c
 /*
- * @a M.L. Kersten
- * @+ Color multiplexes
+ * M.L. Kersten
+ * Color multiplexes
  * [TODO: property propagations and general testing]
  * The collection of routines provided here are map operations
  * for the color string primitives.
@@ -33,103 +30,8 @@ All Rights Reserved.
  * are limited to :oid, which can be cheaply realized using
  * the GRPsplit operation.
  */
-@mal
-module batcolor;
-command str(b:bat[:oid,:color]):bat[:oid,:str]
-address CLRbatStr
-comment "Identity mapping for string bats";
 
-command color(s:bat[:oid,:str]):bat[:oid,:color]
-address CLRbatColor
-comment "Converts string to color";
-
-command rgb(r:bat[:oid,:int], g:bat[:oid,:int], 
b:bat[:oid,:int]):bat[:oid,:color] 
-address CLRbatRgb
-comment        "Converts an RGB triplets to a color atom";
-
-command red(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatRed
-comment        "Extracts red component from a color atom";
-
-command green(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatGreen
-comment        "Extracts green component from a color atom";
-
-command blue (c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatBlue
-comment        "Extracts blue component from a color atom";
-
-command hue(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatHueInt
-comment        "Extracts hue component from a color atom";
-
-command saturation(c:bat[:oid,:color]) :bat[:oid,:int]
-address CLRbatSaturationInt
-comment        "Extracts saturation component from a color atom";
-
-command value(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatValueInt
-comment        "Extracts value component from a color atom";
-
-command hsv(h:bat[:oid,:flt],s:bat[:oid,:flt], v:bat[:oid,:flt]) 
:bat[:oid,:color] 
-address CLRbatHsv
-comment        "Converts an HSV triplets to a color atom";
-
-command hue(c:bat[:oid,:color]) :bat[:oid,:flt] 
-address CLRbatHue
-comment        "Extracts hue component from a color atom";
-
-command saturation(c:bat[:oid,:color]) :bat[:oid,:flt] 
-address CLRbatSaturation
-comment        "Extracts saturation component from a color atom";
-
-command value(c:bat[:oid,:color]) :bat[:oid,:flt] 
-address CLRbatValue
-comment        "Extracts value component from a color atom";
-
-# @-
-# #command ycc(y:bat[:oid,:int],cr:bat[:oid,:int],cb:bat[:oid,:int]) 
:bat[:oid,:color]
-# #address CLRbatycc
-# #comment     "Converts an YCC triplets to a color atom";
-
-command luminance (c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatLuminance
-comment        "Extracts Y(luminance) component from a color atom";
-
-command cr(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatCr
-comment        "Extracts Cr(red color) component from a color atom";
-
-command cb(c:bat[:oid,:color]) :bat[:oid,:int] 
-address CLRbatCb
-comment        "Extracts Cb(blue color) component from a color atom";
-@c
-/*
- * @+ Implementation
- */
-#include "monetdb_config.h"
-#include <gdk.h>
-#include <string.h>
-#include <mal.h>
-#include <color.h>
-#include "mal_exception.h"
-
-#ifdef WIN32
-#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5)
-#define batcolor_export extern __declspec(dllimport)
-#else
-#define batcolor_export extern __declspec(dllexport)
-#endif
-#else
-#define batcolor_export extern
-#endif
-
-#ifdef HAVE_LANGINFO_H
-#include <langinfo.h>
-#endif
-#ifdef HAVE_ICONV_H
-#include <iconv.h>
-#endif
+#include "batcolor.h"
 
 #define prepareOperand(X,Y,Z) \
        if( (X= BATdescriptor(*Y)) == NULL ) \
@@ -158,86 +60,79 @@ comment    "Extracts Cb(blue color) compone
        *X = (Y)->batCacheid; \
        BBPkeepref(*(X));\
        BBPreleaseref(Z->batCacheid);
-@= BATwalk
-batcolor_export str CLRbat@1(int *ret, int *l);
-str CLRbat@1(int *ret, int *l)
-{   
-       BATiter bi;
-       BAT *bn, *b;
-       BUN p,q;
-       @3 *x;
-       @4 y, *yp = &y;
 
-       prepareOperand(b,l,"@1");
-       prepareResult(bn,b,getTypeIndex("@4",-1,TYPE_int),"@1");
-
-       bi = bat_iterator(b);
-
-       BATaccessBegin(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
-       BATloop(b, p, q) {
-               ptr h = BUNhead(bi,p);
-               x= (@3 *) BUNtail(bi,p);
-               if (x== 0 || *x == @3_nil) {
-                       y = (@4)@4_nil;
-                       bn->T->nonil = 0;
-               } else 
-                       @2(yp,x);
-               bunfastins(bn, h, yp);
-       }
-       BATaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
-       bn->H->nonil = b->H->nonil;
-       finalizeResult(ret,bn,b);
-       return MAL_SUCCEED;
-bunins_failed:
-       BATaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
-       BBPreleaseref(b->batCacheid);
-       BBPreleaseref(bn->batCacheid);
-       throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation");
+#define BATwalk(X1,X2,X3,X4)\
+str CLRbat##X1(int *ret, int *l)\
+{   \
+       BATiter bi;\
+       BAT *bn, *b;\
+       BUN p,q;\
+       X3 *x;\
+       X4 y, *yp = &y;\
+\
+       prepareOperand(b,l,"##X1");\
+       prepareResult(bn,b,getTypeIndex("##X4",-1,TYPE_int),"##X1");\
+\
+       bi = bat_iterator(b);\
+\
+       BATaccessBegin(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);\
+       BATloop(b, p, q) {\
+               ptr h = BUNhead(bi,p);\
+               x= (X3 *) BUNtail(bi,p);\
+               if (x== 0 || *x == X3##_nil) {\
+                       y = (X4)X4##_nil;\
+                       bn->T->nonil = 0;\
+               } else \
+                       X2(yp,x);\
+               bunfastins(bn, h, yp);\
+       }\
+       BATaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);\
+       bn->H->nonil = b->H->nonil;\
+       finalizeResult(ret,bn,b);\
+       return MAL_SUCCEED;\
+bunins_failed:\
+       BATaccessEnd(b,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);\
+       BBPreleaseref(b->batCacheid);\
+       BBPreleaseref(bn->batCacheid);\
+       throw(MAL, "batstr.==", OPERATION_FAILED " During bulk operation");\
 }
 
-@
-@c
-@:BATwalk(Color,CLRcolor,str,color)@
-@:BATwalk(Str,CLRstr,color,str)@
+BATwalk(Color,CLRcolor,str,color)
+BATwalk(Str,CLRstr,color,str)
 
-@:BATwalk(Red,CLRred,color,int)@
-@:BATwalk(Green,CLRgreen,color,int)@
-@:BATwalk(Blue,CLRblue,color,int)@
+BATwalk(Red,CLRred,color,int)
+BATwalk(Green,CLRgreen,color,int)
+BATwalk(Blue,CLRblue,color,int)
 
-@:BATwalk(Hue,CLRhue,color,flt)@
-@:BATwalk(Saturation,CLRsaturation,color,flt)@
-@:BATwalk(Value,CLRvalue,color,flt)@
+BATwalk(Hue,CLRhue,color,flt)
+BATwalk(Saturation,CLRsaturation,color,flt)
+BATwalk(Value,CLRvalue,color,flt)
 
-@:BATwalk(HueInt,CLRhueInt,color,int)@
-@:BATwalk(SaturationInt,CLRsaturationInt,color,int)@
-@:BATwalk(ValueInt,CLRvalueInt,color,int)@
+BATwalk(HueInt,CLRhueInt,color,int)
+BATwalk(SaturationInt,CLRsaturationInt,color,int)
+BATwalk(ValueInt,CLRvalueInt,color,int)
 
-@:BATwalk(Luminance,CLRluminance,color,int)@
-@:BATwalk(Cr,CLRcr,color,int)@
-@:BATwalk(Cb,CLRcb,color,int)@
+BATwalk(Luminance,CLRluminance,color,int)
+BATwalk(Cr,CLRcr,color,int)
+BATwalk(Cb,CLRcb,color,int)
 
-/*
- * @-
- * A few triple versions.
- */
-@= BATwalk3
-batcolor_export str CLRbat@1(int *ret, int *l, int *bid2, int *bid3);
-str CLRbat@1(int *ret, int *l, int *bid2, int *bid3)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to