Changeset: b3603e2152b4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3603e2152b4
Modified Files:
        monetdb5/modules/kernel/Makefile.ag
        monetdb5/modules/kernel/colcolor.c.mx
        monetdb5/modules/kernel/colcolor.h.mx
        monetdb5/modules/kernel/colcolor.mal
        monetdb5/modules/kernel/colcolor.mx
Branch: headless
Log Message:

Another file converted


diffs (truncated from 645 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
@@ -48,7 +48,9 @@
                colcast.mal.mx \
                colcast.h.mx \
                colcast.c.mx \
-#              colcolor.mx \
+               colcolor.mal.mx \
+               colcolor.h.mx \
+               colcolor.c.mx \
 #              colifthen.mx \
 #              colmmath.mx \
 #              colmtime.mx \
@@ -70,7 +72,7 @@
        DIR = libdir/monetdb5
        SOURCES = calc.mx column.mx algebra.mx status.mal unix.mal \
                mmath.mx lock.mal sema.mal alarm.mx colstr.mx colmtime.mx \
-               colcolor.mx colifthen.mx colcast.mal.mx colcalc.mal.mx 
colmmath.mx \
+               colcolor.mal.mx colifthen.mx colcast.mal.mx colcalc.mal.mx 
colmmath.mx \
                group.mx aggr.mx array.mx \
                mx logger.mal microbenchmark.mx
 }
