From bb6e659965b02960ab49ebaabc5cbe58a9313f4d Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 27 Aug 2009 08:19:06 +0000 Subject: [PATCH] * src/lib/dlfcn/dlfcn.c: fix warnings * src/lib/evil_fnmatch_list_of_states.c: fix vc++ warning * win32/MANIFEST.txt: * win32/README.txt: * win32/start.bat: * win32/vs9/evil.sln: * win32/vs9/libdlfcn.vcproj: * win32/vs9/libevil.vcproj: * win32/vs9/test/out/update_deps.bat: * win32/vs9/test/start.bat: * win32/vs9/test/test.sln: * win32/vs9/test/test.vcproj: * win32/vs9/test/test_fnmatch.cpp: * win32/vs9 (added): * win32/vs9/test (added): * win32/vs9/test/test_fnmatch.cpp (added): * win32/vs9/test/test.vcproj (added): * win32/vs9/test/start.bat (added): * win32/vs9/test/out (added): * win32/vs9/test/out/update_deps.bat (added): * win32/vs9/test/test.sln (added): * win32/vs9/libdlfcn.vcproj (added): * win32/vs9/libevil.vcproj (added): * win32/vs9/evil.sln (added): * win32/start.bat (added): * win32/vs8/libmman.vcproj (deleted): * win32/vs8/start.bat (deleted): * win32/set_env.bat (deleted): update the Visual Studio environment. Now, there is only one script to launch (start.bat) in win32/. It detects automatically the latest Visual Studio environment which is installed and launch the solution. Currently supported VS are 2005 and 2008. SVN revision: 42029 --- legacy/evil/ChangeLog | 39 ++ legacy/evil/src/lib/dlfcn/dlfcn.c | 24 +- .../src/lib/evil_fnmatch_list_of_states.c | 3 +- legacy/evil/win32/MANIFEST.txt | 11 +- legacy/evil/win32/README.txt | 8 +- legacy/evil/win32/set_env.bat | 19 - legacy/evil/win32/start.bat | 63 +++ legacy/evil/win32/vs9/evil.sln | 29 ++ .../libmman.vcproj => vs9/libdlfcn.vcproj} | 405 +++++++++--------- legacy/evil/win32/vs9/libevil.vcproj | 338 +++++++++++++++ .../evil/win32/vs9/test/out/update_deps.bat | 15 + legacy/evil/win32/{vs8 => vs9/test}/start.bat | 63 +-- legacy/evil/win32/vs9/test/test.sln | 20 + legacy/evil/win32/vs9/test/test.vcproj | 205 +++++++++ legacy/evil/win32/vs9/test/test_fnmatch.cpp | 85 ++++ 15 files changed, 1054 insertions(+), 273 deletions(-) delete mode 100644 legacy/evil/win32/set_env.bat create mode 100755 legacy/evil/win32/start.bat create mode 100644 legacy/evil/win32/vs9/evil.sln rename legacy/evil/win32/{vs8/libmman.vcproj => vs9/libdlfcn.vcproj} (80%) create mode 100644 legacy/evil/win32/vs9/libevil.vcproj create mode 100755 legacy/evil/win32/vs9/test/out/update_deps.bat rename legacy/evil/win32/{vs8 => vs9/test}/start.bat (81%) create mode 100644 legacy/evil/win32/vs9/test/test.sln create mode 100644 legacy/evil/win32/vs9/test/test.vcproj create mode 100644 legacy/evil/win32/vs9/test/test_fnmatch.cpp diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 6d1583b0c5..de0c3116f9 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,42 @@ +2009-08-27 Vincent Torri + + * src/lib/dlfcn/dlfcn.c: + fix warnings + + * src/lib/evil_fnmatch_list_of_states.c: + fix vc++ warning + + * win32/MANIFEST.txt: + * win32/README.txt: + * win32/start.bat: + * win32/vs9/evil.sln: + * win32/vs9/libdlfcn.vcproj: + * win32/vs9/libevil.vcproj: + * win32/vs9/test/out/update_deps.bat: + * win32/vs9/test/start.bat: + * win32/vs9/test/test.sln: + * win32/vs9/test/test.vcproj: + * win32/vs9/test/test_fnmatch.cpp: + * win32/vs9 (added): + * win32/vs9/test (added): + * win32/vs9/test/test_fnmatch.cpp (added): + * win32/vs9/test/test.vcproj (added): + * win32/vs9/test/start.bat (added): + * win32/vs9/test/out (added): + * win32/vs9/test/out/update_deps.bat (added): + * win32/vs9/test/test.sln (added): + * win32/vs9/libdlfcn.vcproj (added): + * win32/vs9/libevil.vcproj (added): + * win32/vs9/evil.sln (added): + * win32/start.bat (added): + * win32/vs8/libmman.vcproj (deleted): + * win32/vs8/start.bat (deleted): + * win32/set_env.bat (deleted): + update the Visual Studio environment. Now, there is only one + script to launch (start.bat) in win32/. It detects automatically + the latest Visual Studio environment which is installed and launch + the solution. Currently supported VS are 2005 and 2008. + 2009-06-13 Lars Munch * src/lib/evil_main.c: diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.c b/legacy/evil/src/lib/dlfcn/dlfcn.c index 3ae92704d8..caed5a3155 100644 --- a/legacy/evil/src/lib/dlfcn/dlfcn.c +++ b/legacy/evil/src/lib/dlfcn/dlfcn.c @@ -1,8 +1,8 @@ #include -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#if defined(__CEGCC__) || defined(__MINGW32CE__) || defined(_MSC_VER) # include -#endif /* __CEGCC__ || __MINGW32CE__ */ +#endif /* __CEGCC__ || __MINGW32CE__ || _MSC_VER */ #include "../Evil.h" @@ -20,8 +20,8 @@ static void get_last_error(char *desc) { char *str; - int l1; - int l2; + size_t l1; + size_t l2; str = evil_last_error_get(); @@ -57,9 +57,9 @@ dlopen(const char* path, int mode __UNUSED__) } else { - char *new_path; - int l; - int i; + char *new_path; + size_t l; + unsigned int i; /* according to MSDN, we must change the slash to backslash */ l = strlen(path); @@ -137,11 +137,11 @@ dlsym(void *handle, const char *symbol) int dladdr (const void *addr __UNUSED__, Dl_info *info) { - TCHAR tpath[PATH_MAX]; - char *path; - char *tmp; - int length; - int ret = 0; + TCHAR tpath[PATH_MAX]; + char *path; + char *tmp; + size_t length; + int ret = 0; if (!info) return 0; diff --git a/legacy/evil/src/lib/evil_fnmatch_list_of_states.c b/legacy/evil/src/lib/evil_fnmatch_list_of_states.c index 8f7ae6d491..a9e1f416e3 100644 --- a/legacy/evil/src/lib/evil_fnmatch_list_of_states.c +++ b/legacy/evil/src/lib/evil_fnmatch_list_of_states.c @@ -22,7 +22,8 @@ fnmatch_list_of_states_alloc(size_t n, unsigned char *has; size_t i; - if (! (l = malloc(n * struct_size))) + l = malloc(n * struct_size); + if (!l) return 0; states = (unsigned char *) (l + n); diff --git a/legacy/evil/win32/MANIFEST.txt b/legacy/evil/win32/MANIFEST.txt index 206cb51f3d..7cda497189 100644 --- a/legacy/evil/win32/MANIFEST.txt +++ b/legacy/evil/win32/MANIFEST.txt @@ -14,12 +14,15 @@ fnmatch_private.h - fnmatch private header vs8 - Visual Studio 8 project files - start.bat - batch script to start work with the solution evil.sln - Evil MSVC solution libdlfcn.vcproj - libdlfcn project libevil.vcproj - libevil project - libmman.vcproj - libmman project - set_env.bat - common environment startup + vs9 - Visual Studio 9 project files + evil.sln - Evil MSVC solution + libdlfcn.vcproj - libdlfcn project + libevil.vcproj - libevil project + + start.bat - batch script to start work with the solution MANIFEST.txt - this file - README.txt - about this folder \ No newline at end of file + README.txt - about this folder diff --git a/legacy/evil/win32/README.txt b/legacy/evil/win32/README.txt index 66b5317edb..6fe2b27ce6 100644 --- a/legacy/evil/win32/README.txt +++ b/legacy/evil/win32/README.txt @@ -4,10 +4,12 @@ Important: Do not launch manually any solutions or projects in the folder, to start - a solution run proper start.bat script, it will setup environment for - projects and will check system requirements. + a solution run the start.bat script, it will setup environment for + projects and will check system requirements. start.bat will detect + automatically the version of Visual Studio which is installed. It + currently supports Visual Studio 2005 and 2008. - Before start make sure that set_env.bat:EXT_DIR variable points to proper + Before start make sure that the EXT_DIR variable points to proper extern directory. Extern directory layout and content (may be different, but this is guaranteed to be enough): diff --git a/legacy/evil/win32/set_env.bat b/legacy/evil/win32/set_env.bat deleted file mode 100644 index 30b22df0f5..0000000000 --- a/legacy/evil/win32/set_env.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off - -rem Set external libraries directory. -set EXT_DIR=%cd%\..\..\..\extern - -if not exist %EXT_DIR% ( - set EXT_DIR= - echo ERROR: External libs dir is not set. - pause - goto END -) - -rem Add installation directory pathes. -set INCLUDE=%EXT_DIR%\include;%INCLUDE% -set LIB=%EXT_DIR%\lib;%LIB% - -set INCLUDE=%cd%\common;%cd%\..\src\lib;%INCLUDE% - -:END diff --git a/legacy/evil/win32/start.bat b/legacy/evil/win32/start.bat new file mode 100755 index 0000000000..3466011bd3 --- /dev/null +++ b/legacy/evil/win32/start.bat @@ -0,0 +1,63 @@ +@echo off + +rem Set external libraries directory. +set EXT_DIR=%cd%\..\..\..\extern + +if not exist %EXT_DIR% ( + set EXT_DIR= + echo ERROR: External libs dir is not set. + pause + goto END +) + +rem Setup common Win32 environment variables + +rem Add installation directory pathes. +set INCLUDE=%EXT_DIR%\include;%INCLUDE% +set LIB=%EXT_DIR%\lib;%LIB% + +set INCLUDE=%cd%\common;%cd%\..\src\lib;%INCLUDE% + +rem Check for basic requirements for Visual Studio 2008 +if "%VS90COMNTOOLS%" == "" ( + echo ERROR: Microsoft Visual Studio 2008 is not installed. + pause + goto NOVS9 +) + +set SolutionDirectory=%cd%\vs9 +set DebugOutputDirectory=%SolutionDirectory%\out +set ReleaseOutputDirectory=%SolutionDirectory%\out +set DebugLibraryDirectory=%SolutionDirectory%\out +set ReleaseLibraryDirectory=%SolutionDirectory%\out +set TemporaryDirectory=%SolutionDirectory%\temp + +rem Setting environment for using Microsoft Visual Studio 2008 x86 tools. +call "%VS90COMNTOOLS%vsvars32.bat" + +vs9\evil.sln + +goto END + +:NOVS9 + +rem Check for basic requirements for Visual Studio 2005 +if "%VS80COMNTOOLS%" == "" ( + echo ERROR: Microsoft Visual Studio 2005 is not installed. + pause + goto END +) + +set SolutionDirectory=%cd%\vs8 +set DebugOutputDirectory=%SolutionDirectory%\out +set ReleaseOutputDirectory=%SolutionDirectory%\out +set DebugLibraryDirectory=%SolutionDirectory%\out +set ReleaseLibraryDirectory=%SolutionDirectory%\out +set TemporaryDirectory=%SolutionDirectory%\temp + +rem Setting environment for using Microsoft Visual Studio 2005 x86 tools. +call "%VS80COMNTOOLS%vsvars32.bat" + +vs8\evil.sln + +:END diff --git a/legacy/evil/win32/vs9/evil.sln b/legacy/evil/win32/vs9/evil.sln new file mode 100644 index 0000000000..b521622772 --- /dev/null +++ b/legacy/evil/win32/vs9/evil.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libevil", "libevil.vcproj", "{689B4F2B-666D-439F-9BF3-1203D813DE3F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdlfcn", "libdlfcn.vcproj", "{2DAB1902-38E3-4F58-8403-C1BC7C077E1F}" + ProjectSection(ProjectDependencies) = postProject + {689B4F2B-666D-439F-9BF3-1203D813DE3F} = {689B4F2B-666D-439F-9BF3-1203D813DE3F} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {689B4F2B-666D-439F-9BF3-1203D813DE3F}.Debug|Win32.ActiveCfg = Debug|Win32 + {689B4F2B-666D-439F-9BF3-1203D813DE3F}.Debug|Win32.Build.0 = Debug|Win32 + {689B4F2B-666D-439F-9BF3-1203D813DE3F}.Release|Win32.ActiveCfg = Release|Win32 + {689B4F2B-666D-439F-9BF3-1203D813DE3F}.Release|Win32.Build.0 = Release|Win32 + {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Debug|Win32.Build.0 = Debug|Win32 + {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.ActiveCfg = Release|Win32 + {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/legacy/evil/win32/vs8/libmman.vcproj b/legacy/evil/win32/vs9/libdlfcn.vcproj similarity index 80% rename from legacy/evil/win32/vs8/libmman.vcproj rename to legacy/evil/win32/vs9/libdlfcn.vcproj index 0251639223..8a74c58eab 100644 --- a/legacy/evil/win32/vs8/libmman.vcproj +++ b/legacy/evil/win32/vs9/libdlfcn.vcproj @@ -1,205 +1,200 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/legacy/evil/win32/vs9/libevil.vcproj b/legacy/evil/win32/vs9/libevil.vcproj new file mode 100644 index 0000000000..8efe141722 --- /dev/null +++ b/legacy/evil/win32/vs9/libevil.vcproj @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/legacy/evil/win32/vs9/test/out/update_deps.bat b/legacy/evil/win32/vs9/test/out/update_deps.bat new file mode 100755 index 0000000000..405745bb45 --- /dev/null +++ b/legacy/evil/win32/vs9/test/out/update_deps.bat @@ -0,0 +1,15 @@ +@echo off + +set Target=%cd% +set e17=%cd%\..\..\..\..\..\.. +set Libs=%e17%\libs +set Proto=%e17%\proto +set Extern=%e17%\..\extern + + +rem Copy proto +cd %Proto%\evil\win32\vs8\out +xcopy libdl.dll %Target%\ /Q /Y +if exist libdl.pdb xcopy libdl.pdb %Target%\ /Q /Y +xcopy libevil.dll %Target%\ /Q /Y +if exist libevil.pdb xcopy libevil.pdb %Target%\ /Q /Y diff --git a/legacy/evil/win32/vs8/start.bat b/legacy/evil/win32/vs9/test/start.bat similarity index 81% rename from legacy/evil/win32/vs8/start.bat rename to legacy/evil/win32/vs9/test/start.bat index e7a3b131e4..ec90aa927a 100644 --- a/legacy/evil/win32/vs8/start.bat +++ b/legacy/evil/win32/vs9/test/start.bat @@ -1,30 +1,35 @@ -@echo off -rem Warning: environment is set for Win32 platform. - -rem Setup common Win32 environment variables - -pushd .. -call set_env.bat -popd - -set SolutionDirectory=%cd% -set DebugOutputDirectory=%SolutionDirectory%\out -set ReleaseOutputDirectory=%SolutionDirectory%\out -set DebugLibraryDirectory=%SolutionDirectory%\out -set ReleaseLibraryDirectory=%SolutionDirectory%\out -set TemporaryDirectory=%SolutionDirectory%\temp - - -rem Check for basic requirements -if "%VS80COMNTOOLS%" == "" ( - echo ERROR: Microsoft Visual Studio 2005 is not installed. - pause - goto END -) - -rem Setting environment for using Microsoft Visual Studio 2005 x86 tools. -call "%VS80COMNTOOLS%vsvars32.bat" - -evil.sln - +@echo off +rem Warning: environment is set for Win32 platform. + +set PROJECT_TYPE=vs8 + +pushd ..\.. +call set_env.bat +popd + +if "%EXT_DIR%" == "" goto END + +rem Setup common Win32 environment variables + +set SolutionDirectory=%cd% +set DebugOutputDirectory=%SolutionDirectory%\out +set ReleaseOutputDirectory=%SolutionDirectory%\out +set DebugLibraryDirectory=%SolutionDirectory%\out +set ReleaseLibraryDirectory=%SolutionDirectory%\out +set TemporaryDirectory=%SolutionDirectory%\temp + +rem Check for basic requirements +if "%VS80COMNTOOLS%" == "" ( + echo ERROR: Microsoft Visual Studio 2005 is not installed. + pause + goto END +) + +rem Setting environment for using Microsoft Visual Studio 2005 x86 tools. +call "%VS80COMNTOOLS%vsvars32.bat" + +set LIB=%SolutionDirectory%\..\out;%LIB% + +test.sln + :END \ No newline at end of file diff --git a/legacy/evil/win32/vs9/test/test.sln b/legacy/evil/win32/vs9/test/test.sln new file mode 100644 index 0000000000..51904f038f --- /dev/null +++ b/legacy/evil/win32/vs9/test/test.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{5C640EA7-6E65-46FF-A1FE-EB0955B0CC5A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C640EA7-6E65-46FF-A1FE-EB0955B0CC5A}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C640EA7-6E65-46FF-A1FE-EB0955B0CC5A}.Debug|Win32.Build.0 = Debug|Win32 + {5C640EA7-6E65-46FF-A1FE-EB0955B0CC5A}.Release|Win32.ActiveCfg = Release|Win32 + {5C640EA7-6E65-46FF-A1FE-EB0955B0CC5A}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/legacy/evil/win32/vs9/test/test.vcproj b/legacy/evil/win32/vs9/test/test.vcproj new file mode 100644 index 0000000000..bcfa5007ac --- /dev/null +++ b/legacy/evil/win32/vs9/test/test.vcproj @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/legacy/evil/win32/vs9/test/test_fnmatch.cpp b/legacy/evil/win32/vs9/test/test_fnmatch.cpp new file mode 100644 index 0000000000..cdbc8921e5 --- /dev/null +++ b/legacy/evil/win32/vs9/test/test_fnmatch.cpp @@ -0,0 +1,85 @@ + +#include +#include + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include +#include + +const char *translate_return_value(int ret) +{ + static char buf[256] = ""; + switch (ret) + { + case 0: + strcpy(buf, "Match"); + break; + case FNM_NOMATCH: + strcpy(buf, "NoMatch"); + break; + case FNM_SYNTAXERR: + strcpy(buf, "SyntaxErr"); + break; + case FNM_NOMEM: + strcpy(buf, "NoMem"); + break; + default: + sprintf(buf, "%d", ret); + break; + } + return buf; +} + +#define TEST_CASE(a) printf(#a " = %s\n", translate_return_value(a)); + +int main() +{ + TEST_CASE(fnmatch("", "", 0)); + TEST_CASE(fnmatch("a", "a", 0)); + TEST_CASE(fnmatch("a", "b", 0)); + TEST_CASE(fnmatch("a", "ba", 0)); + TEST_CASE(fnmatch("a", "ab", 0)); + TEST_CASE(fnmatch("a", "ba", 0)); + TEST_CASE(fnmatch("a", "b a", 0)); + TEST_CASE(fnmatch("a", "aa", 0)); + TEST_CASE(fnmatch("ab", "ab", 0)); + TEST_CASE(fnmatch("ab", "ab ", 0)); + TEST_CASE(fnmatch("ab", " ab", 0)); + TEST_CASE(fnmatch("ab", "abc", 0)); + TEST_CASE(fnmatch("ab", "ab c", 0)); + TEST_CASE(fnmatch("ab", "ba", 0)); + + TEST_CASE(fnmatch("a*", "a", 0)); + TEST_CASE(fnmatch("a*", "b", 0)); + TEST_CASE(fnmatch("a*", "ab", 0)); + TEST_CASE(fnmatch("a*", "ba", 0)); + TEST_CASE(fnmatch("a*", "aba", 0)); + + TEST_CASE(fnmatch("a?", "a", 0)); + TEST_CASE(fnmatch("a?", "b", 0)); + TEST_CASE(fnmatch("a?", "ab", 0)); + TEST_CASE(fnmatch("a?", "ba", 0)); + TEST_CASE(fnmatch("a?", "aa", 0)); + TEST_CASE(fnmatch("a?", "aba", 0)); + TEST_CASE(fnmatch("a?", "a a", 0)); + + TEST_CASE(fnmatch("*.*", "a", 0)); + TEST_CASE(fnmatch("*.*", "a.", 0)); + TEST_CASE(fnmatch("*.*", ".", 0)); + TEST_CASE(fnmatch("*.*", ".a", 0)); + TEST_CASE(fnmatch("*.*", " . ", 0)); + TEST_CASE(fnmatch("*.*", "aa.aa", 0)); + + TEST_CASE(fnmatch("*", "", 0)); + TEST_CASE(fnmatch("*", "a", 0)); + + TEST_CASE(fnmatch("*?", "", 0)); + TEST_CASE(fnmatch("*?", "a", 0)); + + TEST_CASE(fnmatch("*abc*", "aabbccabcaa", 0)); + + TEST_CASE(fnmatch("\\", "", 0)); +}