From 7c608bc1d5c126df839c699c5ae531828a00caa3 Mon Sep 17 00:00:00 2001 From: Vincent Peyruqueou Date: Mon, 27 Mar 2023 11:12:55 +0200 Subject: Microsoft Visual Studio (2022) solution for src (lib IVY) --- .gitignore | 4 ++ ivy_c.sln | 41 +++++++++++ src/intervalRegexp.c | 9 ++- src/ivy.c | 5 +- src/ivy_c.sln | 45 ------------ src/ivy_c.vcxproj | 179 ++++++++++++++++++++++++++++++++++++++++++++++ src/ivy_c.vcxproj.filters | 97 +++++++++++++++++++++++++ src/ivybuffer.c | 4 -- src/timer.h | 15 ++++ 9 files changed, 344 insertions(+), 55 deletions(-) create mode 100644 .gitignore create mode 100644 ivy_c.sln delete mode 100644 src/ivy_c.sln create mode 100644 src/ivy_c.vcxproj create mode 100644 src/ivy_c.vcxproj.filters diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..668ca85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/Win32/ +src/Win32/ +src/ivy_c.vcxproj.user +.vs/ diff --git a/ivy_c.sln b/ivy_c.sln new file mode 100644 index 0000000..456f801 --- /dev/null +++ b/ivy_c.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33414.496 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ivy", "src\ivy_c.vcxproj", "{4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre", "pcre\build-VS2022\libpcre\libpcre.vcxproj", "{DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}" +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 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|x64.ActiveCfg = Debug|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|x64.Build.0 = Debug|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|x86.ActiveCfg = Debug|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|x86.Build.0 = Debug|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|x64.ActiveCfg = Release|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|x64.Build.0 = Release|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|x86.ActiveCfg = Release|Win32 + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|x86.Build.0 = Release|Win32 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Debug|x64.ActiveCfg = Debug|x64 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Debug|x64.Build.0 = Debug|x64 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Debug|x86.ActiveCfg = Debug|Win32 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Debug|x86.Build.0 = Debug|Win32 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Release|x64.ActiveCfg = Release|x64 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Release|x64.Build.0 = Release|x64 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Release|x86.ActiveCfg = Release|Win32 + {DA8CB038-FD70-44B5-8ADA-5E32CA9ECACE}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DAEA9BAD-A8F9-46DC-987B-71CC2F0FDA07} + EndGlobalSection +EndGlobal diff --git a/src/intervalRegexp.c b/src/intervalRegexp.c index fb5e0f6..f30b9d5 100644 --- a/src/intervalRegexp.c +++ b/src/intervalRegexp.c @@ -3,7 +3,12 @@ #include #include #include + +#ifdef WIN32 +#include +#else #include +#endif #include "intervalRegexp.h" @@ -24,9 +29,7 @@ return Perr ("CHECK_AND_RETURN"); } #define EndLocBuf (&(locBuf[strlen(locBuf)])) -#ifdef WIN32 -#define snprintf _snprintf -#endif + #define AddLocBuf(...) snprintf (EndLocBuf, sizeof (locBuf)-strlen(locBuf), __VA_ARGS__) typedef struct { diff --git a/src/ivy.c b/src/ivy.c index 7fbc553..6dd39df 100644 --- a/src/ivy.c +++ b/src/ivy.c @@ -28,13 +28,12 @@ #include #include #include "timer.h" -#define snprintf _snprintf + #ifdef __MINGW32__ // should be removed in when defined in MinGW include of ws2tcpip.h extern const char * WSAAPI inet_ntop(int af, const void *src, char *dst, socklen_t size); extern int WSAAPI inet_pton(int af, const char *src, void *dst); - #endif #else #include @@ -629,7 +628,7 @@ static void Receive( Client client, const void *data, char *line ) if ( other ) { RWIvyClientPtr target; - // Dilemma choose the rigth client to close + // Dilemma choose the right client to close // the symetric processing will try to close each other // only one side may be closed unsigned short int other_localPort, other_remotePort, clnt_localPort, clnt_remotePort; diff --git a/src/ivy_c.sln b/src/ivy_c.sln deleted file mode 100644 index 4a1d999..0000000 --- a/src/ivy_c.sln +++ /dev/null @@ -1,45 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ivy", "ivy_c.vcxproj", "{4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcre", "..\..\pcre\pcre.vcxproj", "{D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}" -EndProject -Global - GlobalSection(SourceCodeControl) = preSolution - SccNumberOfProjects = 3 - SccLocalPath0 = . - CanCheckoutShared = false - SccProjectUniqueName1 = ivy_c.vcxproj - SccLocalPath1 = . - CanCheckoutShared = false - SccProjectUniqueName2 = ..\\..\\pcre\\pcre.vcxproj - SccProjectName2 = \u0022$/pcre\u0022,\u0020KSHAAAAA - SccLocalPath2 = ..\\..\\pcre - CanCheckoutShared = false - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|Win32.ActiveCfg = Debug|Win32 - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|Win32.Build.0 = Debug|Win32 - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Debug|x64.ActiveCfg = Debug|Win32 - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|Win32.ActiveCfg = Release|Win32 - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|Win32.Build.0 = Release|Win32 - {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3}.Release|x64.ActiveCfg = Release|Win32 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Debug|Win32.Build.0 = Debug|Win32 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Debug|x64.ActiveCfg = Debug|x64 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Debug|x64.Build.0 = Debug|x64 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Release|Win32.ActiveCfg = Release|Win32 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Release|Win32.Build.0 = Release|Win32 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Release|x64.ActiveCfg = Release|x64 - {D79FC143-498E-4342-B2C7-BDAD1B8D0E6B}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/ivy_c.vcxproj b/src/ivy_c.vcxproj new file mode 100644 index 0000000..5d45459 --- /dev/null +++ b/src/ivy_c.vcxproj @@ -0,0 +1,179 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + 17.0 + ivy + {4BD59668-D7DA-4AFC-9F27-E3CEE16940D3} + ivy_c + + + + + + + + + 10.0 + + + + DynamicLibrary + v143 + false + + + DynamicLibrary + v143 + false + + + + + + + + + + + + + <_ProjectFileVersion>17.0.33312.129 + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + Disabled + ..\pcre\include;%(AdditionalIncludeDirectories) + _DEBUG;DEBUG;WIN32;_LIB;REGEX_MALLOC;USE_PCRE_REGEX;PCRE_OPT=PCRE_CASELESS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + .\Debug/ivy_c.pch + $(IntDir) + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + Ws2_32.lib;libpcre.lib;%(AdditionalDependencies) + false + libIvy.def + false + + $(SolutionDir)$(Platform)\$(Configuration) + + + + + MaxSpeed + OnlyExplicitInline + ..\pcre\include;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_LIB;REGEX_MALLOC;USE_PCRE_REGEX;PCRE_OPT=PCRE_CASELESS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + true + false + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + Ws2_32.lib;%(AdditionalDependencies) + libIvy.def + false + + $(SolutionDir)$(Platform)\$(Configuration) + + + Copy Ivy DLL to Directory + rem copy $(TargetPath) ../../rejeu/$(OutDir) +rem copy $(TargetPath) ../../interpolate/$(OutDir) + + + + + + + + Disabled + EnableFastChecks + true + + + + + + Disabled + EnableFastChecks + MaxSpeed + true + + + Disabled + EnableFastChecks + MaxSpeed + true + + + + Disabled + EnableFastChecks + MaxSpeed + true + + + + + + + + + + + + + + + + + + + + + + + + + {da8cb038-fd70-44b5-8ada-5e32ca9ecace} + + + + + + \ No newline at end of file diff --git a/src/ivy_c.vcxproj.filters b/src/ivy_c.vcxproj.filters new file mode 100644 index 0000000..251866b --- /dev/null +++ b/src/ivy_c.vcxproj.filters @@ -0,0 +1,97 @@ + + + + + {480c9b10-aa1e-4153-bba8-198ed53702f8} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {12aa679e-c45e-416e-b1c7-e6f7106c7158} + h;hpp;hxx;hm;inl + + + + + 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 + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/ivybuffer.c b/src/ivybuffer.c index d21114f..c8d3710 100644 --- a/src/ivybuffer.c +++ b/src/ivybuffer.c @@ -23,10 +23,6 @@ #include #include -#ifdef WIN32 -#define snprintf _snprintf -#endif - #include "param.h" #include "ivybuffer.h" diff --git a/src/timer.h b/src/timer.h index accad5b..627bdb2 100644 --- a/src/timer.h +++ b/src/timer.h @@ -44,6 +44,21 @@ struct timezone int tz_dsttime; /* type of dst correction */ }; int gettimeofday(struct timeval *tv, struct timezone *tz); + +/** + * timersub(3) from + */ +static inline void timersub(struct timeval* a, struct timeval* b, + struct timeval* res) +{ + res->tv_sec = a->tv_sec - b->tv_sec; + res->tv_usec = a->tv_usec - b->tv_usec; + if (res->tv_usec < 0) + { + res->tv_usec += 1000000; + res->tv_sec--; + } +} #endif /* Interface avec select */ -- cgit v1.1