diff --git a/monetdb5/modules/kernel/colcolor.c.mx 
b/monetdb5/modules/kernel/colcolor.c.mx
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/colcolor.c.mx
@@ -0,0 +1,156 @@
+/*
+ * 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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+ * 
+ * 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-2011 MonetDB B.V.
+ * All Rights Reserved.
+*/
+
+@f colcolor
+/* 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. 
+ * 
+*/
+@c
+#include "monetdb_config.h"
+#include "colcolor.h"
+
+@= COLwalk
+str CLRcol_@1_@2(int *ret, int *l)
+{   
+       COL *bn, *b;
+       oid o;
+       @4 *xbase;
+       @5 *nbase, y, *yp = &y;
+
+       if( (b= COLdescriptor(*l)) == NULL ) 
+               throw(MAL, "batstr.@2", RUNTIME_OBJECT_MISSING);
+       bn= COLnew(getTypeIndex("@5",-1,TYPE_int), COLcount(b));
+       if( bn == NULL){
+               CBPreleaseref(b);
+               throw(MAL, "colstr.@5", MAL_MALLOC_FAIL); 
+       }
+       bn->sorted=0; 
+
+       xbase= (@4*) getCOLbase(b);
+       nbase= (@5*) getCOLbase(bn);
+       COLaccessBegin(b,USE_HEAP,MMAP_SEQUENTIAL);
+       COLforloop(b, o) {
+               if (xbase[o] == @4_nil) {
+                       nbase[o] = (@5) @5_nil;
+                       bn->nonil = 0;
+               } else {
+                       @3(yp, &xbase[o]);
+                       nbase[o] = y;
+               }
+       }
+       COLaccessEnd(b,USE_HEAP,MMAP_SEQUENTIAL);
+       COLsetreadonly(bn); 
+       bn->nonil = b->nonil;
+       *(ret) = CBPkeepref(bn);
+       CBPreleaseref(b);
+       return MAL_SUCCEED;
+}
+
+@c
+@:COLwalk(str,color,CLRcolor,str,color)@
+@:COLwalk(color,str,CLRstr,color,str)@
+
+@:COLwalk(color,red,CLRred,color,int)@
+@:COLwalk(color,green,CLRgreen,color,int)@
+@:COLwalk(color,blue,CLRblue,color,int)@
+
+@:COLwalk(color,hueFlt,CLRhue,color,flt)@
+@:COLwalk(color,saturationFlt,CLRsaturation,color,flt)@
+@:COLwalk(color,valueFlt,CLRvalue,color,flt)@
+
+/*
+@:COLwalk(color,hue,CLRhueInt,color,int)@
+@:COLwalk(color,saturation,CLRsaturationInt,color,int)@
+@:COLwalk(color,valueInt,CLRvalue,color,int)@
+*/
+
+@:COLwalk(color,luminance,CLRluminance,color,int)@
+@:COLwalk(color,cr,CLRcr,color,int)@
+@:COLwalk(color,cb,CLRcb,color,int)@
+
+@-
+A few triple versions.
+
+@= COLwalk3
+str CLRcol@1(int *ret, int *bid1, int *bid2, int *bid3)
+{   
+       COL *bn, *b1, *b2,*b3;
+       oid o;
+       @3 *x1, *x2, *x3;
+       @4 *nbase, y, *yp = &y;
+
+       if( (b1= COLdescriptor(*bid1)) == NULL ) 
+               throw(MAL, "batstr.@1", RUNTIME_OBJECT_MISSING);
+       b2= COLdescriptor(*bid2);
+       if(b2== NULL) {
+               CBPreleaseref(b1);
+               throw(MAL, "batcolor.@1",RUNTIME_OBJECT_MISSING);
+       }
+       b3= COLdescriptor(*bid3);
+       if(b3== NULL) {
+               CBPreleaseref(b1);
+               CBPreleaseref(b2);
+               throw(MAL, "batcolor.@1",RUNTIME_OBJECT_MISSING);
+       }
+       bn= COLnew(getTypeIndex("@5",-1,TYPE_int), COLcount(b1));
+       if( bn == NULL){
+               CBPreleaseref(b1);
+               CBPreleaseref(b2);
+               CBPreleaseref(b3);
+               throw(MAL, "colstr.@5", MAL_MALLOC_FAIL); 
+       }
+       bn->sorted=0; 
+
+       x1= (@3 *) getCOLbase(b1);
+       x2= (@3 *) getCOLbase(b2);
+       x3= (@3 *) getCOLbase(b3);
+       nbase = (@4*) getCOLbase(bn);
+
+       COLaccessBegin(b1,USE_HEAP,MMAP_SEQUENTIAL);
+       COLaccessBegin(b2,USE_HEAP,MMAP_SEQUENTIAL);
+       COLaccessBegin(b3,USE_HEAP,MMAP_SEQUENTIAL);
+       COLforloop(b1, o) {
+               if (x1[o] == @3_nil ||
+                   x2[o] == @3_nil ||
+                   x3[o] == @3_nil) {
+                       nbase[o] = @4_nil;
+                       bn->nonil = 0;
+               } else  {
+                       @2(yp,x1,x2,x3);
+                       nbase[o] = *yp;
+               }
+       }
+       COLaccessEnd(b1,USE_HEAP,MMAP_SEQUENTIAL);
+       COLaccessEnd(b2,USE_HEAP,MMAP_SEQUENTIAL);
+       COLaccessEnd(b3,USE_HEAP,MMAP_SEQUENTIAL);
+       bn->nonil = b1->nonil;
+       *ret = CBPkeepref(bn);
+       CBPreleaseref(b1);
+       CBPreleaseref(b2);
+       CBPreleaseref(b3);
+       return MAL_SUCCEED;
+}
+@c
+@:COLwalk3(Hsv,CLRhsv,flt,color)@
+@:COLwalk3(Rgb,CLRrgb,int,color)@
+@:COLwalk3(ycc,CLRycc,int,color)@
diff --git a/monetdb5/modules/kernel/colcolor.h.mx 
b/monetdb5/modules/kernel/colcolor.h.mx
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/colcolor.h.mx
@@ -0,0 +1,76 @@
+/*
+ * 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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+ * 
+ * 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-2011 MonetDB B.V.
+ * All Rights Reserved.
+*/
+
+@f colcolor
+/* M.L. Kersten
+ * Color multiplexes
+*/
+@h
+#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(LICOLOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5)
+#define colcolor_export extern __declspec(dllimport)
+#else
+#define colcolor_export extern __declspec(dllexport)
+#endif
+#else
+#define colcolor_export extern
+#endif
+
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+#ifdef HAVE_ICONV_H
+#include <iconv.h>
+#endif
+
+@= COLwalk
+colcolor_export str CLRcol_@1_@2(int *ret, int *l);
+@h
+@:COLwalk(str,color)@
+@:COLwalk(color,str)@
+
+@:COLwalk(color,red)@
+@:COLwalk(color,green)@
+@:COLwalk(color,blue)@
+
+@:COLwalk(color,hueFlt)@
+@:COLwalk(color,saturatonFlt)@
+@:COLwalk(color,valueFlt)@
+
+@:COLwalk(color,hue)@
+@:COLwalk(color,saturaton)@
+@:COLwalk(color,value)@
+
+@:COLwalk(color,luminance)@
+@:COLwalk(color,cr,CLRcr)@
+@:COLwalk(color,cb,CLRcb)@
+
+@= COLwalk3
+colcolor_export str CLRcol_@1(int *ret, int *l, int *bid2, int *bid3);
+@h
+@:COLwalk3(Hsv)@
+@:COLwalk3(Rgb)@
+@:COLwalk3(ycc)@
diff --git a/monetdb5/modules/kernel/colcolor.mal 
b/monetdb5/modules/kernel/colcolor.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/colcolor.mal
@@ -0,0 +1,94 @@
+/*
+ * 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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+ * 
+ * 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-2011 MonetDB B.V.
+ * All Rights Reserved.
+*/
+
+/* 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. 
+ * 
+*/
+module colcalc;
+command str(b:col[:color]):col[:str]
+address CLRcolStr
+comment "Identity mapping for string bats";
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to