limit windows.h inclusion to avoid definition of macros min/max 90/17190/1
Antoine ELIAS [Thu, 10 Sep 2015 15:21:28 +0000 (17:21 +0200)]
Change-Id: Ib3b3ca7d15582846d0fdee6553ce366cddef65dc

20 files changed:
scilab/libs/GetWindowsVersion/GetWindowsVersion.c
scilab/libs/GetWindowsVersion/GetWindowsVersion.h
scilab/modules/cacsd/src/c/core_Import.def
scilab/modules/core/Makefile.am
scilab/modules/core/Makefile.in
scilab/modules/core/includes/ExceptionMessage.h [deleted file]
scilab/modules/core/includes/GetExceptionCode.h [deleted file]
scilab/modules/core/includes/getmemory.h
scilab/modules/core/includes/timer.hxx
scilab/modules/core/src/c/ExceptionMessage.c [deleted file]
scilab/modules/core/src/c/GetExceptionCode.c [deleted file]
scilab/modules/core/src/c/core.vcxproj
scilab/modules/core/src/c/core.vcxproj.filters
scilab/modules/core/src/c/getmemory.c
scilab/modules/dynamic_link/includes/dynamiclibrary_windows.h
scilab/modules/dynamic_link/src/c/core_Import.def
scilab/modules/external_objects_java/src/cpp/JIMSwrapunwrap.h
scilab/modules/external_objects_java/src/cpp/ScilabJavaEnvironment.hxx
scilab/modules/jvm/src/c/JVM_Windows.c
scilab/modules/threads/includes/Thread_Wrapper.h

index 56fadc6..f3b8f69 100644 (file)
@@ -11,6 +11,7 @@
  *
  */
 
+#include <windows.h>
 #include "GetWindowsVersion.h"
 /*-----------------------------------------------------------------------------------*/
 typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
index 0cb45bc..074a2f5 100644 (file)
@@ -13,7 +13,6 @@
 
 #ifndef __GETWINDOWSVERSION_H__
 #define __GETWINDOWSVERSION_H__
-#include <windows.h>
 /*-----------------------------------------------------------------------------------*/
 #ifdef EXPORT_GETWINDOWSVERSION_DLL
 #define IMPORT_EXPORT_GETWINDOWSVERSION_DLL __declspec(dllexport)
index 992662a..0370e89 100644 (file)
@@ -5,7 +5,6 @@ EXPORTS
 ;
 ;core
 ;
-ExceptionMessage
 callFunctionFromGateway
 com_
 fortran_mex_gateway
index 2810c0c..85e4c68 100644 (file)
@@ -204,7 +204,6 @@ libscicore_la_includedir=$(pkgincludedir)
 libscicore_la_include_HEADERS = \
 includes/BOOL.h \
 includes/core_math.h \
-includes/ExceptionMessage.h \
 includes/existfunction.h \
 includes/freeArrayOfString.h \
 includes/getcommandlineargs.h \
index 5c1f22c..af50b1c 100644 (file)
@@ -855,7 +855,6 @@ libscicore_la_includedir = $(pkgincludedir)
 libscicore_la_include_HEADERS = \
 includes/BOOL.h \
 includes/core_math.h \
-includes/ExceptionMessage.h \
 includes/existfunction.h \
 includes/freeArrayOfString.h \
 includes/getcommandlineargs.h \
diff --git a/scilab/modules/core/includes/ExceptionMessage.h b/scilab/modules/core/includes/ExceptionMessage.h
deleted file mode 100644 (file)
index 72416ef..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-#ifndef _EXCEPTIONMESSAGE_H_
-#define _EXCEPTIONMESSAGE_H_
-/*--------------------------------------------------------------------------*/
-#include <windows.h>
-/*--------------------------------------------------------------------------*/
-void ExceptionMessage(DWORD ExceptionCode, char *functionname);
-/*--------------------------------------------------------------------------*/
-#endif /* _EXCEPTIONMESSAGE_H_ */
diff --git a/scilab/modules/core/includes/GetExceptionCode.h b/scilab/modules/core/includes/GetExceptionCode.h
deleted file mode 100644 (file)
index 4aea46e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2005 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-#ifndef __GETEXCEPTIONCODE__
-#define __GETEXCEPTIONCODE__
-
-/* Only for Windows */
-
-#include <Windows.h>
-#include "sci_malloc.h"
-
-char *GetExceptionString(DWORD ExceptionCode);
-
-#endif /* __GETEXCEPTIONCODE__ */
index 2afe0ae..3d96595 100644 (file)
@@ -12,9 +12,7 @@
 #ifndef __GETMEMORY__
 #define __GETMEMORY__
 
-#ifdef _MSC_VER
-#include <windows.h>
-#else
+#ifndef _MSC_VER
 #if defined(hpux)
 #include <sys/param.h>
 #include <sys/pstat.h>
@@ -32,8 +30,6 @@
 #include <sys/sysinfo.h>
 #include <machine/hal_sysinfo.h>
 #endif
