aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/math')
-rw-r--r--src/modules/math/.svnignore9
-rw-r--r--src/modules/math/Makefile.am18
-rw-r--r--src/modules/math/kvimath.dsp107
-rw-r--r--src/modules/math/kvimath.dsw29
-rw-r--r--src/modules/math/libkvimath.cpp485
-rw-r--r--src/modules/math/math.vcproj142
-rw-r--r--src/modules/math/math_vc05.vcproj230
7 files changed, 1020 insertions, 0 deletions
diff --git a/src/modules/math/.svnignore b/src/modules/math/.svnignore
new file mode 100644
index 000000000..05942bc9e
--- /dev/null
+++ b/src/modules/math/.svnignore
@@ -0,0 +1,9 @@
+Makefile.in
+Makefile
+.deps
+*.o
+*.lo
+*.la
+*.moc
+.libs
+moc_editor.cpp
diff --git a/src/modules/math/Makefile.am b/src/modules/math/Makefile.am
new file mode 100644
index 000000000..001bef244
--- /dev/null
+++ b/src/modules/math/Makefile.am
@@ -0,0 +1,18 @@
+###############################################################################
+# KVirc IRC client Makemath - 10.03.2000 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \
+$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\"
+
+pluglib_LTLIBRARIES = libkvimath.la
+
+libkvimath_la_LDFLAGS = -module -avoid-version $(SS_LDFLAGS) $(SS_LIBDIRS)
+
+libkvimath_la_SOURCES = libkvimath.cpp
+libkvimath_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la
+
+# noinst_HEADERS=
+
+%.moc: %.h
+ $(SS_QT_MOC) $< -o $@
diff --git a/src/modules/math/kvimath.dsp b/src/modules/math/kvimath.dsp
new file mode 100644
index 000000000..aa64c23f4
--- /dev/null
+++ b/src/modules/math/kvimath.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="kvimath" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=kvimath - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "kvimath.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "kvimath.mak" CFG="kvimath - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "kvimath - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "kvimath - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "kvimath - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACTION_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "_$(QTDIR)\include" /I "$(QTDIR)\include" /I "..\..\kvilib\tal" /I "..\..\kvilib\system" /I "..\..\kvilib\irc" /I "..\..\kvilib\file" /I "..\..\kvilib\ext" /I "..\..\kvilib\net" /I "..\..\kvilib\core\wstring" /I "..\..\kvilib\core" /I "..\..\kvilib\config" /I "..\..\kvirc\kvs" /I "..\..\kvirc\module" /I "..\..\kvirc\uparser\scripttoolbar" /I "..\..\kvirc\uparser" /I "..\..\kvirc\sparser" /I "..\..\kvirc\kernel" /I "..\..\kvirc\ui" /I "C:\ssl" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACTION_EXPORTS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 imm32.lib wsock32.lib winmm.lib $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"..\..\..\win32build\bin\modules\kvimath.dll" /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Release" /libpath:"..\..\kvirc\Release"
+
+!ELSEIF "$(CFG)" == "kvimath - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACTION_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "_$(QTDIR)\include" /I "$(QTDIR)\include" /I "..\..\kvilib\tal" /I "..\..\kvilib\system" /I "..\..\kvilib\irc" /I "..\..\kvilib\file" /I "..\..\kvilib\ext" /I "..\..\kvilib\net" /I "..\..\kvilib\core\wstring" /I "..\..\kvilib\core" /I "..\..\kvilib\config" /I "..\..\kvirc\kvs" /I "..\..\kvirc\module" /I "..\..\kvirc\uparser\scripttoolbar" /I "..\..\kvirc\uparser" /I "..\..\kvirc\sparser" /I "..\..\kvirc\kernel" /I "..\..\kvirc\ui" /I "C:\ssl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACTION_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 odbc32.lib odbccp32.lib $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\win32build\KviDebug\modules\kvimath.dll" /pdbtype:sept /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Debug" /libpath:"..\..\kvirc\Debug"
+
+!ENDIF
+
+# Begin Target
+
+# Name "kvimath - Win32 Release"
+# Name "kvimath - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\libkvimath.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/src/modules/math/kvimath.dsw b/src/modules/math/kvimath.dsw
new file mode 100644
index 000000000..b809dc5b0
--- /dev/null
+++ b/src/modules/math/kvimath.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "kvimath"=.\kvimath.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/modules/math/libkvimath.cpp b/src/modules/math/libkvimath.cpp
new file mode 100644
index 000000000..829292acb
--- /dev/null
+++ b/src/modules/math/libkvimath.cpp
@@ -0,0 +1,485 @@
+//=============================================================================
+//
+// File : libkvimath.cpp
+// Creation date : Sat Jan 13 14:00:12 2006 GMT by Szymon Stefanek
+//
+// This math is part of the KVirc irc client distribution
+// Copyright (C) 2006 Szymon Stefanek (pragma at kvirc dot net)
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_module.h"
+#include "kvi_string.h"
+
+#include <math.h>
+
+// Workaround for lost isnan and isinf definitions after
+// inclusion of iostream.h on some MacOS X systems
+#ifdef Q_OS_MACX
+ #ifndef isnan
+ extern "C" int isnan (double);
+ #endif
+ #ifndef isinf
+ extern "C" int isinf (double);
+ #endif
+#endif
+
+#define MATH_KVS_1PARAM_FUNCTION(__fncname,__paramname,__mathcallname) \
+static bool __fncname(KviKvsModuleFunctionCall * c) \
+{ \
+ kvs_real_t dReal; \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER(__paramname,KVS_PT_REAL,0,dReal) \
+ KVSM_PARAMETERS_END(c) \
+ c->returnValue()->setReal(__mathcallname(dReal)); \
+ return true; \
+}
+
+#ifdef COMPILE_ON_WINDOWS
+// dobbiamo testare meglio, i risultati.
+static double cbrt(double x)
+{
+ if (x > 0.0)
+ return pow(x, 1.0/3.0);
+ else
+ return -pow(-x, 1.0/3.0);
+}
+static int isinf (double d) {
+ int expon = 0;
+ double val = frexp (d, &expon);
+ if (expon == 1025) {
+ if (val == 0.5) {
+ return 1;
+ } else if (val == -0.5) {
+ return -1;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+}
+static int isnan (double d) {
+ int expon = 0;
+ double val = frexp (d, &expon);
+ if (expon == 1025) {
+ if (val == 0.5) {
+ return 0;
+ } else if (val == -0.5) {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ return 0;
+ }
+}
+#endif
+/*
+ @doc: math.sin
+ @type:
+ function
+ @title:
+ $math.sin
+ @short:
+ Returns the sinus of the specified angle in radiants
+ @syntax:
+ <real> $math.sin(<angle:real>)
+ @description:
+ Returns the sinus of the specified angle in radiants
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_sin,"angle",sin)
+
+/*
+ @doc: math.cos
+ @type:
+ function
+ @title:
+ $math.cos
+ @short:
+ Returns the cosinus of the specified angle in radiants
+ @syntax:
+ <real> $math.cos(<angle:real>)
+ @description:
+ Returns the cosinus of the specified angle in radiants
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_cos,"angle",cos)
+
+/*
+ @doc: math.tan
+ @type:
+ function
+ @title:
+ $math.tan
+ @short:
+ Returns the tangent of the specified angle in radiants
+ @syntax:
+ <real> $math.tan(<angle:real>)
+ @description:
+ Returns the tangent of the specified angle in radiants
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_tan,"angle",tan)
+
+/*
+ @doc: math.asin
+ @type:
+ function
+ @title:
+ $math.asin
+ @short:
+ Returns the angle in radiants that has the specified sinus value.
+ @syntax:
+ <real> $math.asin(<sinus:real>)
+ @description:
+ Returns the angle in radiants that has the specified sinus value.
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_asin,"sinus",asin)
+
+/*
+ @doc: math.acos
+ @type:
+ function
+ @title:
+ $math.acos
+ @short:
+ Returns the angle in radiants that has the specified cosinus value.
+ @syntax:
+ <real> $math.acos(<cosinus:real>)
+ @description:
+ Returns the angle in radiants that has the specified cosinus value.
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_acos,"cosinus",acos)
+
+
+/*
+ @doc: math.atan
+ @type:
+ function
+ @title:
+ $math.atan
+ @short:
+ Returns the angle in radiants that has the specified tangent value.
+ @syntax:
+ <real> $math.atan(<tangent:real>)
+ @description:
+ Returns the angle in radiants that has the specified tangent value.
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_atan,"tangent",atan)
+
+/*
+ @doc: math.sqrt
+ @type:
+ function
+ @title:
+ $math.sqrt
+ @short:
+ Returns the square root of a number
+ @syntax:
+ <real> $math.sqrt(<number:real>)
+ @description:
+ Returns the square root of the specified number
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_sqrt,"number",sqrt)
+
+/*
+ @doc: math.cbrt
+ @type:
+ function
+ @title:
+ $math.cbrt
+ @short:
+ Returns the cube root of a number
+ @syntax:
+ <real> $math.cbrt(<number:real>)
+ @description:
+ Returns the cube root of the specified number
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_cbrt,"number",cbrt)
+
+/*
+ @doc: math.abs
+ @type:
+ function
+ @title:
+ $math.abs
+ @short:
+ Returns the absolute value of a number
+ @syntax:
+ <real> $math.abs(<number:real>)
+ @description:
+ Returns the absolute value of the specified number
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_abs,"number",fabs)
+
+/*
+ @doc: math.floor
+ @type:
+ function
+ @title:
+ $math.floor
+ @short:
+ Rounds down to the nearest integer
+ @syntax:
+ <real> $math.floor(<number:real>)
+ @description:
+ Rounds down number to the nearest integer
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_floor,"number",floor)
+
+/*
+ @doc: math.ceil
+ @type:
+ function
+ @title:
+ $math.ceil
+ @short:
+ Rounds up to the nearest integer
+ @syntax:
+ <real> $math.ceil(<number:real>)
+ @description:
+ Rounds up number to the nearest integer
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_ceil,"number",ceil)
+
+/*
+ @doc: math.exp
+ @type:
+ function
+ @title:
+ $math.exp
+ @short:
+ Returns the exponential of the specified number
+ @syntax:
+ <real> $math.exp(<number:real>)
+ @description:
+ Returns the exponential of the specified number
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_exp,"number",exp)
+
+/*
+ @doc: math.log
+ @type:
+ function
+ @title:
+ $math.log
+ @short:
+ Returns the natural logarithm of the specified number
+ @syntax:
+ <real> $math.log(<number:real>)
+ @description:
+ Returns the natural (base e) logarithm of the specified number
+*/
+
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_log,"number",log)
+
+
+/*
+ @doc: math.log10
+ @type:
+ function
+ @title:
+ $math.log10
+ @short:
+ Returns the base 10 logarithm of the specified number
+ @syntax:
+ <real> $math.log10(<number:real>)
+ @description:
+ Returns the base 10 logarithm of the specified number
+*/
+MATH_KVS_1PARAM_FUNCTION(math_kvs_fnc_log10,"number",log10)
+
+/*
+ @doc: math.isnan
+ @type:
+ function
+ @title:
+ $math.isnan
+ @short:
+ Checks if the value is not a number
+ @syntax:
+ <boolean> $math.isnan(<value:real>)
+ @description:
+ Checks if the specified value is a valid number
+ or NaN (Not a Number). NaN is returned by several
+ math functions when the result would be undefined.
+*/
+static bool math_kvs_fnc_isnan(KviKvsModuleFunctionCall * c)
+{
+ kvs_real_t dReal;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("value",KVS_PT_REAL,0,dReal)
+ KVSM_PARAMETERS_END(c)
+ c->returnValue()->setBoolean(isnan(dReal));
+ return true;
+}
+
+/*
+ @doc: math.isinf
+ @type:
+ function
+ @title:
+ $math.isinf
+ @short:
+ Checks if the value is the infinity
+ @syntax:
+ <boolean> $math.isinf(<value:real>)
+ @description:
+ Checks if the specified value is the infinity.
+*/
+#ifdef COMPILE_ON_WINDOWS
+static bool math_kvs_fnc_isinf(KviKvsModuleFunctionCall * c)
+{
+ kvs_real_t dReal;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("value",KVS_PT_REAL,0,dReal)
+ KVSM_PARAMETERS_END(c)
+ c->returnValue()->setBoolean(sinf(dReal));
+ return true;
+}
+#else
+static bool math_kvs_fnc_isinf(KviKvsModuleFunctionCall * c)
+{
+ kvs_real_t dReal;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("value",KVS_PT_REAL,0,dReal)
+ KVSM_PARAMETERS_END(c)
+ c->returnValue()->setBoolean(isinf(dReal));
+ return true;
+}
+#endif //COMPILE_ON_WINDOWS
+/*
+ @doc: math.pow
+ @type:
+ function
+ @title:
+ $math.pow
+ @short:
+ Returns a to the power of b
+ @syntax:
+ <real> $math.isinf(<a:real>,<b:real>)
+ @description:
+ Returns a to the power of b
+*/
+static bool math_kvs_fnc_pow(KviKvsModuleFunctionCall * c)
+{
+ kvs_real_t dA,dB;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("a",KVS_PT_REAL,0,dA)
+ KVSM_PARAMETER("b",KVS_PT_REAL,0,dB)
+ KVSM_PARAMETERS_END(c)
+ c->returnValue()->setReal(pow(dA,dB));
+ return true;
+}
+
+/*
+ @doc: math.pi
+ @type:
+ function
+ @title:
+ $math.pi
+ @short:
+ Returns the value of pi
+ @syntax:
+ <real> $math.pi()
+ @description:
+ Returns the value of pi
+*/
+#ifdef COMPILE_ON_WINDOWS
+static bool math_kvs_fnc_pi(KviKvsModuleFunctionCall * c)
+{
+ c->returnValue()->setReal(3.141592653589793238462643383279502884197169399375);
+ return true;
+}
+#else
+static bool math_kvs_fnc_pi(KviKvsModuleFunctionCall * c)
+{
+ c->returnValue()->setReal(M_PI);
+ return true;
+}
+#endif
+/*
+ @doc: math.e
+ @type:
+ function
+ @title:
+ $math.e
+ @short:
+ Returns the value of e
+ @syntax:
+ <real> $math.e()
+ @description:
+ Returns the value of the euler constant e
+*/
+
+
+#ifdef COMPILE_ON_WINDOWS
+static bool math_kvs_fnc_e(KviKvsModuleFunctionCall * c)
+{
+ c->returnValue()->setReal(1.56903485);
+ return true;
+}
+#else
+static bool math_kvs_fnc_e(KviKvsModuleFunctionCall * c)
+{
+ c->returnValue()->setReal(M_E);
+ return true;
+}
+#endif
+static bool math_module_init(KviModule * m)
+{
+
+ KVSM_REGISTER_FUNCTION(m,"sin",math_kvs_fnc_sin);
+ KVSM_REGISTER_FUNCTION(m,"cos",math_kvs_fnc_cos);
+ KVSM_REGISTER_FUNCTION(m,"tan",math_kvs_fnc_tan);
+ KVSM_REGISTER_FUNCTION(m,"asin",math_kvs_fnc_asin);
+ KVSM_REGISTER_FUNCTION(m,"acos",math_kvs_fnc_acos);
+ KVSM_REGISTER_FUNCTION(m,"atan",math_kvs_fnc_atan);
+ KVSM_REGISTER_FUNCTION(m,"sqrt",math_kvs_fnc_sqrt);
+ KVSM_REGISTER_FUNCTION(m,"cbrt",math_kvs_fnc_cbrt);
+ KVSM_REGISTER_FUNCTION(m,"abs",math_kvs_fnc_abs);
+ KVSM_REGISTER_FUNCTION(m,"floor",math_kvs_fnc_floor);
+ KVSM_REGISTER_FUNCTION(m,"ceil",math_kvs_fnc_ceil);
+ KVSM_REGISTER_FUNCTION(m,"pow",math_kvs_fnc_pow);
+ KVSM_REGISTER_FUNCTION(m,"exp",math_kvs_fnc_exp);
+ KVSM_REGISTER_FUNCTION(m,"log",math_kvs_fnc_log);
+ KVSM_REGISTER_FUNCTION(m,"log10",math_kvs_fnc_log10);
+ KVSM_REGISTER_FUNCTION(m,"pi",math_kvs_fnc_pi);
+ KVSM_REGISTER_FUNCTION(m,"e",math_kvs_fnc_e);
+ KVSM_REGISTER_FUNCTION(m,"isnan",math_kvs_fnc_isnan);
+ KVSM_REGISTER_FUNCTION(m,"isinf",math_kvs_fnc_isinf);
+ return true;
+}
+
+
+static bool math_module_cleanup(KviModule *m)
+{
+ return true;
+}
+
+KVIRC_MODULE(
+ "System", // module name
+ "1.0.0", // module version
+ "Copyright (C) 2006 Szymon Stefanek (pragma at kvirc dot net),"\
+ "Tonino Imbesi (grifisx at barmes dot org)," \
+ "Alessandro Carbone (noldor at barmes dot org)",
+ "Mathematical function module",
+ math_module_init,
+ 0,
+ 0,
+ math_module_cleanup
+)
diff --git a/src/modules/math/math.vcproj b/src/modules/math/math.vcproj
new file mode 100644
index 000000000..39bafe881
--- /dev/null
+++ b/src/modules/math/math.vcproj
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="math"
+ ProjectGUID="{2B1545D5-14C3-4430-83C5-AA5F2407376B}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)\win32build\bin\modules"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qt-mtnc321.lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib"
+ OutputFile="$(OutDir)/kvi$(ProjectName).dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;$(SSLLIBDIR)&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;"
+ IgnoreAllDefaultLibraries="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/math.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/math.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)\win32build\bin\modules"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qt-mtnc321.lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib"
+ OutputFile="$(OutDir)/kvi$(ProjectName).dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="&quot;$(SSLLIBDIR)&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;"
+ IgnoreAllDefaultLibraries="TRUE"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/math.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\libkvimath.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/modules/math/math_vc05.vcproj b/src/modules/math/math_vc05.vcproj
new file mode 100644
index 000000000..776a7053c
--- /dev/null
+++ b/src/modules/math/math_vc05.vcproj
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="math"
+ ProjectGUID="{2B1545D5-14C3-4430-83C5-AA5F2407376B}"
+ RootNamespace="math"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)\win32build\bin\modules\"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qt-$(QTTAG).lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib perl58.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib"
+ OutputFile="$(OutDir)/kvi$(ProjectName).dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;$(SSLLIBDIR)&quot;;&quot;$(PERLDIR)\lib\CORE&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;;&quot;$(ZLIBLIBDIR)&quot;"
+ GenerateManifest="true"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/math.pdb"
+ SubSystem="2"
+ TurnOffAssemblyGeneration="true"
+ ImportLibrary="$(OutDir)/math.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="true"
+ VerboseOutput="true"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)\win32build\bin\modules"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ EnableFiberSafeOptimizations="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MATH_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ ExceptionHandling="1"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qt-$(QTTAG).lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib perl58.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib"
+ OutputFile="$(OutDir)/kvi$(ProjectName).dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="&quot;$(SSLLIBDIR)&quot;;&quot;$(PERLDIR)\lib\CORE&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;;&quot;$(ZLIBLIBDIR)&quot;"
+ GenerateManifest="true"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ TurnOffAssemblyGeneration="true"
+ ImportLibrary="$(OutDir)/math.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="true"
+ VerboseOutput="true"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\libkvimath.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>