Changeset: 7802578075b4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7802578075b4
Added Files:
        sql/backends/monet5/sql_hge.mx
Modified Files:
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql.mx
Branch: int128
Log Message:

extract code for sql_hge.mal from sql.mx to sql_hge.mx to fix `make dist`


diffs (truncated from 401 to 300 lines):

diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -99,13 +99,20 @@ headers_mal = {
        SOURCES = sql.mx
 }
 
+headers_mal_hge = {
+       COND = HAVE_HGE
+       HEADERS = mal
+       DIR = libdir/monetdb5
+       SOURCES = sql_hge.mx
+}
+
 headers_autoload = {
        HEADERS = mal
        DIR = libdir/monetdb5/autoload
        SOURCES = 40_sql.mal
 }
 
-headers_hge = {
+headers_autoload_hge = {
        COND = HAVE_HGE
        HEADERS = mal
        DIR = libdir/monetdb5/autoload
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -33,14 +33,6 @@ All Rights Reserved.
 module batsql;
 module sql;
 
-@f sql_hge
-@mal
-
-module sql;
-
-@f sql
-@mal
-
 pattern start():void 
 address SQLsession
 comment "Switch to processing SQL statements";
@@ -145,16 +137,6 @@ pattern assert(b:lng,msg:str):void
 address SQLassertLng
 comment "Generate an exception when b!=0";
 
-@f sql_hge
-@mal
-
-pattern assert(b:hge,msg:str):void
-address SQLassertHge
-comment "Generate an exception when b!=0";
-
-@f sql
-@mal
-
 # @- The SQL multi-version catalog
 # This module also contains the definitions for managing an SQL database 
schema in
 # version 5.  It is an adaptation of the original V4.3 code base.
@@ -657,15 +639,6 @@ command batcalc.hash( b:bat[:oid,:int] )
 pattern calc.hash( v:lng ) :wrd address MKEYhash; 
 command batcalc.hash( b:bat[:oid,:lng] ) :bat[:oid,:wrd] address MKEYbathash;
 
-@f sql_hge
-@mal
-
-pattern calc.hash( v:hge ) :wrd address MKEYhash; 
-command batcalc.hash( b:bat[:oid,:hge] ) :bat[:oid,:wrd] address MKEYbathash;
-
-@f sql
-@mal
-
 pattern calc.hash( v:oid ) :wrd address MKEYhash; 
 command batcalc.hash( b:bat[:oid,:oid] ) :bat[:oid,:wrd] address MKEYbathash;
 pattern calc.hash( v:wrd ) :wrd address MKEYhash; 
@@ -714,14 +687,6 @@ comment "cast @1 decimal to a second_int
 @:mal_round(int)@
 @:mal_round(lng)@
 
-@f sql_hge
-@mal
-
-@:mal_round(hge)@
-
-@f sql
-@mal
-
 @= mal_fround
 command sql.dec_round( v:@1, r:@1 ) :@1 
 address @1_dec_round_wrap
@@ -801,14 +766,6 @@ comment "cast to dec(@1) and check for o
 @:mal_cast(int)@
 @:mal_cast(lng)@
 
-@f sql_hge
-@mal
-
-@:mal_cast(hge)@
-
-@f sql
-@mal
-
 @= mal_casttime
 command calc.@1( v:void ) :@1 
 address nil_2_@1
@@ -918,28 +875,12 @@ comment "cast number to decimal(@1) and 
 @:mal_cast_2dec(wrd,flt)@
 @:mal_cast_2dec(lng,flt)@
 
-@f sql_hge
-@mal
-
-@:mal_cast_2dec(hge,flt)@
-
-@f sql
-@mal
-
 @:mal_cast_2dec(bte,dbl)@
 @:mal_cast_2dec(sht,dbl)@
 @:mal_cast_2dec(int,dbl)@
 @:mal_cast_2dec(wrd,dbl)@
 @:mal_cast_2dec(lng,dbl)@
 
-@f sql_hge
-@mal
-
-@:mal_cast_2dec(hge,dbl)@
-
-@f sql
-@mal
-
 @= mal_cast_dec2
 command calc.@1( s1:int, v:@2) :@1 
 address @2_dec2_@1
@@ -997,25 +938,6 @@ comment "cast decimal(@2) to decimal(@1)
 @:mal_cast2(dbl,wrd)@
 @:mal_cast2(dbl,lng)@
 
-@f sql_hge
-@mal
-
-@:mal_cast2(bte,hge)@
-@:mal_cast2(sht,hge)@
-@:mal_cast2(int,hge)@
-@:mal_cast2(lng,hge)@
-@:mal_cast2(hge,bte)@
-@:mal_cast2(hge,sht)@
-@:mal_cast2(hge,int)@
-@:mal_cast2(hge,wrd)@
-@:mal_cast2(hge,lng)@
-@:mal_cast2(hge,hge)@
-@:mal_cast2(flt,hge)@
-@:mal_cast2(dbl,hge)@
-
-@f sql
-@mal
-
 command calc.month_interval( v:str, ek:int, sk:int ) :int
 address month_interval_str
 comment "cast str to a month_interval and check for overflow";
@@ -8287,14 +8209,6 @@ end aggr.corr;
 @:analytic(wrd)@
 @:analytic(lng)@
 
-@f sql_hge
-@mal
-
-@:analytic(hge)@
-
-@f sql
-@mal
-
 @:analytic(flt)@
 @:analytic(dbl)@
 
diff --git a/sql/backends/monet5/sql_hge.mx b/sql/backends/monet5/sql_hge.mx
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/sql_hge.mx
@@ -0,0 +1,220 @@
+@/
+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-2013 MonetDB B.V.
+All Rights Reserved.
+@
+
+@f sql_hge
+
+@c
+/*
+ * @t SQL Scenario implementation
+ * @a M Kersten
+ * @v 0
+ * @* SQL support implementation
+ * This module contains the wrappers around the SQL
+ * multi-version-catalog and support routines copied
+ * from the Version 4 code base.
+ */
+@mal
+module batsql;
+module sql;
+
+pattern assert(b:hge,msg:str):void
+address SQLassertHge
+comment "Generate an exception when b!=0";
+
+pattern calc.hash( v:hge ) :wrd address MKEYhash; 
+command batcalc.hash( b:bat[:oid,:hge] ) :bat[:oid,:wrd] address MKEYbathash;
+
+# @- SQL functions
+# The SQL functions are all recognized by their module name.
+# For some we need to provide a new implementation, others
+# merely require a different address binding.
+#
+# The aggregate operations work on doubles by default.
+# This calls for casting values around in the process.
+@= mal_round
+command sql.dec_round( v:@1, r:@1 ) :@1 
+address @1_dec_round_wrap
+comment "round off the value v to nearests multiple of r";
+
+command batsql.dec_round( v:bat[:oid,:@1], r:@1 ) :bat[:oid,:@1] 
+address @1_bat_dec_round_wrap
+comment "round off the value v to nearests multiple of r";
+
+command sql.round( v:@1, d:int, s:int, r:bte) :@1
+address @1_round_wrap
+comment "round off the decimal v(d,s) to r digits behind the dot (if r < 0, 
before the dot)";
+
+command sql.round( v:bat[:oid,:@1], d:int, s:int, r:bte) :bat[:oid,:@1]
+address @1_bat_round_wrap
+comment "round off the decimal v(d,s) to r digits behind the dot (if r < 0, 
before the dot)";
+
+command calc.second_interval( sc:int, v:@1, ek:int, sk:int ) :lng
+address @1_dec2second_interval
+comment "cast @1 decimal to a second_interval";
+
+@
+@mal
+@:mal_round(hge)@
+
+@= mal_cast
+command calc.@1( v:void, digits:int ) :@1 
+address nil_2num_@1
+comment "cast to @1 and check for overflow";
+
+command calc.@1( v:void, digits:int, scale:int ) :@1 
+address nil_2dec_@1
+comment "cast to dec(@1) and check for overflow";
+
+command batcalc.@1( v:bat[:oid,:void], digits:int ) :bat[:oid,:@1] 
+address batnil_2num_@1
+comment "cast to @1 and check for overflow";
+command batcalc.@1( v:bat[:oid,:void], digits:int, scale:int ) :bat[:oid,:@1] 
+address batnil_2dec_@1
+comment "cast to dec(@1) and check for overflow";
+
+command calc.@1( v:str, digits:int ) :@1 
+address str_2num_@1
+comment "cast to @1 and check for overflow";
+command calc.@1( v:str, digits:int, scale:int ) :@1 
+address str_2dec_@1
+comment "cast to dec(@1) and check for overflow";
+
+command batcalc.@1( v:bat[:oid,:str], digits:int ) :bat[:oid,:@1] 
+address batstr_2num_@1
+comment "cast to @1 and check for overflow";
+command batcalc.@1( v:bat[:oid,:str], digits:int, scale:int ) :bat[:oid,:@1] 
+address batstr_2dec_@1
+comment "cast to dec(@1) and check for overflow";
+@
+@mal
+# @-
+# address CALCstr2@1
+# command calc.str( v:@1 ) :str
+# address CALC@12str
+# comment "Cast @1 to str";
+@:mal_cast(hge)@
+
+@= mal_cast_2dec
+# command calc.@1( v:@2) :@1 
+# address @2_2_@1
+# comment "cast @2 to @1";
+command calc.@1( v:@2, digits:int, scale:int ) :@1 
+address @2_num2dec_@1
+comment "cast number to decimal(@1) and check for overflow";
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to