diff --git a/rfunc/rfunc.sln b/rfunc/rfunc.sln new file mode 100644 index 0000000..497e27e --- /dev/null +++ b/rfunc/rfunc.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rfunc", "rfunc.vcxproj", "{B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Debug|x64.ActiveCfg = Debug|x64 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Debug|x64.Build.0 = Debug|x64 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Debug|x86.ActiveCfg = Debug|Win32 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Debug|x86.Build.0 = Debug|Win32 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Release|x64.ActiveCfg = Release|x64 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Release|x64.Build.0 = Release|x64 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Release|x86.ActiveCfg = Release|Win32 + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/rfunc/rfunc.vcxproj b/rfunc/rfunc.vcxproj new file mode 100644 index 0000000..4950bb5 --- /dev/null +++ b/rfunc/rfunc.vcxproj @@ -0,0 +1,190 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B837C0B1-DDA5-4CE1-B1FC-F60C351486EC} + Win32Proj + rfunc + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;RFUNC_EXPORTS;%(PreprocessorDefinitions) + + + + + Windows + true + + + %(AdditionalDependencies) + + + + + + + Level3 + Disabled + RUSE_DATETIME;IB_6X;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;RFUNC_EXPORTS + J:\Program Files\Firebird\Firebird_2_5\include + + + Windows + true + ib_util_ms.lib;fbclient_ms.lib;%(AdditionalDependencies) + J:\Program Files\Firebird\Firebird_2_5\lib + $(ProjectDir)..\source\rfunc.def + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;RFUNC_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + RUSE_DATETIME;IB_6X;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;RFUNC_EXPORTS + J:\Program Files\Firebird\Firebird_2_5\include + + + Windows + true + true + true + J:\Program Files\Firebird\Firebird_2_5\lib + ib_util_ms.lib;fbclient_ms.lib;%(AdditionalDependencies) + $(ProjectDir)..\source\rfunc.def + + + + + + \ No newline at end of file diff --git a/rfunc/rfunc.vcxproj.filters b/rfunc/rfunc.vcxproj.filters new file mode 100644 index 0000000..bb5ae80 --- /dev/null +++ b/rfunc/rfunc.vcxproj.filters @@ -0,0 +1,95 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/source/rfunc.h b/source/rfunc.h index 3164c3f..6a132ba 100644 --- a/source/rfunc.h +++ b/source/rfunc.h @@ -48,6 +48,10 @@ #include +#if defined _MSC_VER && defined _WIN64 +#define WIN32 +#endif + #if defined __STDC__ || defined __BORLANDC__ || defined _MSC_VER #define PROTO(args) args #define ARG(type, arg) type arg diff --git a/source/rmath.c b/source/rmath.c index 995354f..300e011 100644 --- a/source/rmath.c +++ b/source/rmath.c @@ -23,6 +23,7 @@ $Revision$ $Author$ $Date$ **************************************************************************/ +#define _USE_MATH_DEFINES #include #include #include @@ -30,6 +31,13 @@ #include "rfunc.h" #include "rmath.h" +#if defined _MSC_VER +#define random() rand() +#define srandom(i) srand(i) +#else +#define _FALLBACK_RANDOMIZE +#endif + double EXPORT fn_abs(ARG(double*, x)) ARGLIST(double *x) { @@ -128,7 +136,7 @@ ARGLIST(double *def) long EXPORT fn_initRandom(ARG(long *, num)) ARGLIST(long* num) { -#if defined WIN32 +#if defined _FALLBACK_RANDOMIZE #pragma warn -8057 randomize(); #else @@ -140,7 +148,7 @@ ARGLIST(long* num) long EXPORT fn_getRandom(ARG(long *, num)) ARGLIST(long* num) { -#if defined WIN32 +#if defined _FALLBACK_RANDOMIZE return random(*num); #else div_t x; diff --git a/source/rmisc.c b/source/rmisc.c index 091cc33..8883ad7 100644 --- a/source/rmisc.c +++ b/source/rmisc.c @@ -94,13 +94,13 @@ long EXPORT fn_msgbox(ARG(char*, lpText), ARG(char*, lpCaption), ARG(long*, Flag ARGLIST(char *lpText) ARGLIST(char *lpCaption) ARGLIST(long *Flags) -{ return MessageBox(NULL, lpText, lpCaption, *Flags); } +{ return MessageBoxA(NULL, lpText, lpCaption, *Flags); } #endif short EXPORT fn_ean13cs(ARG(char*, s)) ARGLIST(char *s) { - long i = strlen(s); + size_t i = strlen(s); long c = 0, a; if (i != 12 || atoi(s) == 0) return -1; @@ -117,7 +117,7 @@ ARGLIST(char *s) short EXPORT fn_bccheckdigit(ARG(char*, s)) ARGLIST(char *s) { - long i = strlen(s); + size_t i = strlen(s); long c = 0, a, j; for (j = 0; j < i; j++ ) diff --git a/source/rstring.c b/source/rstring.c index 332cb33..f992ed8 100644 --- a/source/rstring.c +++ b/source/rstring.c @@ -61,7 +61,7 @@ ARGLIST(char *s) char* EXPORT fn_rtrim(ARG(char*, s)) ARGLIST(char *s) { - long n; + size_t n; n = strlen(s); while (n && strchr(delims, s[n-1])) n--; s[n] = '\0'; @@ -99,8 +99,8 @@ ARGLIST(char *s) ARGLIST(long *m) ARGLIST(long *n) { - long left, right; - long len = strlen(s); + size_t left, right; + size_t len = strlen(s); left = (*m < 0) ? len + *m + 1 : *m; right = (*n < 0) ? left - 1 : left - 1 + *n - 1; @@ -123,8 +123,8 @@ ARGLIST(long maxlength) { long i = 0; long j = 0; - long l = strlen(s); - long n = MIN(*c * l + 1L, maxlength); + size_t l = strlen(s); + size_t n = MIN(*c * l + 1L, maxlength); char *buffer = (char*) MALLOC (n); if (*s) @@ -161,7 +161,9 @@ ARGLIST(long maxlength) long i = 0; long j = 0; long l = 0; - long slen = strlen(s), n, len; + size_t slen = strlen(s); + long n; + size_t len; char *buffer; len = slen + strlen(is) + 1L; @@ -205,7 +207,7 @@ ARGLIST(char *froms) ARGLIST(char *tos) ARGLIST(long maxlength) { - long sn = strlen(froms); + size_t sn = strlen(froms); char *buffer = (char*) MALLOC (maxlength); // if "froms" is an empty string if (sn == 0) @@ -270,7 +272,7 @@ ARGLIST(char *str2) { char *ptr; long r = 0; - long len = strlen(str1); + size_t len = strlen(str1); if (!len || !*str2) return 0; ptr = str2; @@ -378,7 +380,7 @@ ARGLIST(short *n) ARGLIST(char *c) ARGLIST(long maxlength) { - long l = strlen(s), i = 0; + size_t l = strlen(s), i = 0; char *buffer; char *ptr = s; long len = MIN(*n + 1L, maxlength);