Changeset: e791787267c5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e791787267c5
Added Files:
        monetdb5/modules/mal/calc_arrays.c
        monetdb5/modules/mal/calc_arrays.h
        monetdb5/modules/mal/calc_arrays.mal
Branch: arrays
Log Message:

some calc functions for arrays (mostly the mal definitions)


diffs (truncated from 971 to 300 lines):

diff --git a/monetdb5/modules/mal/calc_arrays.c 
b/monetdb5/modules/mal/calc_arrays.c
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/calc_arrays.c
@@ -0,0 +1,19 @@
+#include "monetdb_config.h"
+#include "gdk.h"
+#include "math.h"
+#include "mal_exception.h"
+#include "mal_interpreter.h"
+
+
+
+#include "calc_arrays.h"
+
+str CMDconvertDimension_lng(ptr *dimConverted, ptr* dims_out, const ptr *dim, 
const ptr* dims) {
+       (void)*dimConverted;
+       (void)*dim;
+       (void)*dims_out;
+       (void)*dims;
+
+       return MAL_SUCCEED;
+}
+
diff --git a/monetdb5/modules/mal/calc_arrays.h 
b/monetdb5/modules/mal/calc_arrays.h
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/calc_arrays.h
@@ -0,0 +1,14 @@
+#ifndef _CALC_ARRAYS_H
+#define _CALC_ARRAYS_H
+
+#ifdef WIN32
+#define batcalc_export extern __declspec(dllexport)
+#else
+#define batcalc_export extern
+#endif
+
+
+str CMDconvertDimension_lng(ptr *dimConverted, ptr *dims_out, const ptr *dim, 
const ptr *dims);
+
+
+#endif /*_CALC_ARRAYS_H*/
diff --git a/monetdb5/modules/mal/calc_arrays.mal 
b/monetdb5/modules/mal/calc_arrays.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/calc_arrays.mal
@@ -0,0 +1,923 @@
+module calc;
+
+function not(dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionsNOT
+address CMDdimensionsNOT
+comment "Bitwise not of the dimension values";
+
+function sign(dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSIGN
+address CMDdimensionSIGN
+comment "Unary sign (-1,0,1) of the dimension values";
+
+function abs(dim:ptr, dims:ptr) (:ptr, :ptr)
+address CMDdimensionABS
+comment "Unary absolute value of dimension values";
+
+funcion -(dim:ptr, dims:ptr) (:ptr, :ptr)
+address CMDdimensionNEG
+comment "Unary negation of the dimension values";
+
+function ++(dim:ptr, dims:ptr) (:ptr, :ptr)
+address CMDdimensionINCRsignal
+comment "Unary dimension values + 1";
+
+function --(dim:ptr, dims:ptr) (:ptr, :ptr)
+address CMDdimensionDECRsignal
+comment "Unary dimension values - 1";
+
+#+
+pattern +(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension values, guarantee no overflow by returning 
larger type";
+pattern +(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension vallues, guarantee no overflow by returning 
larger type";
+pattern +(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension values, guarantee no overflow by returning 
larger type";
+pattern +(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension values, guarantee no overflow by returning 
larger type";
+pattern +(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension values, guarantee no overflow by returning 
larger type";
+pattern +(v:flt, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionADDsignal
+comment "Return V + dimension values, guarantee no overflow by returning 
larger type";
+
+#-
+pattern -(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+pattern -(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+pattern -(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+pattern -(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+pattern -(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+pattern -(v:flt, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionSUBsignal
+comment "Return V - dimension values, guarantee no overflow by returning 
larger type";
+
+#*
+pattern *(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+pattern *(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+pattern *(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+pattern *(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+pattern *(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+pattern *(v:flt, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionMULsignal
+comment "Return V * dimension values, guarantee no overflow by returning 
larger type";
+
+#/
+pattern /(dim:ptr, dims:ptr, v:bte) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+pattern /(dim:ptr, dims:ptr, v:sht) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+pattern /(dim:ptr, dims:ptr, v:int) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+pattern /(dim:ptr, dims:ptr, v:wrd) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+pattern /(dim:ptr, dims:ptr, v:lng) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+pattern /(dim:ptr, dims:ptr, v:flt) (:ptr, :ptr) address CMDdimensionDIVsignal
+comment "Return dimension values / V, signal error on overflow";
+
+#%
+pattern %(dim:ptr, dims:ptr, v:bte) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+pattern %(dim:ptr, dims:ptr, v:sht) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+pattern %(dim:ptr, dims:ptr, v:int) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+pattern %(dim:ptr, dims:ptr, v:wrd) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+pattern %(dim:ptr, dims:ptr, v:lng) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+pattern %(dim:ptr, dims:ptr, v:flt) (:ptr, :ptr) address CMDdimensionMODsignal
+comment "Return dimension values % V, signal error on divide by zero";
+
+#and
+pattern and(v:bit, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+pattern and(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+pattern and(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+pattern and(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+pattern and(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+pattern and(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionAND
+comment "Return V AND dimension values";
+
+#or
+pattern or(v:bit, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+pattern or(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+pattern or(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+pattern or(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+pattern or(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+pattern or(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionOR
+comment "Return V OR dimension values";
+
+#xor
+pattern xor(v:bit, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+pattern xor(v:bte, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+pattern xor(v:sht, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+pattern xor(v:int, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+pattern xor(v:wrd, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+pattern xor(v:lng, dim:ptr, dims:ptr) (:ptr, :ptr) address CMDdimensionXOR
+comment "Return V XOR dimension values";
+
+#<<
+pattern <<(dim:ptr, dims:ptr, v:bit)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+pattern <<(dim:ptr, dims:ptr, v:bte)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+pattern <<(dim:ptr, dims:ptr, v:sht)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+pattern <<(dim:ptr, dims:ptr, v:int)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+pattern <<(dim:ptr, dims:ptr, v:wrd)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+pattern <<(dim:ptr, dims:ptr, v:lng)  (:ptr, :ptr) address CMDdimensionLSH
+comment "Return dimension values << V";
+
+#>>
+pattern >>(dim:ptr, dims:ptr, v:bit)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+pattern >>(dim:ptr, dims:ptr, v:bte)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+pattern >>(dim:ptr, dims:ptr, v:sht)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+pattern >>(dim:ptr, dims:ptr, v:int)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+pattern >>(dim:ptr, dims:ptr, v:wrd)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+pattern >>(dim:ptr, dims:ptr, v:lng)  (:ptr, :ptr) address CMDdimensionRSH
+comment "Return dimension values >> V";
+
+#<
+pattern <(v:bit, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:oid, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:bte, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:sht, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:int, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:wrd, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:lng, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:flt, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+pattern <(v:dbl, dim:ptr, dims:ptr) :bit address CMDdimensionLT
+comment "Return true if V < than all values in dimension";
+
+#<=
+pattern <=(v:bit, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:oid, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:bte, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:sht, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:int, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:wrd, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:lng, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:flt, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+pattern <=(v:dbl, dim:ptr, dims:ptr) :bit address CMDdimensionLE
+comment "Return true if V <= than all values in dimension";
+
+#>
+pattern >(v:bit, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:oid, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:bte, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:sht, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:int, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:wrd, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:lng, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:flt, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+pattern >(v:dbl, dim:ptr, dims:ptr) :bit address CMDdimensionGT
+comment "Return true if V > than all values in dimension";
+
+#>=
+pattern >=(v:bit, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:oid, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:bte, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:sht, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:int, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:wrd, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:lng, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:flt, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+pattern >=(v:dbl, dim:ptr, dims:ptr) :bit address CMDdimensionGE
+comment "Return true if V >= than all values in dimension";
+
+#== Do I need it?
+
+#!=
+pattern !=(v:bit, dim:ptr, dims:ptr) :bit address CMDdimensionNE
+comment "Return true if V != than all values in dimension";
+pattern !=(v:oid, dim:ptr, dims:ptr) :bit address CMDdimensionNE
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to