Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/modules/kernel In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28642
Modified Files: algebra.mx bat5.mx mmath.mx Log Message: Move all signatures to the .h section to ease compilation of programs using the interface directly. More files to do.
Index: mmath.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/kernel/mmath.mx,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- mmath.mx 13 Sep 2007 13:45:13 -0000 1.35 +++ mmath.mx 14 Oct 2007 08:41:47 -0000 1.36 @@ -206,16 +206,9 @@ @h #ifndef __MMATH_H__ #define __MMATH_H__ - -#include
- -#endif /* __MMATH_H__ */ - -@+ Implementation Code -@c #include "mal_config.h" - -#include "mmath.h" +#include "mal.h" +#include "mal_exception.h" #include extern double sqrt(double x); @@ -234,29 +227,6 @@ #define mmath_export extern #endif
-#define acos_unary(x, z) *z = acos(*x) -#define asin_unary(x, z) *z = asin(*x) -#define atan_unary(x, z) *z = atan(*x) -#define atan2_binary(x, y, z) *z = atan2(*x,*y) -#define cos_unary(x, z) *z = cos(*x) -#define sin_unary(x, z) *z = sin(*x) -#define tan_unary(x, z) *z = tan(*x) - -#define cosh_unary(x, z) *z = cosh(*x) -#define sinh_unary(x, z) *z = sinh(*x) -#define tanh_unary(x, z) *z = tanh(*x) - -#define exp_unary(x, z) *z = exp(*x) -#define log_unary(x, z) *z = log(*x) -#define log10_unary(x, z) *z = log10(*x) - -#define pow_binary(x, y, z) *z = pow(*x,*y) -#define sqrt_unary(x, z) *z = sqrt(*x) - -#define ceil_unary(x, z) *z = ((-1.0<*x)&&(*x<0.0))?0.0:ceil(*x) -#define fabs_unary(x, z) *z = fabs(*x) -#define floor_unary(x, z) *z = floor(*x) -#define fmod_binary(x, y, z) *z = fmod(*x,*y)
#ifdef _MSC_VER #include
@@ -306,11 +276,78 @@ #endif /* HAVE_ISINF */ #endif /* HAVE_FPCLASSIFY */ -#include "mal.h" -#include "mal_exception.h" -mmath_export str math_unary_FINITE(bit *res, dbl *a); -mmath_export str math_unary_ISNAN(bit *res, dbl *a); -mmath_export str math_unary_ISINF(int *res, dbl *a); +#define acos_unary(x, z) *z = acos(*x) +#define asin_unary(x, z) *z = asin(*x) +#define atan_unary(x, z) *z = atan(*x) +#define atan2_binary(x, y, z) *z = atan2(*x,*y) +#define cos_unary(x, z) *z = cos(*x) +#define sin_unary(x, z) *z = sin(*x) +#define tan_unary(x, z) *z = tan(*x) + +#define cosh_unary(x, z) *z = cosh(*x) +#define sinh_unary(x, z) *z = sinh(*x) +#define tanh_unary(x, z) *z = tanh(*x) + +#define exp_unary(x, z) *z = exp(*x) +#define log_unary(x, z) *z = log(*x) +#define log10_unary(x, z) *z = log10(*x) + +#define pow_binary(x, y, z) *z = pow(*x,*y) +#define sqrt_unary(x, z) *z = sqrt(*x) + +#define ceil_unary(x, z) *z = ((-1.0<*x)&&(*x<0.0))?0.0:ceil(*x) +#define fabs_unary(x, z) *z = fabs(*x) +#define floor_unary(x, z) *z = floor(*x) +#define fmod_binary(x, y, z) *z = fmod(*x,*y) + +@= unopbaseM5_export +mmath_export str MATHunary@1@3(@3 *res , @3 *a ); +@= unopM5_export + @:unopbaseM5_export(@1,@2,dbl)@ + @:unopbaseM5_export(@1,@2,flt)@ +@= binopbaseM5_export +mmath_export str MATHbinary@1@3(@3 *res, @3 *a, @3 *b ); +@= binopM5_export + @:binopbaseM5_export(@1,@2,dbl)@ + @:binopbaseM5_export(@1,@2,flt)@ + +@h +@:unopM5_export(_ACOS,acos)@ +@:unopM5_export(_ASIN,asin)@ +@:unopM5_export(_ATAN,atan)@ +@:binopM5_export(_ATAN2,atan2)@ +@:unopM5_export(_COS,cos)@ +@:unopM5_export(_SIN,sin)@ +@:unopM5_export(_TAN,tan)@ + +@:unopM5_export(_COSH,cosh)@ +@:unopM5_export(_SINH,sinh)@ +@:unopM5_export(_TANH,tanh)@ + +@:unopM5_export(_EXP,exp)@ +@:unopM5_export(_LOG,log)@ +@:unopM5_export(_LOG10,log10)@ + +@:binopM5_export(_POW,pow)@ +@:unopM5_export(_SQRT,sqrt)@ + +@:unopM5_export(_CEIL,ceil)@ +@:unopbaseM5_export(_FABS,fabs,dbl)@ +@:unopM5_export(_FLOOR,floor)@ +@:binopM5_export(_FMOD,fmod)@ + + +mmath_export str MATHunary_ISNAN(bit *res, dbl *a); +mmath_export str MATHunary_ISINF(int *res, dbl *a); +mmath_export str MATHunary_FINITE(bit *res, dbl *a); +mmath_export str MATHrandint(int *res); +mmath_export str MATHsrandint(int *seed); +mmath_export str MATHpi(dbl *pi); +#endif /* __MMATH_H__ */ + +@+ Implementation Code +@c +#include "mmath.h"
@:unop(_ACOS,acos)@ @:unop(_ASIN,asin)@ @@ -375,7 +412,6 @@ } return MAL_SUCCEED; } -@
@c str @@ -453,7 +489,6 @@ Wrapping around the M4 code base @- @= unopbaseM5 -mmath_export str MATHunary@1@3(@3 *res , @3 *a ); str MATHunary@1@3(@3 *res , @3 *a ) { #ifdef DEBUG printf( "MATHunary@1@3\n"); @@ -476,7 +511,6 @@ @:unopbaseM5(@1,@2,flt)@
@= binopbaseM5 -mmath_export str MATHbinary@1@3(@3 *res, @3 *a, @3 *b ); str MATHbinary@1@3(@3 *res, @3 *a, @3 *b ) { #ifdef DEBUG printf( "MATHbinary@1\n"); @@ -495,7 +529,6 @@ @:binopbaseM5(@1,@2,flt)@ @ @= roundM5 -mmath_export str MATHbinary_ROUND@1(@1 *res, @1 *x, int *y); str MATHbinary_ROUND@1(@1 *res, @1 *x, int *y) { If you remove the export, you will break the compilation on windows.
Maybe the following Mserver5 start can tell you which functions should be exported, but unfortunately they aren't. ;) E:\MonetDB\Current\sql\NT>RunMserver5.bat
# MonetDB server v5.3.0, based on kernel v1.21.0 # Serving database 'demo' # Compiled for i686-pc-win32/32bit with 32bit OIDs dynamically linked # Copyright (c) 1993-2007 CWI, all rights reserved # Visit http://monetdb.cwi.nl/ for further information #warning: please don't forget to set your vault key! #(see E:\MonetDB\Current\MonetDB5\NT\etc\monetdb5.conf) !MALException:MAL.getAddress:address of 'mmath.MATHbinary_ROUNDflt' not found !MALException:MAL.getAddress:address of 'mmath.MATHbinary_ROUNDdbl' not found !MALException:MAL.getAddress:address of 'mmath.math_unary_ISNAN' not found !MALException:MAL.getAddress:address of 'mmath.math_unary_ISINF' not found !MALException:MAL.getAddress:address of 'mmath.math_unary_FINITE' not found !MALException:MAL.getAddress:address of 'algebra.ALGselectNotNil' not found !MALException:MAL.getAddress:address of 'algebra.ALGuhashsplit' not found !MALException:MAL.getAddress:address of 'group.GRPmin' not found !MALException:MAL.getAddress:address of 'group.GRPmax' not found # Listening for connection requests on mapi:monetdb://127.0.0.1:50000/
\q
Regards, Romulo