-#include <stdio.h>
-#include <string.h>
 #endif /*GETMEMORY*/
 
 /**
index 404ea1e..e2c081f 100644 (file)
@@ -16,8 +16,9 @@
 #ifndef _MSC_VER
 #include <sys/time.h>
 #else
+#define NOMINMAX
 #include <windows.h>
-//#include <winbase.h>
+#undef NOMINMAX
 #endif
 #include <iostream>
 #include <iomanip>
diff --git a/scilab/modules/core/src/c/ExceptionMessage.c b/scilab/modules/core/src/c/ExceptionMessage.c
deleted file mode 100644 (file)
index 807e46c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-#include "sci_malloc.h"
-#include "GetExceptionCode.h"
-#include "ExceptionMessage.h"
-#include "sciprint.h"
-/*--------------------------------------------------------------------------*/
-extern char *GetExceptionString(DWORD ExceptionCode);
-/*--------------------------------------------------------------------------*/
-void ExceptionMessage(DWORD ExceptionCode, char *functionname)
-{
-    char *ExceptionString = GetExceptionString(ExceptionCode);
-    if (functionname)
-    {
-        sciprint("Warning !!!\nScilab has found a critical error (%s)\nwith \"%s\" function.\nSave your data and restart Scilab.\n", ExceptionString, functionname);
-    }
-    else
-    {
-        sciprint("Warning !!!\nScilab has found a critical error (%s).\nSave your data and restart Scilab.\n", ExceptionString);
-    }
-    if (ExceptionString)
-    {
-        FREE(ExceptionString);
-        ExceptionString = NULL;
-    }
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/core/src/c/GetExceptionCode.c b/scilab/modules/core/src/c/GetExceptionCode.c
deleted file mode 100644 (file)
index 5cda363..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2005 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-#include "GetExceptionCode.h"
-#include <string.h>
-/*--------------------------------------------------------------------------*/
-char *GetExceptionString(DWORD ExceptionCode)
-{
-    char *StringOuput = (char *)MALLOC((strlen("EXCEPTION_NONCONTINUABLE_EXCEPTION") + 1) * sizeof(char));
-
-    switch (ExceptionCode)
-    {
-        case EXCEPTION_ACCESS_VIOLATION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_ACCESS_VIOLATION");
-            break;
-        case EXCEPTION_DATATYPE_MISALIGNMENT:
-            wsprintf(StringOuput, "%s", "EXCEPTION_DATATYPE_MISALIGNMENT");
-            break;
-        case EXCEPTION_BREAKPOINT:
-            wsprintf(StringOuput, "%s", "EXCEPTION_BREAKPOINT");
-            break;
-        case EXCEPTION_SINGLE_STEP:
-            wsprintf(StringOuput, "%s", "EXCEPTION_SINGLE_STEP");
-            break;
-        case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
-            wsprintf(StringOuput, "%s", "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
-            break;
-        case EXCEPTION_FLT_DENORMAL_OPERAND:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_DENORMAL_OPERAND");
-            break;
-        case EXCEPTION_FLT_DIVIDE_BY_ZERO:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_DIVIDE_BY_ZERO");
-            break;
-        case EXCEPTION_FLT_INEXACT_RESULT:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_INEXACT_RESULT");
-            break;
-        case EXCEPTION_FLT_INVALID_OPERATION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_INVALID_OPERATION");
-            break;
-        case EXCEPTION_FLT_OVERFLOW:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_OVERFLOW");
-            break;
-        case EXCEPTION_FLT_STACK_CHECK:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_STACK_CHECK");
-            break;
-        case EXCEPTION_FLT_UNDERFLOW:
-            wsprintf(StringOuput, "%s", "EXCEPTION_FLT_UNDERFLOW");
-            break;
-        case EXCEPTION_INT_DIVIDE_BY_ZERO:
-            wsprintf(StringOuput, "%s", "EXCEPTION_INT_DIVIDE_BY_ZERO");
-            break;
-        case EXCEPTION_INT_OVERFLOW:
-            wsprintf(StringOuput, "%s", "EXCEPTION_INT_OVERFLOW");
-            break;
-        case EXCEPTION_PRIV_INSTRUCTION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_PRIV_INSTRUCTION");
-            break;
-        case EXCEPTION_IN_PAGE_ERROR:
-            wsprintf(StringOuput, "%s", "EXCEPTION_IN_PAGE_ERROR");
-            break;
-        case EXCEPTION_GUARD_PAGE:
-            wsprintf(StringOuput, "%s", "EXCEPTION_GUARD_PAGE");
-            break;
-        case EXCEPTION_STACK_OVERFLOW:
-            wsprintf(StringOuput, "%s", "EXCEPTION_STACK_OVERFLOW");
-            break;
-        case EXCEPTION_ILLEGAL_INSTRUCTION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_ILLEGAL_INSTRUCTION");
-            break;
-        case EXCEPTION_INVALID_DISPOSITION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_INVALID_DISPOSITION");
-            break;
-        case EXCEPTION_NONCONTINUABLE_EXCEPTION:
-            wsprintf(StringOuput, "%s", "EXCEPTION_NONCONTINUABLE_EXCEPTION");
-            break;
-        case EXCEPTION_INVALID_HANDLE:
-            wsprintf(StringOuput, "%s", "EXCEPTION_INVALID_HANDLE");
-            break;
-
-        default:
-            wsprintf(StringOuput, "%s", "Unknown exception");
-            break;
-    }
-
-    return StringOuput;
-}
-/*--------------------------------------------------------------------------*/
index 4551c7d..72177b6 100644 (file)
@@ -260,12 +260,10 @@ cd ..
     <ClCompile Include="dynamic_gateways.c" />
     <ClCompile Include="dynamic_parallel.c" />
     <ClCompile Include="dynamic_tclsci.c" />
-    <ClCompile Include="ExceptionMessage.c" />
     <ClCompile Include="freeArrayOfString.c" />
     <ClCompile Include="getcommandlineargs.c" />
     <ClCompile Include="getdynamicdebuginfo.c" />
     <ClCompile Include="getdynamicDebugInfo_Windows.c" />
-    <ClCompile Include="GetExceptionCode.c" />
     <ClCompile Include="getmaxMALLOC.c" />
     <ClCompile Include="getmemory.c" />
     <ClCompile Include="getmodules.c" />
@@ -313,12 +311,10 @@ cd ..
     <ClInclude Include="..\..\includes\core_gw.hxx" />
     <ClInclude Include="..\..\includes\core_math.h" />
     <ClInclude Include="..\..\includes\dynlib_core.h" />
-    <ClInclude Include="..\..\includes\ExceptionMessage.h" />
     <ClInclude Include="..\..\includes\existfunction.h" />
     <ClInclude Include="..\..\includes\exit_status.hxx" />
     <ClInclude Include="..\..\includes\freeArrayOfString.h" />
     <ClInclude Include="..\..\includes\getcommandlineargs.h" />
-    <ClInclude Include="..\..\includes\GetExceptionCode.h" />
     <ClInclude Include="..\..\includes\getfunctionsname.h" />
     <ClInclude Include="..\..\includes\getmacrosname.h" />
     <ClInclude Include="..\..\includes\getmaxMALLOC.h" />
index dd652da..ae28e67 100644 (file)
@@ -29,9 +29,6 @@
     <ClCompile Include="dynamic_tclsci.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="ExceptionMessage.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="freeArrayOfString.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -41,9 +38,6 @@
     <ClCompile Include="getdynamicDebugInfo_Windows.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="GetExceptionCode.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="getmemory.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClInclude Include="..\..\includes\core_math.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\includes\ExceptionMessage.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\includes\existfunction.h">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="..\..\includes\getcommandlineargs.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\includes\GetExceptionCode.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\includes\getmemory.h">
       <Filter>Header Files</Filter>
     </ClInclude>
index 3eb278f..b68c657 100644 (file)
 
 #include "getmemory.h"
 
+#ifdef _MSC_VER
+#include <windows.h>
+#endif
+
 #if defined(__NetBSD__) || defined(__DragonFly__)
 #include <sys/param.h>
 #include <sys/sysctl.h>
index ffa1b1f..a0a8b6e 100644 (file)
@@ -15,6 +15,7 @@
 //avoid declaration on macro min/max
 #define NOMINMAX
 #include <Windows.h>
+#undef NOMINMAX
 #include "dynlib_dynamic_link.h"
 
 #include "BOOL.h"
index 0cd0d73..89d36a9 100644 (file)
@@ -2,7 +2,6 @@ LIBRARY    core.dll
 
 
 EXPORTS
-ExceptionMessage
 funtab_
 iop_
 callFunctionFromGateway
index c649464..7821d96 100644 (file)
@@ -19,7 +19,7 @@
 #define __JIMS__WRAPUNWRAP_H__
 
 #ifdef _MSC_VER
-#include <Windows.h>
+//#include <Windows.h>
 #endif
 
 #define __JIMS_getmethod__(Kind, Type) static const char * get##Kind##MethodName() \
index 5bbaa95..3f3b18b 100644 (file)
@@ -24,7 +24,7 @@ extern "C"
 #include "dynlib_external_objects_java_scilab.h"
 #include <jni.h>
 #ifdef _MSC_VER
-#include <Windows.h>
+    //#include <Windows.h>
 #endif
 #include "os_string.h"
 }
index 39ccd13..ad31615 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 /*--------------------------------------------------------------------------*/
+#include <windows.h>
 #include "machine.h" /* SHARED_LIB_EXT */
 #include "JVM_commons.h"
 #include "JVM_functions.h"
index fb1d233..b459484 100644 (file)
@@ -29,8 +29,9 @@
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x500
 #endif
-#include <Windows.h>
-#include <process.h>
+#define NOMINMAX
+#include <windows.h>
+#undef NOMINMAX
 
 typedef DWORD                           __threadKey;
 typedef HANDLE                          __threadId;