]> OCCT Git - occt-copy.git/commitdiff
0027197: Configuration - fix compilation issues when using mingw
authorkgv <kgv@opencascade.com>
Sat, 27 Feb 2016 23:07:27 +0000 (02:07 +0300)
committerabv <abv@opencascade.com>
Fri, 4 Mar 2016 04:31:05 +0000 (07:31 +0300)
AIS_ColorScale, AIS_Dimension - the protected method DrawText()
has been renamed to drawText() to avoid name collisions with macros.

_MSC_VER/_WIN32 misuse has been fixed in several places.
Header <malloc.h> is now included where alloca() is used.
Draw_Window - dllimport flag has been dropped from inline methods.

TKernel - mandatory dependencies Winspool.lib and Psapi.lib
are now linked explicitly (instead of msvc-specific pragma syntax).

CMake scripts - the option -std=c++0x has been replaced by -std=gnu++0x
for mingw to allow extensions (like _wfopen() and others).
The minimum Windows version has been set to _WIN32_WINNT=0x0501.
Invalid options "-z defs" and "-lm" have been dropped for mingw.
Flag --export-all-symbols has been added to CMAKE_SHARED_LINKER_FLAGS
to workaround missing vtable symbols when using mingw.
FreeType is now linked explicitly on Windows.

Draw::Load() - "lib" suffix is now prepended on mingw as well.

Drop redundant declaration of _TINT from OSD_WNT_1.hxx.
NCollection_UtfString::FromLocale() - platform-specific code has been moved to .cxx file.
Draw_BasicCommands - fixed incorrect mingw64 version macros.

genproj, cbp - added workaround for process argument list limits on Windows.
TKSTEP linkage is failing on this platform due to too long list of files.
The list of object files to link is now stored in dedicated file which is passed to gcc.

Option "-z defs" removed from CMake linker options to avoid problems when building with different configurations of VTK on Linux

Some MinGW-specific compiler warnings (potentially uninitialized vars, use of NULL, parentheses in conditional expressions) are fixed (speculatively)

69 files changed:
adm/cmake/occt_csf.cmake
adm/cmake/occt_defs_flags.cmake
adm/genproj.tcl
adm/templates/codeblocks.bat [new file with mode: 0644]
adm/templates/env.bat
src/AIS/AIS_AngleDimension.cxx
src/AIS/AIS_ColorScale.cxx
src/AIS/AIS_ColorScale.hxx
src/AIS/AIS_Dimension.cxx
src/AIS/AIS_Dimension.hxx
src/BRepAlgo/BRepAlgo_DSAccess.cxx
src/BSplCLib/BSplCLib.cxx
src/CDF/CDF_FWOSDriver.cxx
src/Dico/Dico_Dictionary.gxx
src/Draw/CommandWindow.cxx
src/Draw/Draw.cxx
src/Draw/DrawRessource.h
src/Draw/Draw_BasicCommands.cxx
src/Draw/Draw_Interpretor.cxx
src/Draw/Draw_Main.cxx
src/Draw/Draw_Window.cxx
src/Draw/Draw_Window.hxx
src/DrawTrSurf/DrawTrSurf.cxx
src/DrawTrSurf/DrawTrSurf_Point.cxx
src/FSD/FSD_File.cxx
src/HLRBRep/HLRBRep_PolyAlgo.cxx
src/IntAna/IntAna_Curve.cxx
src/MeshVS/MeshVS_MeshPrsBuilder.cxx
src/Message/Message_PrinterOStream.cxx
src/MoniTool/MoniTool_TypedValue.cxx
src/NCollection/FILES
src/NCollection/NCollection_UtfString.cxx [new file with mode: 0644]
src/NCollection/NCollection_UtfString.lxx
src/NCollection/NCollection_WinHeapAllocator.cxx
src/OSD/OSD_DirectoryIterator.cxx
src/OSD/OSD_File.cxx
src/OSD/OSD_File.hxx
src/OSD/OSD_FileIterator.cxx
src/OSD/OSD_Host.cxx
src/OSD/OSD_MemInfo.cxx
src/OSD/OSD_OpenFile.cxx
src/OSD/OSD_Path.cxx
src/OSD/OSD_Process.cxx
src/OSD/OSD_WNT_1.hxx
src/OSD/OSD_signal_WNT.cxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_ShaderObject.cxx
src/OpenGl/OpenGl_ShaderProgram.cxx
src/PCDM/PCDM_ReferenceIterator.cxx
src/QABugs/QABugs_11.cxx
src/Standard/Standard.cxx
src/Standard/Standard_Assert.hxx
src/Standard/Standard_CLocaleSentry.cxx
src/Standard/Standard_CLocaleSentry.hxx
src/Standard/Standard_CString.cxx
src/Standard/Standard_values.h
src/TCollection/TCollection_AsciiString.cxx
src/TCollection/TCollection_ExtendedString.cxx
src/TKD3DHost/EXTERNLIB
src/TKernel/EXTERNLIB
src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx
src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx
src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx
src/V3d/V3d_View_Print.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
src/WNT/WNT_WClass.cxx
src/WNT/WNT_Window.cxx
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx

index 6a6d263c6bb446d7c91dcbd0fb5ca3dd8f84f65e..08b2cf19cece1045cde02e4864646389d5833845 100644 (file)
@@ -33,9 +33,23 @@ if (WIN32)
   set (CSF_gdi32         "gdi32.lib")
   set (CSF_user32        "user32.lib")
   set (CSF_wsock32       "wsock32.lib")
+  set (CSF_winspool      "Winspool.lib")
+  set (CSF_psapi         "Psapi.lib")
   set (CSF_AviLibs       "ws2_32.lib vfw32.lib")
   set (CSF_OpenGlLibs    "opengl32.lib glu32.lib")
 
+  if (USE_FREETYPE)
+    set (CSF_FREETYPE "freetype.lib")
+  else()
+    set (CSF_FREETYPE)
+  endif()
+
+  if (USE_FREEIMAGE)
+    set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib")
+  else()
+    set (CSF_FreeImagePlus)
+  endif()
+
   if (USE_TCL)
     set (CSF_TclLibs     "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib")
     set (CSF_TclTkLibs   "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib")
index acadf4a55709aa08aeb002a5cf19891aafbf9bdc..187a41d08ed64f619f8d0f0a5fefee5704fe1b3d 100644 (file)
@@ -101,17 +101,22 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
   if (BUILD_SHARED_LIBS)
     if (APPLE)
       set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
-    else()
-      set (CMAKE_SHARED_LINKER_FLAGS "-lm -z defs ${CMAKE_SHARED_LINKER_FLAGS}")
+    elseif(NOT WIN32)
+      set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
     endif()
   else()
-    if (NOT ANDROID)
+    if (NOT ANDROID AND NOT MINGW)
       set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
     endif()
   endif()
 endif()
 
-if (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
+if(MINGW)
+  set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
+  add_definitions(-D_WIN32_WINNT=0x0501)
+  # workaround bugs in mingw with vtable export
+  set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
+elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
   set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
 endif()
 
@@ -122,4 +127,4 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
 endif()
 
 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
-set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
\ No newline at end of file
+set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
index 3f232122fe84147435d14a0438f58856420bbed3..aabb02321c8b96888a675d1839b5db47f5e79a42 100644 (file)
@@ -128,6 +128,7 @@ proc genproj { args } {
 
   # Setting default IDE.
   set anTarget ""
+  set aCmpl    "gcc"
   switch -exact -- "$targetStation" {
     "wnt"   {set anTarget "$::env(VCVER)"}
     "lin"   {set anTarget "cbp"}
@@ -215,7 +216,7 @@ proc genproj { args } {
 
   set anAdmPath "$path/adm"
 
-  OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform"
+  OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl"
 
   genprojbat "$anTarget"
 }
@@ -260,7 +261,10 @@ proc genprojbat {theIDE} {
     file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
   } else {
     switch -exact -- "$theIDE" {
-      "cbp"   { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" }
+      "cbp"   {
+        file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh"  "$::path/codeblocks.sh"
+        file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat"
+      }
       "xcd"   { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh"      "$::path/xcode.sh" }
     }
   }
@@ -279,7 +283,12 @@ set aTKNullKey "TKNull"
 set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
 
 # Entry function to generate project files and solutions for IDE
-proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
+# @param theOutDir   Root directory for project files
+# @param theIDE      IDE code name (vc10 for Visual Studio 2010, cbp for Code::Blocks, xcd for XCode)
+# @param theLibType  Library type - dynamic or static
+# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
+# @param theCmpl     Compiler option (msvc or gcc)
+proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
   global path targetStation
   set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
 
@@ -352,7 +361,7 @@ proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform "
     "vc11"   -
     "vc12"   -
     "vc14"  { OS:MKVC  $anOutDir $aModules $anAllSolution $theIDE }
-    "cbp"   { OS:MKCBP $anOutDir $aModules $anAllSolution }
+    "cbp"   { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl }
     "xcd"   {
       set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
       OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
@@ -1076,6 +1085,8 @@ proc osutils:tk:csfInExternlib { EXTERNLIB } {
   return $lret
 }
 
+# Collect dependencies map depending on target OS (libraries for CSF_ codenames used in EXTERNLIB) .
+# @param theOS         - target OS
 # @param theCsfLibsMap - libraries  map
 # @param theCsfFrmsMap - frameworks map, OS X specific
 proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
@@ -1085,60 +1096,75 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
   unset theCsfLibsMap
   unset theCsfFrmsMap
 
+  set aLibsMap(CSF_FREETYPE)  "freetype"
+  set aLibsMap(CSF_TclLibs)   "tcl8.6"
+  set aLibsMap(CSF_TclTkLibs) "tk8.6"
+  if { "$::HAVE_FREEIMAGE" == "true" } {
+    if { "$theOS" == "wnt" } {
+      set aLibsMap(CSF_FreeImagePlus) "FreeImage FreeImagePlus"
+    } else {
+      set aLibsMap(CSF_FreeImagePlus) "freeimage"
+    }
+  }
+  if { "$::HAVE_GL2PS" == "true" } {
+    set aLibsMap(CSF_GL2PS) "gl2ps"
+  }
+  if { "$::HAVE_TBB" == "true" } {
+    set aLibsMap(CSF_TBB) "tbb tbbmalloc"
+  }
+  if { "$::HAVE_VTK" == "true" } {
+    if { "$theOS" == "wnt" } {
+      set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
+    } else {
+      set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
+    }
+  }
+
   if { "$theOS" == "wnt" } {
     #  WinAPI libraries
-    set aLibsMap(CSF_kernel32)     "kernel32.lib"
-    set aLibsMap(CSF_advapi32)     "advapi32.lib"
-    set aLibsMap(CSF_gdi32)        "gdi32.lib"
-    set aLibsMap(CSF_user32)       "user32.lib"
-    set aLibsMap(CSF_opengl32)     "opengl32.lib"
-    set aLibsMap(CSF_wsock32)      "wsock32.lib"
-    set aLibsMap(CSF_netapi32)     "netapi32.lib"
-    set aLibsMap(CSF_AviLibs)      "ws2_32.lib vfw32.lib"
-    set aLibsMap(CSF_OpenGlLibs)   "opengl32.lib"
-
-    set aLibsMap(CSF_QT)           "QtCore4.lib QtGui4.lib"
-
-    # VTK
-    set aLibsMap(CSF_VTK)         [osutils:vtkCsf "wnt"]
+    set aLibsMap(CSF_kernel32)     "kernel32"
+    set aLibsMap(CSF_advapi32)     "advapi32"
+    set aLibsMap(CSF_gdi32)        "gdi32"
+    set aLibsMap(CSF_user32)       "user32 comdlg32"
+    set aLibsMap(CSF_opengl32)     "opengl32"
+    set aLibsMap(CSF_wsock32)      "wsock32"
+    set aLibsMap(CSF_netapi32)     "netapi32"
+    set aLibsMap(CSF_AviLibs)      "ws2_32 vfw32"
+    set aLibsMap(CSF_OpenGlLibs)   "opengl32"
+    set aLibsMap(CSF_winspool)     "Winspool"
+    set aLibsMap(CSF_psapi)        "Psapi"
+    set aLibsMap(CSF_d3d9)         "d3d9"
+
+    # the naming is different on Windows
+    set aLibsMap(CSF_TclLibs)      "tcl86"
+    set aLibsMap(CSF_TclTkLibs)    "tk86"
+
+    set aLibsMap(CSF_QT)           "QtCore4 QtGui4"
+
+    # tbb headers define different pragma lib depending on debug/release
+    set aLibsMap(CSF_TBB) ""
   } else {
-    set aLibsMap(CSF_FREETYPE)     "freetype"
     if { "$theOS" == "mac" } {
       set aLibsMap(CSF_objc)       "objc"
       set aFrmsMap(CSF_Appkit)     "Appkit"
       set aFrmsMap(CSF_IOKit)      "IOKit"
       set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
       set aFrmsMap(CSF_TclLibs)    "Tcl"
+      set aLibsMap(CSF_TclLibs)    ""
       set aFrmsMap(CSF_TclTkLibs)  "Tk"
+      set aLibsMap(CSF_TclTkLibs)  ""
     } else {
       if { "$theOS" == "qnx" } {
-        # CSF_ThreadLibs - pthread API is part og libc on QNX
+        # CSF_ThreadLibs - pthread API is part of libc on QNX
         set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
-        set aLibsMap(CSF_TclLibs)    "tcl8.6"
-        set aLibsMap(CSF_TclTkLibs)  "tk8.6"
       } else {
         set aLibsMap(CSF_ThreadLibs) "pthread rt"
         set aLibsMap(CSF_OpenGlLibs) "GL"
-        set aLibsMap(CSF_TclLibs)    "tcl8.6"
         set aLibsMap(CSF_TclTkLibs)  "X11 tk8.6"
         set aLibsMap(CSF_XwLibs)     "X11 Xext Xmu Xi"
         set aLibsMap(CSF_MotifLibs)  "X11"
       }
     }
-
-    # optional 3rd-parties
-    if { "$::HAVE_TBB" == "true" } {
-      set aLibsMap(CSF_TBB)        "tbb tbbmalloc"
-    }
-    if { "$::HAVE_FREEIMAGE" == "true" } {
-      set aLibsMap(CSF_FreeImagePlus)  "freeimage"
-    }
-    if { "$::HAVE_GL2PS" == "true" } {
-      set aLibsMap(CSF_GL2PS)      "gl2ps"
-    }
-    if { "$::HAVE_VTK" == "true" } {
-      set aLibsMap(CSF_VTK)         [osutils:vtkCsf "unix"]
-    }
   }
 }
 
@@ -1146,12 +1172,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
 proc osutils:vtkCsf {{theOS ""}} {
   set aVtkVer "6.1"
 
-  set aLibSuffix ""
   set aPathSplitter ":"
-  
   if {"$theOS" == "wnt"} {
     set aPathSplitter ";"
-    set aLibSuffix ".lib"
   }
 
   set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"]
@@ -1167,7 +1190,7 @@ proc osutils:vtkCsf {{theOS ""}} {
   # Additional suffices for the libraries
   set anIdx 0
   foreach anItem $aLibArray {
-    lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix
+    lset aLibArray $anIdx $anItem-$aVtkVer
     incr anIdx
   }
 
@@ -1449,24 +1472,26 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
   }
   regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
 
-  set aCommonUsedTK [list]
+  set aUsedLibs [list]
   foreach tkx [osutils:commonUsedTK  $theToolKit] {
-    lappend aCommonUsedTK "${tkx}.lib"
+    lappend aUsedLibs "${tkx}.lib"
   }
 
   osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
-  set aUsedToolKits [concat $aCommonUsedTK $aLibs]
+  foreach aLibIter $aLibs {
+    lappend aUsedLibs "${aLibIter}.lib"
+  }
 
   # correct names of referred third-party libraries that are named with suffix
   # depending on VC version
-  regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
+  regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
 
   # and put this list to project file
-  #puts "$theToolKit requires  $aUsedToolKits"
+  #puts "$theToolKit requires  $aUsedLibs"
   if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
-    set aUsedToolKits [join $aUsedToolKits {;}]
+    set aUsedLibs [join $aUsedLibs {;}]
   }
-  regsub -all -- {__TKDEP__} $theProjTmpl $aUsedToolKits theProjTmpl
+  regsub -all -- {__TKDEP__} $theProjTmpl $aUsedLibs theProjTmpl
 
   set anIncPaths "..\\..\\..\\inc"
   set aTKDefines ""
@@ -1666,23 +1691,25 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
     }
     regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
 
-    set aCommonUsedTK [list]
+    set aUsedLibs [list]
     foreach tkx [osutils:commonUsedTK  $theToolKit] {
-      lappend aCommonUsedTK "${tkx}.lib"
+      lappend aUsedLibs "${tkx}.lib"
     }
 
     osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
-    set aUsedToolKits [concat $aCommonUsedTK $aLibs]
+    foreach aLibIter $aLibs {
+      lappend aUsedLibs "${aLibIter}.lib"
+    }
 
     # correct names of referred third-party libraries that are named with suffix
     # depending on VC version
-    regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
+    regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
 
-#    puts "$aProjName requires  $aUsedToolKits"
+#    puts "$aProjName requires  $aUsedLibs"
     if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
-      set aUsedToolKits [join $aUsedToolKits {;}]
+      set aUsedLibs [join $aUsedLibs {;}]
     }
-    regsub -all -- {__TKDEP__} $aProjTmpl $aUsedToolKits aProjTmpl
+    regsub -all -- {__TKDEP__} $aProjTmpl $aUsedLibs aProjTmpl
 
     set aFilesSection ""
     set aVcFilesX(units) ""
@@ -1848,13 +1875,13 @@ proc osutils:justunix { listloc } {
 
 ####### CODEBLOCK ###################################################################
 # Function to generate Code Blocks workspace and project files
-proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
+proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } {
   puts stderr "Generating project files for Code Blocks"
 
   # Generate projects for toolkits and separate workspace for each module
   foreach aModule $theModules {
-    OS:cworkspace $aModule $aModule $theOutDir
-    OS:cbp        $aModule          $theOutDir
+    OS:cworkspace          $aModule $aModule $theOutDir
+    OS:cbp        $theCmpl $aModule          $theOutDir
   }
 
   # Generate single workspace "OCCT" containing projects from all modules
@@ -1866,30 +1893,69 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
 }
 
 # Generate Code Blocks projects
-proc OS:cbp { theModules theOutDir } {
+proc OS:cbp { theCmpl theModules theOutDir } {
   set aProjectFiles {}
   foreach aModule $theModules {
     foreach aToolKit [${aModule}:toolkits] {
-      lappend aProjectFiles [osutils:cbptk $theOutDir $aToolKit ]
+      lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ]
     }
     foreach anExecutable [OS:executable ${aModule}] {
-      lappend aProjectFiles [osutils:cbpx  $theOutDir $anExecutable]
+      lappend aProjectFiles [osutils:cbpx  $theCmpl $theOutDir $anExecutable]
     }
   }
   return $aProjectFiles
 }
 
 # Generate Code::Blocks project file for ToolKit
-proc osutils:cbptk { theOutDir theToolKit } {
-  set aUsedToolKits [list]
+proc osutils:cbptk { theCmpl theOutDir theToolKit } {
+  set aUsedLibs     [list]
   set aFrameworks   [list]
   set anIncPaths    [list]
   set aTKDefines    [list]
   set aTKSrcFiles   [list]
 
-  osutils:tkinfo "../../.." $theToolKit aUsedToolKits aFrameworks anIncPaths aTKDefines aTKSrcFiles
+  global path targetStation
+  set aWokStation "$targetStation"
+
+  # collect list of referred libraries to link with
+  osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
+  set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
+  foreach tkx $aDepToolkits {
+    lappend aUsedLibs "${tkx}"
+  }
+
+  lappend anIncPaths "../../../inc"
+  set listloc [osutils:tk:units $theToolKit]
+
+  if { [llength $listloc] == 0 } {
+    set listloc $theToolKit
+  }
+
+  if { "$aWokStation" == "wnt" } {
+    set resultloc [osutils:justwnt  $listloc]
+  } else {
+    set resultloc [osutils:justunix $listloc]
+  }
+  if [array exists written] { unset written }
+  foreach fxlo $resultloc {
+    set xlo       $fxlo
+    set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
+    foreach aSrcFile [lsort $aSrcFiles] {
+      if { ![info exists written([file tail $aSrcFile])] } {
+        set written([file tail $aSrcFile]) 1
+        lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
+      } else {
+        puts "Warning : more than one occurences for [file tail $aSrcFile]"
+      }
+    }
+
+    # macros for correct DLL exports
+    if { "$aWokStation" == "wnt" } {
+      lappend aTKDefines "__${xlo}_DLL"
+    }
+  }
 
-  return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines]
+  return [osutils:cbp $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
 }
 
 # Generates Code Blocks workspace.
@@ -1962,7 +2028,7 @@ proc OS:cworkspace { theSolName theModules theOutDir } {
 }
 
 # Generate Code::Blocks project file for Executable
-proc osutils:cbpx { theOutDir theToolKit } {
+proc osutils:cbpx { theCmpl theOutDir theToolKit } {
   global path targetStation
   set aWokStation "$targetStation"
   set aWokArch    "$::env(ARCH)"
@@ -1970,21 +2036,22 @@ proc osutils:cbpx { theOutDir theToolKit } {
   set aCbpFiles {}
   foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] {
     # collect list of referred libraries to link with
-    set aUsedToolKits [list]
+    set aUsedLibs     [list]
     set aFrameworks   [list]
     set anIncPaths    [list]
     set aTKDefines    [list]
     set aTKSrcFiles   [list]
     set aProjName [file rootname [file tail $aSrcFile]]
 
-    osutils:usedOsLibs $theToolKit "$aWokStation" aUsedToolKits aFrameworks
+    osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
+
     set aDepToolkits [LibToLinkX $theToolKit $aProjName]
     foreach tkx $aDepToolkits {
       if {[_get_type $tkx] == "t"} {
-        lappend aUsedToolKits "${tkx}"
+        lappend aUsedLibs "${tkx}"
       }
       if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} {
-        lappend aUsedToolKits "${tkx}"
+        lappend aUsedLibs "${tkx}"
       }
     }
 
@@ -1997,7 +2064,7 @@ proc osutils:cbpx { theOutDir theToolKit } {
 
     if { ![info exists written([file tail $aSrcFile])] } {
       set written([file tail $aSrcFile]) 1
-      lappend aTKSrcFiles $aSrcFile
+      lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
     } else {
       puts "Warning : in cbp there are more than one occurences for [file tail $aSrcFile]"
     }
@@ -2010,25 +2077,14 @@ proc osutils:cbpx { theOutDir theToolKit } {
     # common include paths
     lappend anIncPaths "../../../inc"
 
-    # extra macros
-    if { "$aWokStation" == "wnt" } {
-      lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
-    } else {
-      lappend aTKDefines "OCC_CONVERT_SIGNALS"
-      #lappend aTKDefines "_GNU_SOURCE=1"
-    }
-
-    lappend aCbpFiles [osutils:cbp $theOutDir $aProjName $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines $isExecutable]
+    lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
   }
 
   return $aCbpFiles
 }
 
-proc osutils:optinal_libs { } {
-  return [list tbb.lib tbbmalloc.lib FreeImage.lib FreeImagePlus.lib gl2ps.lib]
-}
-
 # This function intended to generate Code::Blocks project file
+# @param theCmpl       - the compiler (gcc or msvc)
 # @param theOutDir     - output directory to place project file
 # @param theProjName   - project name
 # @param theSrcFiles   - list of source files
@@ -2037,12 +2093,60 @@ proc osutils:optinal_libs { } {
 # @param theIncPaths   - header search paths
 # @param theDefines    - compiler macro definitions
 # @param theIsExe      - flag to indicate executable / library target
-proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
+proc osutils:cbp { theCmpl theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
   global targetStation
   set aWokStation "$targetStation"
   set aWokArch    "$::env(ARCH)"
 
-  set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
+  set aCmplCbp "gcc"
+  set aCmplFlags        [list]
+  set aCmplFlagsRelease [list]
+  set aCmplFlagsDebug   [list]
+  set toPassArgsByFile 0
+  set aLibPrefix "lib"
+  if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } {
+    set toPassArgsByFile 1
+  }
+  if { "$theCmpl" == "msvc" } {
+    set aCmplCbp "msvc8"
+    set aLibPrefix ""
+  }
+
+  if { "$theCmpl" == "msvc" } {
+    set aCmplFlags        "-arch:SSE2 -EHsc -W4 -MP"
+    set aCmplFlagsRelease "-MD  -O2"
+    set aCmplFlagsDebug   "-MDd -Od -Zi"
+    lappend aCmplFlags    "-D_CRT_SECURE_NO_WARNINGS"
+    lappend aCmplFlags    "-D_CRT_NONSTDC_NO_DEPRECATE"
+  } elseif { "$theCmpl" == "gcc" } {
+    if { "$aWokStation" != "qnx" } {
+      set aCmplFlags      "-mmmx -msse -msse2 -mfpmath=sse"
+    }
+    set aCmplFlagsRelease "-O2"
+    set aCmplFlagsDebug   "-O0 -g"
+    if { "$aWokStation" == "wnt" } {
+      lappend aCmplFlags "-std=gnu++0x"
+      lappend aCmplFlags "-D_WIN32_WINNT=0x0501"
+    } else {
+      lappend aCmplFlags "-std=c++0x"
+      lappend aCmplFlags "-fPIC"
+      lappend aCmplFlags "-DOCC_CONVERT_SIGNALS"
+    }
+    lappend aCmplFlags   "-Wall"
+    lappend aCmplFlags   "-fexceptions"
+  }
+  lappend aCmplFlagsRelease "-DNDEBUG"
+  lappend aCmplFlagsRelease "-DNo_Exception"
+  lappend aCmplFlagsDebug   "-D_DEBUG"
+  if { "$aWokStation" == "qnx" } {
+    lappend aCmplFlags "-D_QNX_SOURCE"
+  }
+
+  set aCbpFilePath    "${theOutDir}/${theProjName}.cbp"
+  set aLnkFileName    "${theProjName}_obj.link"
+  set aLnkDebFileName "${theProjName}_objd.link"
+  set aLnkFilePath    "${theOutDir}/${aLnkFileName}"
+  set aLnkDebFilePath "${theOutDir}/${aLnkDebFileName}"
   set aFile [open $aCbpFilePath "w"]
   puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
   puts $aFile "<CodeBlocks_project_file>"
@@ -2050,11 +2154,7 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
   puts $aFile "\t<Project>"
   puts $aFile "\t\t<Option title=\"$theProjName\" />"
   puts $aFile "\t\t<Option pch_mode=\"2\" />"
-  if { "$aWokStation" == "wnt" } {
-    puts $aFile "\t\t<Option compiler=\"msvc8\" />"
-  } else {
-    puts $aFile "\t\t<Option compiler=\"gcc\" />"
-  }
+  puts $aFile "\t\t<Option compiler=\"$aCmplCbp\" />"
   puts $aFile "\t\t<Build>"
 
   # Release target configuration
@@ -2064,55 +2164,40 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
     puts $aFile "\t\t\t\t<Option type=\"1\" />"
   } else {
     if { "$aWokStation" == "wnt" } {
-      puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+      puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
     } else {
       puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
     }
     puts $aFile "\t\t\t\t<Option type=\"3\" />"
   }
   puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />"
+  puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
+  puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
   if { "$aWokStation" == "wnt" } {
-    puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
+    puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
   } else {
-    puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
+    puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
   }
-  puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
-  puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
 
   # compiler options per TARGET (including defines)
   puts $aFile "\t\t\t\t<Compiler>"
-  if { "$aWokStation" == "wnt" } {
-    puts $aFile "\t\t\t\t\t<Add option=\"-MD\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
-  } else {
-    puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
-    if { "$aWokStation" != "qnx" } {
-      puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
-    }
+  foreach aFlagIter $aCmplFlagsRelease {
+    puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
   }
   foreach aMacro $theDefines {
     puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
   }
-  puts $aFile "\t\t\t\t\t<Add option=\"-DNDEBUG\" />"
-  if { "$aWokStation" == "qnx" } {
-    puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
-  }
-  puts $aFile "\t\t\t\t\t<Add option=\"-DNo_Exception\" />"
-
   puts $aFile "\t\t\t\t</Compiler>"
 
   puts $aFile "\t\t\t\t<Linker>"
+  if { $toPassArgsByFile == 1 } {
+    puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
+  }
   puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/lib\" />"
-  if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
-    puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+  if { "$aWokStation" == "mac" } {
+    if { [ lsearch $theLibsList X11 ] >= 0} {
+      puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+    }
   }
   puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
   puts $aFile "\t\t\t\t</Linker>"
@@ -2126,56 +2211,40 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
     puts $aFile "\t\t\t\t<Option type=\"1\" />"
   } else {
     if { "$aWokStation" == "wnt" } {
-      puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+      puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
     } else {
       puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
     }
     puts $aFile "\t\t\t\t<Option type=\"3\" />"
   }
   puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />"
+  puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
+  puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
   if { "$aWokStation" == "wnt" } {
-    puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
+    puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
   } else {
-    puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
+    puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
   }
-  puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
-  puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
 
   # compiler options per TARGET (including defines)
   puts $aFile "\t\t\t\t<Compiler>"
-  if { "$aWokStation" == "wnt" } {
-    puts $aFile "\t\t\t\t\t<Add option=\"-MDd\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-Od\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-Zi\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
-  } else {
-    puts $aFile "\t\t\t\t\t<Add option=\"-O0\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
-    puts $aFile "\t\t\t\t\t<Add option=\"-g\" />"
-    if { "$aWokStation" != "qnx" } {
-      puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
-      puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
-    }
+  foreach aFlagIter $aCmplFlagsDebug {
+    puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
   }
   foreach aMacro $theDefines {
     puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
   }
-  puts $aFile "\t\t\t\t\t<Add option=\"-D_DEBUG\" />"
-  if { "$aWokStation" == "qnx" } {
-    puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
-  }
-  puts $aFile "\t\t\t\t\t<Add option=\"-DDEB\" />"
   puts $aFile "\t\t\t\t</Compiler>"
 
   puts $aFile "\t\t\t\t<Linker>"
+  if { $toPassArgsByFile == 1 } {
+    puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
+  }
   puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/libd\" />"
-  if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
-    puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+  if { "$aWokStation" == "mac" } {
+    if { [ lsearch $theLibsList X11 ] >= 0} {
+      puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+    }
   }
   puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
   puts $aFile "\t\t\t\t</Linker>"
@@ -2186,9 +2255,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
 
   # COMMON compiler options
   puts $aFile "\t\t<Compiler>"
-  puts $aFile "\t\t\t<Add option=\"-Wall\" />"
-  puts $aFile "\t\t\t<Add option=\"-fexceptions\" />"
-  puts $aFile "\t\t\t<Add option=\"-fPIC\" />"
+  foreach aFlagIter $aCmplFlags {
+    puts $aFile "\t\t\t<Add option=\"$aFlagIter\" />"
+  }
   puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />"
   foreach anIncPath $theIncPaths {
     puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />"
@@ -2197,6 +2266,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
 
   # COMMON linker options
   puts $aFile "\t\t<Linker>"
+  if { "$aWokStation" == "wnt" && "$theCmpl" == "gcc" } {
+    puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
+  }
   foreach aFrameworkName $theFrameworks {
     if { "$aFrameworkName" != "" } {
       puts $aFile "\t\t\t<Add option=\"-framework $aFrameworkName\" />"
@@ -2204,12 +2276,25 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
   }
   foreach aLibName $theLibsList {
     if { "$aLibName" != "" } {
-      puts $aFile "\t\t\t<Add library=\"$aLibName\" />"
+      if { "$theCmpl" == "msvc" } {
+        puts $aFile "\t\t\t<Add library=\"${aLibName}.lib\" />"
+      } else {
+        puts $aFile "\t\t\t<Add library=\"${aLibName}\" />"
+      }
     }
   }
   puts $aFile "\t\t</Linker>"
 
   # list of sources
+
+  set aFileLnkObj ""
+  set aFileLnkObjd ""
+  set isFirstSrcFile 1
+  if { $toPassArgsByFile == 1 } {
+    set aFileLnkObj  [open $aLnkFilePath    "w"]
+    set aFileLnkObjd [open $aLnkDebFilePath "w"]
+  }
+
   foreach aSrcFile $theSrcFiles {
     if {[string equal -nocase [file extension $aSrcFile] ".mm"]} {
       puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
@@ -2220,11 +2305,28 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
       puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
       puts $aFile "\t\t\t<Option compilerVar=\"CC\" />"
       puts $aFile "\t\t</Unit>"
+    } elseif { $toPassArgsByFile == 1 && $isFirstSrcFile == 0 && [string equal -nocase [file extension $aSrcFile] ".cxx" ] } {
+      # pass at list single source file to Code::Blocks as is
+      # and pack the list of other files into the dedicated file to workaround process arguments limits on systems like Windows
+      puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
+      puts $aFile "\t\t\t<Option link=\"0\" />"
+      puts $aFile "\t\t</Unit>"
+
+      set aFileObj  [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/obj/src/"]  $aSrcFile]]
+      set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/objd/src/"] $aSrcFile]]
+      puts -nonewline $aFileLnkObj  "$aFileObj "
+      puts -nonewline $aFileLnkObjd "$aFileObjd "
     } else {
       puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />"
+      set isFirstSrcFile 0
     }
   }
 
+  if { "$aWokStation" == "wnt" } {
+    close $aFileLnkObj
+    close $aFileLnkObjd
+  }
+
   puts $aFile "\t</Project>"
   puts $aFile "</CodeBlocks_project_file>"
   close $aFile
@@ -2232,74 +2334,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
   return $aCbpFilePath
 }
 
-# Auxiliary function to achieve complete information to build Toolkit
-# @param theRelativePath - relative path to CASROOT
-# @param theToolKit      - Toolkit name
-# @param theUsedLib      - dependencies (libraries  list)
-# @param theFrameworks   - dependencies (frameworks list, Mac OS X specific)
-# @param theIncPaths     - header search paths
-# @param theTKDefines    - compiler macro definitions
-# @param theTKSrcFiles   - list of source files
-proc osutils:tkinfo { theRelativePath theToolKit theUsedLib theFrameworks theIncPaths theTKDefines theTKSrcFiles } {
-  global path targetStation
-  set aWokStation "$targetStation"
-
-  # collect list of referred libraries to link with
-  upvar $theUsedLib    aUsedLibs
-  upvar $theFrameworks aFrameworks
-  upvar $theIncPaths   anIncPaths
-  upvar $theTKDefines  aTKDefines
-  upvar $theTKSrcFiles aTKSrcFiles
-
-  osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
-  set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
-  foreach tkx $aDepToolkits {
-    lappend aUsedLibs "${tkx}"
-  }
-
-  lappend anIncPaths "$theRelativePath/inc"
-  set listloc [osutils:tk:units $theToolKit]
-
-  if { [llength $listloc] == 0 } {
-    set listloc $theToolKit
-  }
-
-  if { "$aWokStation" == "wnt" } {
-    set resultloc [osutils:justwnt  $listloc]
-  } else {
-    set resultloc [osutils:justunix $listloc]
-  }
-  if [array exists written] { unset written }
-  foreach fxlo $resultloc {
-    set xlo       $fxlo
-    set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
-    foreach aSrcFile [lsort $aSrcFiles] {
-      if { ![info exists written([file tail $aSrcFile])] } {
-        set written([file tail $aSrcFile]) 1
-        lappend aTKSrcFiles "${theRelativePath}/[wokUtils:FILES:wtail $aSrcFile 3]"
-      } else {
-        puts "Warning : more than one occurences for [file tail $aSrcFile]"
-      }
-    }
-
-    # macros for correct DLL exports
-    if { "$aWokStation" == "wnt" } {
-      lappend aTKDefines "__${xlo}_DLL"
-    }
-
-    # common include paths
-#    lappend anIncPaths "${theRelativePath}/src/${xlo}"
-  }
-
-  # extra macros
-  if { "$aWokStation" == "wnt" } {
-    lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
-  } else {
-    lappend aTKDefines "OCC_CONVERT_SIGNALS"
-    #lappend aTKDefines "_GNU_SOURCE=1"
-  }
-}
-
 # Define libraries to link using only EXTERNLIB file
 proc LibToLinkX {thePackage theDummyName} {
   set aToolKits [LibToLink $thePackage]
@@ -2431,7 +2465,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
   upvar $theDepsRefGuids     aDepsRefGuids
 
   set aBuildFileSection ""
-  set aUsedToolKits     [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
+  set aUsedLibs         [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
   set aDepToolkits      [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
 
   if { "$theTargetType" == "executable" } {
@@ -2449,9 +2483,9 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
   }
 
   osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
-  set aUsedToolKits [concat $aUsedToolKits $aLibs]
-  set aUsedToolKits [concat $aUsedToolKits $aFrameworks]
-  foreach tkx $aUsedToolKits {
+  set aUsedLibs [concat $aUsedLibs $aLibs]
+  set aUsedLibs [concat $aUsedLibs $aFrameworks]
+  foreach tkx $aUsedLibs {
     set aDepLib    "${tkx}_Dep"
     set aDepLibRef "${tkx}_DepRef"
 
diff --git a/adm/templates/codeblocks.bat b/adm/templates/codeblocks.bat
new file mode 100644 (file)
index 0000000..f70d479
--- /dev/null
@@ -0,0 +1,19 @@
+@echo off
+
+rem Setup environment
+call "%~dp0env.bat" %1 %2 %3
+
+rem Define path to project file
+set "PRJFILE=%~dp0\adm\wnt\cbp\OCCT.workspace"
+if not exist "%PRJFILE%" set "PRJFILE=%~dp0\adm\wnt\cbp\Products.workspace"
+if not "%4" == "" (
+  set "PRJFILE=%4"
+)
+
+if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe"
+if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe"
+
+set "CASBIN=wnt\cbp"
+set "PATH=%~dp0%CASBIN%\bin%CASDEB%;%PATH%"
+
+start "" "%CB_PATH%" "%PRJFILE%"
index 38dd5aee92bf0c8995138375d7e4e7fcaf99eb7d..db1c722f43316eecd60ba1716e2aa5783f05af94 100644 (file)
@@ -160,9 +160,13 @@ set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
 goto :eof
 
 :concatLib32
-set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
+rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
+rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
+set "OPT_LIB32=%OPT_LIB32% -L%1"
 goto :eof
 
 :concatLib64
-set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
+rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
+rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
+set "OPT_LIB64=%OPT_LIB64% -L%1"
 goto :eof
index d2d30fa324289d02b3d86cbfa7b4b92515d5ace7..c7a2be3e063e3c88c68639edc3b07c256ffac3c2 100644 (file)
@@ -451,7 +451,7 @@ void AIS_AngleDimension::DrawArcWithText (const Handle(Prs3d_Presentation)& theP
     gp_Dir aTextDir = gce_MakeDir (theFirstAttach, theSecondAttach);
 
     // Drawing text
-    DrawText (thePresentation,
+    drawText (thePresentation,
               aTextPos,
               aTextDir,
               theText,
@@ -696,7 +696,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
                                                 : GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
         gp_Dir aTextDir = aDimensionDir;
 
-        DrawText (thePresentation,
+        drawText (thePresentation,
                   aTextPos,
                   aTextDir,
                   aLabelString,
index 65042bb4eca46e48cfda928cbe6272a9c28c1526..4648f0a574ce515a790462d520dffe659d1d39ab 100644 (file)
@@ -556,7 +556,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
   if (aTitle.Length())
   {
     aTitleHeight += myTextHeight + aSpacer;
-    DrawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor);
+    drawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor);
   }
 
   Standard_Boolean toReverse = IsReversed();
@@ -637,7 +637,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
   aGroup->AddPrimitiveArray (aPrim);
 
   if (aStep > 0)
-    DrawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor);
+    drawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor);
 
   // Draw Labels
   anOffset = 1.0 * Abs (aLabCount - aNum - 1) * ( aStep - aTextHeight ) / 2 + 1.0 * Abs (aLabCount - aNum - 1) * aTextHeight / 2;
@@ -666,12 +666,12 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
       Standard_Integer aPos2 = aLabCount - 1 - i2;
       if (aFilter && !( aPos1 % aFilter ))
       {
-        DrawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor);
+        drawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor);
         aLast1 = i1;
       }
       if (aFilter && !( aPos2 % aFilter ))
       {
-        DrawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor);
+        drawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor);
         aLast2 = i2;
       }
       i1++;
@@ -687,15 +687,15 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
     }
 
     if (i0 != -1)
-      DrawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor);
+      drawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor);
   }
 }
 
 //=======================================================================
-//function : DrawFrame
+//function : drawFrame
 //purpose  :
 //=======================================================================
-void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_ColorScale::drawFrame (const Handle(Prs3d_Presentation)& thePresentation,
                        const Standard_Integer theX, const Standard_Integer theY,
                        const Standard_Integer theWidth, const Standard_Integer theHeight,
                        const Quantity_Color& theColor)
@@ -715,10 +715,10 @@ void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentatio
 }
 
 //=======================================================================
-//function : DrawText
+//function : drawText
 //purpose  :
 //=======================================================================
-void AIS_ColorScale::DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_ColorScale::drawText (const Handle(Prs3d_Presentation)& thePresentation,
                   const TCollection_ExtendedString& theText,
                   const Standard_Integer theX, const Standard_Integer theY,
                   const Quantity_Color& theColor)
index 29767141846fa814dc9f3b86c3e5dbf47f2785ef..7f352434dec742c1cde9f67274c34d9510511595 100644 (file)
@@ -232,7 +232,7 @@ protected:
   //! @param theWidth [in] the width of frame.
   //! @param theHeight [in] the height of frame.
   //! @param theColor [in] the color of frame.
-  Standard_EXPORT void DrawFrame (const Handle(Prs3d_Presentation)& thePresentation,
+  Standard_EXPORT void drawFrame (const Handle(Prs3d_Presentation)& thePresentation,
                        const Standard_Integer theX, const Standard_Integer theY,
                        const Standard_Integer theWidth, const Standard_Integer theHeight,
                        const Quantity_Color& theColor);
@@ -242,7 +242,7 @@ protected:
   //! @param theX [in] the X coordinate of text position.
   //! @param theY [in] the Y coordinate of text position.
   //! @param theColor [in] the color of text.
-  Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+  Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
                   const TCollection_ExtendedString& theText,
                   const Standard_Integer theX, const Standard_Integer theY,
                   const Quantity_Color& theColor);
index 1aba01e8f356e7da1afdcec286c304bfe9757040..fd6f5f4a547ed8ab77fb78972e2fe2b84f62a30c 100755 (executable)
@@ -393,10 +393,10 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
 }
 
 //=======================================================================
-//function : DrawText
-//purpose  : 
+//function : drawText
+//purpose  :
 //=======================================================================
-void AIS_Dimension::DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
                               const gp_Pnt& theTextPos,
                               const gp_Dir& theTextDir,
                               const TCollection_ExtendedString& theText,
@@ -572,7 +572,7 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
     gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
     gp_Dir aTextDir = theExtensionDir;
 
-    DrawText (thePresentation,
+    drawText (thePresentation,
               aTextPos,
               aTextDir,
               theLabelString,
@@ -727,7 +727,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
       // add text primitives
       if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
       {
-        DrawText (thePresentation,
+        drawText (thePresentation,
                   aTextPos,
                   aTextDir,
                   aLabelString,
index bc70fc43ccf024e3a12a22fce4204f7a9f93d5a3..55eb6ddfcaa244f971447f368d70574629c9beea 100755 (executable)
@@ -403,7 +403,7 @@ protected:
   //! @param theLabelPosition [in] the text label vertical and horizontal positioning option
   //! respectively to the main dimension line. 
   //! @return text width relative to the dimension working plane. For 2d text this value will be zero.
-  Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+  Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
                                  const gp_Pnt& theTextPos,
                                  const gp_Dir& theTextDir,
                                  const TCollection_ExtendedString& theText,
index ae103e3ac42d84de8ad258fe866c1bf4ccfd184c..1440ccbf9ed707c0de4610c0a7813093c609d716 100644 (file)
@@ -1456,6 +1456,9 @@ void BRepAlgo_DSAccess::PntVtxOnSectEdge
  Standard_Integer& ipv2,
  TopOpeBRepDS_Kind& pvk2)
 {
+  ipv1 = ipv2 = 0;
+  pvk1 = pvk2 = TopOpeBRepDS_UNKNOWN;
+
 //  myHB->ChangeBuilder();
   TopOpeBRepDS_DataStructure& DS = myHDS->ChangeDS();
   TopOpeBRepDS_Kind kind = TopOpeBRepDS_POINT;
index 6d3a574ed839aca07eba916ca58d630182b3ecfe..e4ab7f58706432d3866d9ac83e97ec126156ef12 100644 (file)
@@ -2806,7 +2806,7 @@ void BSplCLib::Trimming(const Standard_Integer         Degree,
                              TColStd_Array1OfInteger& NewMults,
                              TColStd_Array1OfReal&    NewPoles)
 {
-  Standard_Integer i, nbpoles, nbknots;
+  Standard_Integer i, nbpoles=0, nbknots=0;
   Standard_Real kk[2];
   Standard_Integer mm[2];
   TColStd_Array1OfReal    K( kk[0], 1, 2 );
index 99337493e91c166df102562523323ae2504a4b73..2c4f95e533bc925cae764d04c46448b99bcc3470 100644 (file)
@@ -173,7 +173,7 @@ TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder()
     
 #ifdef _WIN32
     TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE");
-    if(hd.Length() != NULL) {
+    if(hd.Length() != 0) {
       theDefaultFolder=hd;
       theDefaultFolder+=UTL::xgetenv("HOMEPATH");
     }
index 4878e279b8f09d6602ab7d54c255707e511c0204..b50f0beb51fa59239e13b48eeaab19cd73ff2b39 100644 (file)
@@ -376,7 +376,7 @@ Dico_Dictionary::Dico_Dictionary ()
       else                      {  stat = stat2;  reslev = lev2;  return;  }
     }
   }
-  else if (car < thecars[0])    {  acell = this;  stat   = -1;    return;  }
+  else /*if (car < thecars[0])*/{  acell = this;  stat   = -1;    return;  }
 }
 
 
index 420279139a8d0457f1312e44608430a354382fc2..52f2f91a136af02e8e0d726404690f730a623ac9 100644 (file)
@@ -193,7 +193,7 @@ LRESULT APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
 {
   char buffer[COMMANDSIZE];    
        POINT pos;
-       BOOL rep;
+       BOOL rep = 0;
        static LRESULT nbline; // Process the buffer of the edit window 
   LRESULT index;
 
index f859e9b6ab130ca876c2a5bee5ac4708faf08ff1..7394dc8f43dc1be6c2ad8471bf118b20fed1a242 100644 (file)
@@ -491,7 +491,7 @@ void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey,
     }
 
     TCollection_AsciiString aPluginLibrary("");
-#ifndef _WIN32
+#if !defined(_WIN32) || defined(__MINGW32__)
     aPluginLibrary += "lib";
 #endif
     aPluginLibrary +=  aPluginResource->Value(theKey.ToCString());
index 0b542ee2d9dbdd91f8aed55379df833de05ba952..eb751f0383fbaf401509b09bd6aae4c9a5c3a3c2 100644 (file)
@@ -14,7 +14,7 @@
  commercial license or contractual agreement.
 */
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 
 //{{NO_DEPENDENCIES}}
 // Microsoft Developer Studio generated include file.
index 3460a6df0eff99d9abc6b3d9dec6fcadc5ff62b5..0fda933618cc69100ddf50acff11ee5c318e5605 100644 (file)
@@ -334,7 +334,7 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
   di << "Cygwin\n";
 #endif
 #if defined(__MINGW64__)
-  di << "MinGW 64 " << __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION << "\n";
+  di << "MinGW 64 " << __MINGW64_VERSION_MAJOR << "." << __MINGW64_VERSION_MINOR << "\n";
 #elif defined(__MINGW32__)
   di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n";
 #endif 
index bffe2fbef9f2510a965bb6b863a3dbfe684709e5..b350be731ee0184df18ad2eadd06c8ecedb478b8 100644 (file)
@@ -35,7 +35,7 @@
 #endif
 
 // for capturing of cout and cerr (dup(), dup2())
-#ifdef _MSC_VER
+#ifdef _WIN32
 #include <io.h>
 #endif
 
@@ -86,8 +86,13 @@ namespace {
       return;
 
     // restore normal descriptors of console stream
+  #ifdef _WIN32
+    _dup2(save_fd, std_fd);
+    _close(save_fd);
+  #else
     dup2(save_fd, std_fd);
     close(save_fd);
+  #endif
 
     // extract all output and copy it to log and optionally to cout
     const int BUFSIZE = 2048;
index 66b51684da2a839fd865cb8bd5ec46e917cd7dbd..c33a54f77a191c2d0ca61b45d2a4a09db7ff3443 100644 (file)
 
 extern Draw_Viewer dout;
 
-static char* ColorNames[MAXCOLOR] = {
-  "White","Red","Green","Blue","Cyan","Gold","Magenta",
-  "Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral"
-  };
-
-static   Standard_Boolean XLoop;
-
 // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
 Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
 // true if complete command
index 918465da8d48969e35d16f9ee18a7c16560517a5..1948e0aca62c01ef9c4e41ed8dfe8ee2bc343540 100644 (file)
@@ -1430,7 +1430,7 @@ DrawWindow::DrawWindow() :
 }
 
 //________________________
-DrawWindow::DrawWindow(char* title,
+DrawWindow::DrawWindow(const char* title,
                        Standard_Integer X, Standard_Integer Y,
                        Standard_Integer dX,Standard_Integer dY) :
        win(0),        next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False)
@@ -1440,7 +1440,7 @@ DrawWindow::DrawWindow(char* title,
   Init(X, Y, dX, dY);
   SetTitle(title);
 }
-DrawWindow::DrawWindow(char* title,
+DrawWindow::DrawWindow(const char* title,
                        Standard_Integer X, Standard_Integer Y,
                        Standard_Integer dX,Standard_Integer dY,
                        HWND theWin) :
@@ -1657,7 +1657,7 @@ Standard_Integer DrawWindow::WidthWin() const
 /*--------------------------------------------------------*\
 |  SetTitle
 \*--------------------------------------------------------*/
-void DrawWindow::SetTitle(char* title)
+void DrawWindow::SetTitle(const char* title)
 {
   SetWindowText(win, title);
 }
index 2f1655ada4d60acca7e4d961ef666eff670d0a4b..6bab4708387d350013dda436e112d3df792c822c 100644 (file)
@@ -417,12 +417,12 @@ public:
   Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB);
 
   __Draw_API DrawWindow();
-  __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
+  __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
                        Standard_Integer, Standard_Integer);
-  __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
+  __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
                        Standard_Integer, Standard_Integer, HWND);
   //destructeur
-  __Draw_API ~DrawWindow();
+  __Draw_API virtual ~DrawWindow();
 
   //methods
 public:
@@ -432,7 +432,7 @@ public:
   __Draw_API void SetUseBuffer(Standard_Boolean);
   // Turns on/off usage of off-screen image buffer (can be used for redrawing optimization)
 
-  __Draw_API Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
+  Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
   // Returns Standard_True if off-screen image buffer is being used
 
   //taille et position
@@ -443,7 +443,7 @@ public:
   __Draw_API Standard_Integer WidthWin()  const;
 
   //Title
-  __Draw_API void SetTitle(char*);
+  __Draw_API void SetTitle(const char*);
   __Draw_API char* GetTitle();
 
   //Affichage
@@ -451,7 +451,7 @@ public:
   __Draw_API void Hide();
   __Draw_API void Destroy();
   __Draw_API void Clear();
-  __Draw_API static void Flush() {} ;
+  static void Flush() {} ;
 
   // save snapshot
   __Draw_API Standard_Boolean Save(const char* theFileName) const;
index 57cdc5ef1778084cee458c2c0ff933d719343b07..adba8f4511198c09e6bbd2c1ba7ad2a7905abb19 100644 (file)
@@ -1741,7 +1741,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
 {
   Handle(DrawTrSurf_Point) 
     N = Handle(DrawTrSurf_Point)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   ios::fmtflags F = OS.flags();
   OS.setf(ios::scientific,ios::floatfield);
   OS.precision(15);
@@ -1758,7 +1758,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
     OS << "0 ";
     OS << P.X() << " " << P.Y() << "\n";
   }
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   OS.setf(F);
 #else
   OS.setf(form);
@@ -1803,7 +1803,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS)
 {
   Handle(DrawTrSurf_Triangulation) 
     T = Handle(DrawTrSurf_Triangulation)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   ios::fmtflags F = OS.flags();
   OS.setf(ios::scientific,ios::floatfield);
   OS.precision(15);
@@ -1812,7 +1812,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS)
   std::streamsize prec = OS.precision(15);
 #endif
   Poly::Write(T->Triangulation(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   OS.setf(F);
 #else
   OS.setf(form);
@@ -1844,7 +1844,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
 {
   Handle(DrawTrSurf_Polygon3D) 
     T = Handle(DrawTrSurf_Polygon3D)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   ios::fmtflags F = OS.flags();
   OS.setf(ios::scientific,ios::floatfield);
   OS.precision(15);
@@ -1853,7 +1853,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
   std::streamsize prec = OS.precision(15);
 #endif
   Poly::Write(T->Polygon3D(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   OS.setf(F);
 #else
   OS.setf(form);
@@ -1884,7 +1884,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
 {
   Handle(DrawTrSurf_Polygon2D) 
     T = Handle(DrawTrSurf_Polygon2D)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   ios::fmtflags F = OS.flags();
   OS.setf(ios::scientific, ios::floatfield);
   OS.precision(15);
@@ -1893,7 +1893,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
   std::streamsize prec = OS.precision(15);
 #endif
   Poly::Write(T->Polygon2D(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   OS.setf(F);
 #else
   OS.setf(form);
index a43fb75e6e6bafacd14f8d387aabbab92585ee2f..53a78553bf4aabf49c8dd8fdc96324f06081f585 100644 (file)
@@ -184,7 +184,7 @@ Handle(Draw_Drawable3D) DrawTrSurf_Point::Copy() const
 
 void DrawTrSurf_Point::Dump(Standard_OStream& S) const 
 {
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   ios::fmtflags F = S.flags();
   S.setf(ios::scientific,ios::floatfield);
   S.precision(15);
@@ -196,7 +196,7 @@ void DrawTrSurf_Point::Dump(Standard_OStream& S) const
     S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<endl;
   else
     S << "Point 2d : " << myPoint.X() << ", " << myPoint.Y() <<endl;
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
   S.setf(F);
 #else
   S.setf(form);
index 79bddfa65852ad4d6919c2d814652a503eaa4c75..e5f17857c80ebffdc15ed9da2c0fcb4d62423dd1 100644 (file)
@@ -81,7 +81,7 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
 
   if (OpenMode() == Storage_VSNone) {
 
-#ifdef _WIN32
+#if defined(_MSC_VER)
     TCollection_ExtendedString aWName(aName);
     if (aMode == Storage_VSRead) {
       myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in); // ios::nocreate is not portable
index 8e607400024f868d0eea1075caded069cbe8873e..0ea6fea7ca13b9161b8b63e394253291a382ba62 100644 (file)
@@ -1836,6 +1836,7 @@ Interpolation (const Standard_Real U1,
     TMultiply(X3,Y3,Z3);
     return Standard_True;
   }
+  X3 = Y3 = Z3 = XTI3 = YTI3 = ZTI3 = coef3 = U3 = 0.;
   return Standard_False;
 }
 
index fed0c9522668c9097bc09cd6d92783be96ee5bf6..12e3baaf465d71f648b0cd5c745ddbac3bcd4e3f 100644 (file)
   if((Theta<DomainInf)  ||  
      ((Theta>DomainSup) && (!TwoCurves)) ||  
      (Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
+    SigneSqrtDis = 0.;
     Standard_DomainError::Raise("IntAna_Curve::Domain");
   }
   
index 54a8e66288df27f64c8f3fb981764191ac79f324..1253884018a5f2ce903e1455d406ddae298b0d8d 100644 (file)
 #include <TColStd_PackedMapOfInteger.hxx>
 #include <TColStd_SequenceOfInteger.hxx>
 
+#ifdef _WIN32
+  #include <malloc.h> // for alloca()
+#endif
+
 IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
 
 //================================================================
index 36be8fe28f271f5321bc2ebf975bcbe06cc921c2..d77e5039789ee6ec4fd1fea50e72ac450332a1d8 100644 (file)
@@ -24,7 +24,7 @@
 
 IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer)
 
-#ifndef _WIN32
+#if !defined(_MSC_VER)
   #include <strings.h>
 #endif
 
index d08f5ef6fa329bb0ddfbc9b5f620d38fd3a74e9a..0b8f5c2d1fcde983979b57980bb0023c5f5f3f2b 100644 (file)
@@ -181,7 +181,8 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
       break;
     case MoniTool_ValueEnum    : {
       def.AssignCat("Enum");
-      Standard_Integer startcase, endcase; Standard_Boolean match;
+      Standard_Integer startcase=0, endcase=0;
+      Standard_Boolean match=0;
       EnumDef (startcase,endcase,match);
       Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase);
       def.AssignCat(mess);
index 07f9554296a44e6bffa03a9d9e9224ff692e2fb1..2d2def7b5e230e5fd98db63f3ce34d9192971902 100755 (executable)
@@ -69,6 +69,7 @@ NCollection_UtfIterator.hxx
 NCollection_UtfIterator.lxx
 NCollection_UtfString.hxx
 NCollection_UtfString.lxx
+NCollection_UtfString.cxx
 NCollection_Vec2.hxx
 NCollection_Vec3.hxx
 NCollection_Vec4.hxx
diff --git a/src/NCollection/NCollection_UtfString.cxx b/src/NCollection/NCollection_UtfString.cxx
new file mode 100644 (file)
index 0000000..8d845b0
--- /dev/null
@@ -0,0 +1,89 @@
+// Created on: 2016-02-23
+// Created by: Kirill Gavrilov
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#if defined(_WIN32)
+  #include <windows.h>
+#endif
+
+#include <NCollection_UtfString.hxx>
+
+//=======================================================================
+//function : ~NCollection_UtfStringTool
+//purpose  :
+//=======================================================================
+NCollection_UtfStringTool::~NCollection_UtfStringTool()
+{
+  delete[] myWideBuffer;
+}
+
+//=======================================================================
+//function : FromLocale()
+//purpose  :
+//=======================================================================
+wchar_t* NCollection_UtfStringTool::FromLocale (const char* theString)
+{
+  if (myWideBuffer != NULL)
+  {
+    delete[] myWideBuffer;
+    myWideBuffer = NULL;
+  }
+
+#if defined(_WIN32)
+  // use WinAPI
+  int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0);
+  if (aWideSize <= 0)
+  {
+    return NULL;
+  }
+
+  myWideBuffer = new wchar_t[aWideSize + 1];
+  MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, myWideBuffer, aWideSize);
+  myWideBuffer[aWideSize] = L'\0';
+#else
+  // this is size in bytes but should probably be enough to store string in wide chars
+  // notice that these functions are sensitive to locale set by application!
+  int aMbLen = mblen (theString, MB_CUR_MAX);
+  if (aMbLen <= 0)
+  {
+    return NULL;
+  }
+
+  myWideBuffer = new wchar_t[aMbLen + 1];
+  mbstowcs (myWideBuffer, theString, aMbLen);
+  myWideBuffer[aMbLen] = L'\0';
+#endif
+  return myWideBuffer;
+}
+
+//=======================================================================
+//function : ToLocale()
+//purpose  :
+//=======================================================================
+bool NCollection_UtfStringTool::ToLocale (const wchar_t*         theWideString,
+                                          char*                  theBuffer,
+                                          const Standard_Integer theSizeBytes)
+{
+#if defined(_WIN32)
+  int aMbBytes = WideCharToMultiByte (CP_ACP, 0, theWideString, -1, theBuffer, theSizeBytes, NULL, NULL);
+#else
+  std::size_t aMbBytes = std::wcstombs (theBuffer, theWideString, theSizeBytes);
+#endif
+  if (aMbBytes <= 0)
+  {
+    *theBuffer = '\0';
+    return false;
+  }
+  return true;
+}
index 011ccffc8849f7cb36c09f9f30f72aeace487236..c11070040bfbebf3334dcd870a459d7c3cbaf729 100755 (executable)
@@ -272,6 +272,28 @@ void NCollection_UtfString<Type>::FromUnicode (const TypeFrom*        theStringU
   strFree (anOldBuffer);
 }
 
+//! Auxiliary convertion tool.
+class NCollection_UtfStringTool
+{
+public:
+  //! Empty constructor.
+  NCollection_UtfStringTool() : myWideBuffer (NULL) {}
+
+  //! Destructor for temporary resources.
+  Standard_EXPORT ~NCollection_UtfStringTool();
+
+  //! Convert the string from current locale into UNICODE (wide characters) using system APIs.
+  //! Returned pointer will be released by this tool.
+  Standard_EXPORT wchar_t* FromLocale (const char* theString);
+
+  //! Convert the UNICODE (wide characters) string into locale using system APIs.
+  Standard_EXPORT static bool ToLocale (const wchar_t*         theWideString,
+                                        char*                  theBuffer,
+                                        const Standard_Integer theSizeBytes);
+private:
+  wchar_t* myWideBuffer; //!< temporary variable
+};
+
 // =======================================================================
 // function : FromLocale
 // purpose  :
@@ -280,34 +302,14 @@ template<typename Type> inline
 void NCollection_UtfString<Type>::FromLocale (const char*            theString,
                                               const Standard_Integer theLength)
 {
-#if(defined(_WIN32) || defined(__WIN32__))
-  // use WinAPI
-  int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0);
-  if (aWideSize <= 0)
-  {
-    Clear();
-    return;
-  }
-  wchar_t* aWideBuffer = new wchar_t[aWideSize + 1];
-  MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, aWideBuffer, aWideSize);
-  aWideBuffer[aWideSize] = L'\0';
-  FromUnicode (aWideBuffer, theLength);
-  delete[] aWideBuffer;
-#else
-  // this is size in bytes but should probably be enough to store string in wide chars
-  // notice that these functions are sensitive to locale set by application!
-  int aMbLen = mblen (theString, MB_CUR_MAX);
-  if (aMbLen <= 0)
+  NCollection_UtfStringTool aConvertor;
+  wchar_t* aWideBuffer = aConvertor.FromLocale (theString);
+  if (aWideBuffer == NULL)
   {
     Clear();
     return;
   }
-  wchar_t* aWideBuffer = new wchar_t[aMbLen + 1];
-  mbstowcs (aWideBuffer, theString, aMbLen);
-  aWideBuffer[aMbLen] = L'\0';
   FromUnicode (aWideBuffer, theLength);
-  delete[] aWideBuffer;
-#endif
 }
 
 // =======================================================================
@@ -319,17 +321,7 @@ bool NCollection_UtfString<Type>::ToLocale (char*                  theBuffer,
                                             const Standard_Integer theSizeBytes) const
 {
   NCollection_UtfString<wchar_t> aWideCopy (myString, myLength);
-#if(defined(_WIN32) || defined(__WIN32__))
-  int aMbBytes = WideCharToMultiByte (CP_ACP, 0, aWideCopy.ToCString(), -1, theBuffer, theSizeBytes, NULL, NULL);
-#else
-  std::size_t aMbBytes = std::wcstombs (theBuffer, aWideCopy.ToCString(), theSizeBytes);
-#endif
-  if (aMbBytes <= 0)
-  {
-    *theBuffer = '\0';
-    return false;
-  }
-  return true;
+  return NCollection_UtfStringTool::ToLocale (aWideCopy.ToCString(), theBuffer, theSizeBytes);
 }
 
 // =======================================================================
index 4efabbf3f7741d8cad69a5baa418410883cd54de..c833e8cbe7f6c741d36ba8e7d7285a5396deb566 100644 (file)
@@ -34,7 +34,7 @@ NCollection_WinHeapAllocator::NCollection_WinHeapAllocator
 #endif
   myToZeroMemory (Standard_False)
 {
-#if(defined(_WIN32) || defined(__WIN32__))
+#if defined(_WIN32) && (_WIN32_WINNT >= 0x0501)
   // activate LHF to improve small size allocations
   ULONG aHeapInfo = 2;
   HeapSetInformation (myHeapH, HeapCompatibilityInformation,
index 104487a0c03ee5681c7df5c257508c1c5c1bac15..1970977888e8508df177e2202e1696023daa0a2a 100644 (file)
@@ -267,9 +267,7 @@ Standard_Boolean OSD_DirectoryIterator :: More () {
 
 void OSD_DirectoryIterator :: Next () {
 
- if (  myFirstCall && !( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )  ||
-       !myFirstCall
- ) {
+ if ( ! myFirstCall || ! ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
  
   do {
   
index 1630c1ce3a89412c9130a587dcff1e21ac1b60e2..fb0c6f0c9f2c06d793f1d236c0d6eb816a3fa6d3 100644 (file)
@@ -384,7 +384,7 @@ return OSD_UNKNOWN   ;
 // -------------------------------------------------------------------------- 
 // Read content of a file
 // -------------------------------------------------------------------------- 
-void  OSD_File::Read(      Standard_Address&  Buffer, 
+void  OSD_File::Read(const Standard_Address   Buffer, 
                      const Standard_Integer   Nbyte,
                            Standard_Integer&  Readbyte)
 {
@@ -841,11 +841,12 @@ void OSD_File::Rewind() {
 
 #if defined(__CYGWIN32__) || defined(__MINGW32__)
 #define VAC
-#define _int64 int
 #endif
 
-#pragma comment( lib, "WSOCK32.LIB"  )
-#pragma comment( lib, "WINSPOOL.LIB" )
+#if defined(_MSC_VER)
+  #pragma comment( lib, "WSOCK32.LIB"  )
+  #pragma comment( lib, "WINSPOOL.LIB" )
+#endif
 
 #define ACE_HEADER_SIZE (  sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD )  )
 
@@ -1085,19 +1086,18 @@ void OSD_File :: Read (
  }
                                         
  Standard_Integer NbyteRead;
- Standard_Address buff;
 
  TEST_RAISE(  "Read"  );
      
buff = ( Standard_Address )new Standard_Character[ Nbyte + 1 ];
char* buff = new Standard_Character[ Nbyte + 1 ];
 
  Read ( buff, Nbyte, NbyteRead );
 
(  ( Standard_PCharacter )buff  )[ NbyteRead ] = 0;
buff[ NbyteRead ] = 0;
 
  if ( NbyteRead != 0 )
 
-  Buffer = ( Standard_PCharacter )buff;
+  Buffer = buff;
 
  else
 
@@ -1259,7 +1259,7 @@ void OSD_File :: ReadLine (
 // -------------------------------------------------------------------------- 
 
 void OSD_File :: Read (
-                  Standard_Address& Buffer,
+                  const Standard_Address Buffer,
                   const Standard_Integer Nbyte, Standard_Integer& Readbyte
                  ) {
 
@@ -1456,7 +1456,7 @@ OSD_KindFile OSD_File :: KindOfFile () const {
 typedef struct _osd_wnt_key {
 
                 HKEY   hKey;
-                LPTSTR keyPath;
+                const char* keyPath;
 
                } OSD_WNT_KEY;
 
@@ -1627,23 +1627,26 @@ Standard_Boolean OSD_File :: IsLocked () {
 // Return size of a file
 // -------------------------------------------------------------------------- 
 
-Standard_Size OSD_File :: Size () {
-
- Standard_Integer retVal;
-
- TEST_RAISE(  "Size"  );
-
- LARGE_INTEGER aSize;
- aSize.QuadPart = 0;
- retVal = GetFileSizeEx (myFileHandle, &aSize);
-
- if (  retVal == 0  )
-
-  _osd_wnt_set_error ( myError, OSD_WFile );
-
- return (Standard_Size)aSize.QuadPart;
-
-}  // end OSD_File :: Size
+Standard_Size OSD_File::Size()
+{
+  TEST_RAISE("Size");
+#if (_WIN32_WINNT >= 0x0500)
+  LARGE_INTEGER aSize;
+  aSize.QuadPart = 0;
+  if (GetFileSizeEx (myFileHandle, &aSize) == 0)
+  {
+    _osd_wnt_set_error (myError, OSD_WFile);
+  }
+  return (Standard_Size)aSize.QuadPart;
+#else
+  DWORD aSize = GetFileSize (myFileHandle, NULL);
+  if (aSize == INVALID_FILE_SIZE)
+  {
+    _osd_wnt_set_error (myError, OSD_WFile);
+  }
+  return aSize;
+#endif
+}
 
 // -------------------------------------------------------------------------- 
 // Print contains of a file
@@ -1701,9 +1704,9 @@ PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd (
  DWORD                dwAccessOwner;
  DWORD                dwAccessWorld;
  DWORD                dwAccessAdminDir;
- DWORD                dwAccessGroupDir;
+// DWORD                dwAccessGroupDir;
  DWORD                dwAccessOwnerDir;
- DWORD                dwAccessWorldDir;
+// DWORD                dwAccessWorldDir;
  DWORD                dwACLsize       = sizeof ( ACL );
  DWORD                dwIndex         = 0;
  PTOKEN_OWNER         pTkOwner        = NULL;
@@ -1769,9 +1772,9 @@ retry:
   dwAccessWorld = _get_access_mask (  prot.World  ()  );
 
   dwAccessAdminDir = _get_dir_access_mask (  prot.System ()  );
-  dwAccessGroupDir = _get_dir_access_mask (  prot.Group  ()  );
+//  dwAccessGroupDir = _get_dir_access_mask (  prot.Group  ()  );
   dwAccessOwnerDir = _get_dir_access_mask (  prot.User   ()  );
-  dwAccessWorldDir = _get_dir_access_mask (  prot.World  ()  );
+//  dwAccessWorldDir = _get_dir_access_mask (  prot.World  ()  );
 
   if (  dwAccessGroup != 0  ) {
                                              
index 4ecc16a5e0911d8d5429600083f720a68ae8e3b0..c37bd772cb15614b6fb7921ea37643fad25277db 100644 (file)
@@ -117,7 +117,7 @@ public:
   //! may be less than Nbyte if the number of bytes left in the file
   //! is less than Nbyte bytes. For this reason the output
   //! parameter Readbyte will contain the number of read bytes.
-  Standard_EXPORT void Read (Standard_Address& Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte);
+  Standard_EXPORT void Read (const Standard_Address Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte);
   
   //! Attempts to write Nbyte bytes from the AsciiString to the file
   //! associated to the object File.
index b5462671cac125fdcb5db37c3c4ec0f4de1e0475..f8f78b2032f2092685077bc67de862ae11668284 100644 (file)
@@ -345,9 +345,7 @@ Standard_Boolean OSD_FileIterator :: More () {
 
 void OSD_FileIterator :: Next () {
 
- if (  myFirstCall && ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )  ||
-       !myFirstCall
- ) {
+ if ( ! myFirstCall || ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
  
   do {
   
index 60c88ee7aff1f739c60066add7c1b75700e0a8af..8bf2a0849d2ceb38b622b6bc49dfd5f00f096f7e 100644 (file)
@@ -187,7 +187,9 @@ Standard_Integer OSD_Host::Error()const{
 
 #include <OSD_Host.hxx>
 
-#pragma comment( lib, "WSOCK32.LIB" )
+#if defined(_MSC_VER)
+  #pragma comment( lib, "WSOCK32.LIB" )
+#endif
 
 void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
 
index 25ebc7686edd3f690308f9e9f341392515d2e5ae..f96df93e534d5ed5e50794ba9ebd459a79ec756c 100644 (file)
@@ -58,11 +58,18 @@ void OSD_MemInfo::Update()
     myCounters[anIter] = Standard_Size(-1);
   }
 
-#if (defined(_WIN32) || defined(__WIN32__))
+#if defined(_WIN32)
+#if (_WIN32_WINNT >= 0x0500)
   MEMORYSTATUSEX aStatEx;
   aStatEx.dwLength = sizeof(aStatEx);
   GlobalMemoryStatusEx (&aStatEx);
   myCounters[MemVirtual] = Standard_Size(aStatEx.ullTotalVirtual - aStatEx.ullAvailVirtual);
+#else
+  MEMORYSTATUS aStat;
+  aStat.dwLength = sizeof(aStat);
+  GlobalMemoryStatus (&aStat);
+  myCounters[MemVirtual] = Standard_Size(aStat.dwTotalVirtual - aStat.dwAvailVirtual);
+#endif
 
   // use Psapi library
   HANDLE aProcess = GetCurrentProcess();
index 938622b74c27af5996b0f1eb12673ae7ade4d1b2..0be7e84be4c8347e2d698ea22801fa5af82dde85 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#ifdef _WIN32
+  #include <windows.h>
+#endif
+
 #include <OSD_OpenFile.hxx>
 #include <TCollection_ExtendedString.hxx>
 #include <NCollection_UtfString.hxx>
@@ -23,7 +27,7 @@ FILE* OSD_OpenFile(const char* theName,
                    const char* theMode)
 {
   FILE* aFile = 0;
-#ifdef _WIN32
+#if defined(_WIN32)
   // file name is treated as UTF-8 string and converted to UTF-16 one
   const TCollection_ExtendedString aFileNameW (theName, Standard_True);
   const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
@@ -43,7 +47,7 @@ FILE* OSD_OpenFile(const TCollection_ExtendedString& theName,
                    const char* theMode)
 {
   FILE* aFile = 0;
-#ifdef _WIN32
+#if defined(_WIN32)
   const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
   aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(),
                      (const wchar_t* )aFileModeW.ToExtString());
@@ -63,7 +67,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
                      const char* theName,
                      const std::ios_base::openmode theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   // file name is treated as UTF-8 string and converted to UTF-16 one
   const TCollection_ExtendedString aFileNameW (theName, Standard_True);
   theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
@@ -80,7 +84,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
                      const TCollection_ExtendedString& theName,
                      const std::ios_base::openmode theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   theBuff.open ((const wchar_t* )theName.ToExtString(), theMode);
 #else
   // conversion in UTF-8 for linux
@@ -97,7 +101,7 @@ void OSD_OpenStream(std::ofstream& theStream,
                     const char* theName,
                     const std::ios_base::openmode theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   // file name is treated as UTF-8 string and converted to UTF-16 one
   const TCollection_ExtendedString aFileNameW (theName, Standard_True);
   theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
@@ -114,7 +118,7 @@ void OSD_OpenStream(std::ofstream& theStream,
                     const TCollection_ExtendedString& theName,
                     const std::ios_base::openmode theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   theStream.open ((const wchar_t* )theName.ToExtString(), theMode);
 #else
   // conversion in UTF-8 for linux
@@ -131,7 +135,7 @@ void OSD_OpenStream (std::ifstream&                theStream,
                      const char*                   theName,
                      const std::ios_base::openmode theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   // file name is treated as UTF-8 string and converted to UTF-16 one
   const TCollection_ExtendedString aFileNameW (theName, Standard_True);
   theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode);
@@ -148,7 +152,7 @@ void OSD_OpenStream (std::ifstream&                    theStream,
                      const TCollection_ExtendedString& theName,
                      const std::ios_base::openmode     theMode)
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
   theStream.open ((const wchar_t*)theName.ToExtString(), theMode);
 #else
   // conversion in UTF-8 for linux
index 21d9d66a90eca610766b151716626809b94660bd..c434dbe7f61359749d370ee37dee9ac7723a68d8 100644 (file)
@@ -1103,7 +1103,7 @@ Standard_Integer OSD_Path :: TrekLength () const {
  Standard_Integer i      = 1;
  Standard_Integer retVal = 0;
 
- if (  myTrek.IsEmpty () || myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|'  )
+ if (  myTrek.IsEmpty () || (myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|') )
 
   return retVal;
 
index f9623fd31daf0fab55eb790589ba15ecc9855d39..b73c1e2ce9eb41a0533fab859ca3cc25002de6fb 100644 (file)
@@ -197,8 +197,9 @@ Standard_Integer OSD_Process::Error()const{
 #include <OSD_WNT_1.hxx>
 #include <LMCONS.H> /// pour UNLEN  ( see MSDN about GetUserName() )
 
-
-#pragma warning( disable : 4700 )
+#if defined(_MSC_VER)
+  #pragma warning( disable : 4700 )
+#endif
 
 void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
 
index 3dc32102d78ec32b5974785ddbd704d081684f40..a7087141376fc229f505c176b515e2a47954c078 100644 (file)
 #  endif
 # endif  /* OSDAPI */
 
-#if defined(__CYGWIN32__) || defined(__MINGW32__)
-#define _TINT int
-#endif
-
 # ifdef __cplusplus
 extern "C" {
 # endif  /* __cplusplus */
index 163661363c936ebb27fd390113010c4973aabc64..7c0916059608c9da2a5b0003190399b423d2e1d6 100644 (file)
 #endif
 #include <windows.h>
 
+#ifndef STATUS_FLOAT_MULTIPLE_FAULTS
+  // <ntstatus.h>
+  #define STATUS_FLOAT_MULTIPLE_FAULTS     (0xC00002B4L)
+  #define STATUS_FLOAT_MULTIPLE_TRAPS      (0xC00002B5L)
+#endif
+
 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
 #include <OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx>
 #include <OSD_Exception_ILLEGAL_INSTRUCTION.hxx>
index ab026e979a7c13d129603706ab58a0f54f56c9ef..b96d00049b1552465e899846a17c9db917f2d19e 100644 (file)
@@ -559,7 +559,7 @@ void* OpenGl_Context::findProc (const char* theFuncName)
 #if defined(HAVE_EGL)
   return (void* )eglGetProcAddress (theFuncName);
 #elif defined(_WIN32)
-  return wglGetProcAddress (theFuncName);
+  return (void* )wglGetProcAddress (theFuncName);
 #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
   return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL;
 #else
index c9cfd8050abc5bb6e233fd9e91affad7ffc3ea6c..96affd49eac21bdb99767127d0725a1395b888fc 100755 (executable)
@@ -20,6 +20,9 @@
 #include <Standard_Assert.hxx>
 #include <TCollection_AsciiString.hxx>
 
+#ifdef _WIN32
+  #include <malloc.h> // for alloca()
+#endif
 
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderObject,OpenGl_Resource)
 
index 90ef45b78f61331c834b1bf64eeec8ccae15f12f..7392d07f7881bcf5e231aa38392471f083ec1357 100755 (executable)
 
 #include <OpenGl_GlCore32.hxx>
 
+#ifdef _WIN32
+  #include <malloc.h> // for alloca()
+#endif
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource)
 
 OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector();
index 6327ec09d59bb389441132192e6c955915377d27..60ee20bbaa2fe20969c5ee9f85ec2c95c7c5d9a3 100644 (file)
@@ -121,14 +121,14 @@ Handle(CDM_MetaData) PCDM_ReferenceIterator::MetaData(const Standard_Boolean ) c
     chr = dir.Value ( i );
     
     switch ( chr ) {
-      
-    case _TEXT( '|' ):
-      dirRet += _TEXT( "/" );
+
+    case '|':
+      dirRet += "/";
       break;
-      
-    case _TEXT( '^' ):
-      
-      dirRet += _TEXT( ".." );
+
+    case '^':
+
+      dirRet += "..";
       break;
       
     default:
index 24557a64274b6a8b01efc646d24dc5b7f3d8e681..e3f18eeedb1dd3949b25289b2c330200f007605e 100644 (file)
@@ -2385,7 +2385,7 @@ static int StackOverflow (int i = -1)
 #endif
 
 // this code does not work with optimize mode on Windows
-#ifdef _WIN32
+#if defined(_MSC_VER)
 #pragma optimize( "", off )
 #endif
 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
@@ -2642,7 +2642,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
 
   return 0;
 }
-#ifdef _WIN32
+#if defined(_MSC_VER)
 #pragma optimize( "", on )
 #endif
 
index 185cb64705f5afbdd162640792d891fb8cbf9444..edd261483fca3f86a01457666da61a96c3367e9d 100644 (file)
@@ -84,7 +84,7 @@ Standard_MMgrFactory::Standard_MMgrFactory()
   aVar = getenv ("MMGT_OPT");
   Standard_Integer anAllocId   = (aVar ?  atoi (aVar): OCCT_MMGT_OPT_DEFAULT);
 
-#if defined(_WIN32) && !defined(_WIN64)
+#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
   static const DWORD _SSE2_FEATURE_BIT(0x04000000);
   if ( anAllocId == 2 )
   {
index a7f363f6e5542da499e125dd6dbe120d2a632592..aa4df3c0c05a7a63222ddb63a7c70abf0a5eff02 100644 (file)
@@ -72,7 +72,7 @@ inline void Standard_ASSERT_DO_NOTHING() {}
 // User messages are activated in debug mode only
 #ifdef _DEBUG
   #if (defined(_WIN32) || defined(__WIN32__))
-    #if defined(_MSC_VER)
+    #if defined(_MSC_VER) || defined(__MINGW64__)
       // VS-specific intrinsic
       #define Standard_ASSERT_DBGBREAK_() __debugbreak()
     #else
index 26e54cce4753ae54a0a3529cce9f4caf2549a52f..fc7a4b33cd657bd096e08559a19b8739d0aa3aea 100644 (file)
@@ -32,7 +32,7 @@ namespace
     CLocalePtr()
     #ifdef HAVE_XLOCALE_H
     : myLocale (newlocale (LC_ALL_MASK, "C", NULL))
-    #elif defined(_WIN32)
+    #elif defined(_WIN32) && !defined(__MINGW32__)
     : myLocale (_create_locale (LC_ALL, "C"))
     #else
     : myLocale (NULL)
@@ -43,7 +43,7 @@ namespace
     {
     #ifdef HAVE_XLOCALE_H
       freelocale (myLocale);
-    #elif defined(_WIN32)
+    #elif defined(_WIN32) && !defined(__MINGW32__)
       _free_locale (myLocale);
     #endif
     }
index 25d30c722d219817f94bf689d59e99420163bef6..4d9f7b92773f529729bfaac8ac0d46cf009fda76 100755 (executable)
@@ -65,7 +65,7 @@ public:
 
 #ifdef HAVE_XLOCALE_H
   typedef  locale_t clocale_t;
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__MINGW32__)
   typedef _locale_t clocale_t;
 #else
   typedef void*     clocale_t;
index ed39493abbbb161bceba020363474f428cd2dfd0..ec33b0a38f146bcac09ed137fbb13aefe3093d45 100755 (executable)
@@ -63,7 +63,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
 #ifdef __APPLE__
   // There are a lot of *_l functions availalbe on Mac OS X - we use them
   #define SAVE_TL()
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__MINGW32__)
   // MSVCRT has equivalents with slightly different syntax
   #define SAVE_TL()
   #define strtod_l(thePtr, theNextPtr, theLocale)                _strtod_l(thePtr, theNextPtr, theLocale)
@@ -80,7 +80,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
     // glibc version for android platform use locale-independent implementation of
     // strtod, strtol, strtoll functions. For other system with locale-depended
     // implementations problems may appear if "C" locale is not set explicitly.
-    #if !defined(__ANDROID__) && !defined(__QNX__)
+    #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__MINGW32__)
       #error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
     #endif
     #define strtod_l(thePtr, theNextPtr, theLocale)              strtod(thePtr, theNextPtr)
index b51b98f3621dae82253d96406f501ee7d4b7db0c..8d397dd84e4cc4123b1188642a3e556b089b3bd6 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef _Standard_values_HeaderFile
 # define _Standard_values_HeaderFile
 
-#ifdef _WIN32
+#if defined(_MSC_VER)
 # include <limits>
 #else
 # include <limits.h>
index 2aa7f1dc3556a6c63b2a20b2343deb84aa8d8ed4..51edd9211bbf7e266444b7675b4794e5f3150504 100644 (file)
@@ -57,7 +57,7 @@ TCollection_AsciiString::TCollection_AsciiString()
 // Create an asciistring from a Standard_CString
 // ----------------------------------------------------------------------------
 TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring)
-     : mystring(0)
+  : mystring(0), mylength(0)
 {
   if (astring) {
     mylength = Standard_Integer( strlen(astring) );
@@ -75,10 +75,9 @@ TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring)
 // ----------------------------------------------------------------------------
 TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring,
                                                  const Standard_Integer aLen )
-     : mystring(0)
+  : mystring(0), mylength(aLen)
 {
   if (astring) {
-    mylength = aLen ;
     mystring = Allocate(mylength+1);
     strncpy( mystring , astring , mylength );
     mystring [ mylength ] = '\0' ;
index b12c0e5e85ecd39188ced84e364b420e2ca7f66d..f4d408e69130ca1788d7b80cdc6fb38ea8c2b87b 100644 (file)
@@ -133,6 +133,7 @@ TCollection_ExtendedString::TCollection_ExtendedString()
 TCollection_ExtendedString::TCollection_ExtendedString
                                           (const Standard_CString astring, 
                                            const Standard_Boolean isMultiByte) 
+  : mystring(0), mylength(0)
 {
   if (astring) {
     if(!isMultiByte) {
@@ -166,6 +167,7 @@ TCollection_ExtendedString::TCollection_ExtendedString
 //--------------------------------------------------------------------------
 TCollection_ExtendedString::TCollection_ExtendedString
                                         (const Standard_ExtString astring) 
+  : mystring(0), mylength(0)
 {
 
   if (astring) {
index 43447d8673ba91d9923cecf70fec3ec58c7c3a78..4208b027981e76fcd28e712fe54bd14837588472 100644 (file)
@@ -7,3 +7,4 @@ CSF_XwLibs
 CSF_OpenGlLibs
 CSF_user32
 CSF_gdi32
+CSF_d3d9
index c2a9cf83720124303283750d7ba0d7d8ea789f88..c7ceace8fd13a7aefe25f9367754f156bc63cfb3 100755 (executable)
@@ -3,4 +3,7 @@ CSF_advapi32
 CSF_gdi32
 CSF_user32
 CSF_TBB
-CSF_dl
\ No newline at end of file
+CSF_dl
+CSF_wsock32
+CSF_winspool
+CSF_psapi
index 45ae98557a25a1d14820ee70c76261ca921cfc6b..7dd7e101dde06c9fbfeb43089915601ac4bd3ba1 100644 (file)
@@ -69,7 +69,11 @@ void TopOpeBRepBuild_GIter::Next()
 
 void TopOpeBRepBuild_GIter::Current(TopAbs_State& s1, TopAbs_State& s2) const 
 {
-  if ( !More() ) return;
+  if ( !More() )
+  {
+    s1 = s2 = TopAbs_UNKNOWN;
+    return;
+  }
   Standard_Integer i1,i2; 
   MYGTOPO.Index(myII,i1,i2);
   s1 = MYGTOPO.GState(i1);
index bb21c52f2b4cd0713ecb234710a6ece476bf8dd8..bed27733d4799b711a1b3844187446fe1e7a205c 100644 (file)
@@ -171,7 +171,8 @@ Standard_Boolean TopOpeBRepBuild_GTopo::Value(const TopAbs_State s1,
 
 Standard_Boolean TopOpeBRepBuild_GTopo::Value(const Standard_Integer II) const
 {
-  Standard_Integer i1,i2; Index(II,i1,i2);
+  Standard_Integer i1=0,i2=0;
+  Index(II,i1,i2);
   Standard_Boolean b = Value(i1,i2);
   return b;
 }
index fe531f9817b7d624d4b6c1498045bc9a3752f845..96746b74621f1b5526346dcc44ff9f6d9623b1fd 100644 (file)
@@ -1446,7 +1446,9 @@ Standard_EXPORT Standard_Integer FUN_ds_hasI2d(
     Standard_Boolean is3d = Standard_False;
     for (; itF.More(); itF.Next()){
       const Handle(TopOpeBRepDS_Interference)& IF = itF.Value();
-      TopOpeBRepDS_Kind GTF,STF; Standard_Integer GF,SF; FDS_data(IF,GTF,GF,STF,SF);
+      TopOpeBRepDS_Kind GTF,STF;
+      Standard_Integer GF=0,SF=0;
+      FDS_data(IF,GTF,GF,STF,SF);
       if (GE != GF) continue;
       if (SF==isb) {
        is3d = Standard_True;
index edeaa5903ceb3cc0327fb68cd0e8b93ba244e87e..3e07ed972dccd2229a09d11b30fd038bae29ac36 100644 (file)
@@ -20,7 +20,9 @@
 
 #ifdef _WIN32
 #include <windows.h>
-#pragma comment( lib, "comdlg32.lib"  )
+#if defined(_MSC_VER)
+  #pragma comment( lib, "comdlg32.lib"  )
+#endif
 #endif
 
 
index 0841a16135249d0ac47bdb180e083bffc2b158fd..01af7825fa7e369172f69e0465135bfa1dd162b6 100644 (file)
 #include <TColStd_HArray1OfAsciiString.hxx>
 #include <TColStd_HSequenceOfAsciiString.hxx>
 
-#ifdef _WIN32
+#if defined(_MSC_VER)
 # define _CRT_SECURE_NO_DEPRECATE
 # pragma warning (disable:4996)
 #endif
index a82705dca1a1d6faa146c1437e42ab8e0cb10dbe..f882441b8006982d2c6fadf5689c33936a8948c2 100644 (file)
@@ -234,7 +234,7 @@ const Handle(MMgt_TShared)& ViewerTest::WClass()
 #if defined(_WIN32)
   if (theWClass.IsNull())
   {
-    theWClass = new WNT_WClass ("GW3D_Class", AdvViewerWindowProc,
+    theWClass = new WNT_WClass ("GW3D_Class", (Standard_Address )AdvViewerWindowProc,
       CS_VREDRAW | CS_HREDRAW, 0, 0,
       ::LoadCursor (NULL, IDC_ARROW));
   }
@@ -8649,7 +8649,7 @@ static Standard_Integer VProgressiveMode (Draw_Interpretor& /*theDI*/,
     Standard_Boolean toExit = Standard_False;
 
     MSG aMsg;
-    while (PeekMessage (&aMsg, NULL, NULL, NULL, PM_REMOVE))
+    while (PeekMessage (&aMsg, NULL, 0, 0, PM_REMOVE))
     {
       if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b))
       {
index 014348b6f634315744449fc2641212537a136cc9..d2d12c6c520efeb8402ef3f83447233d00caca4b 100644 (file)
@@ -63,7 +63,7 @@ WNT_WClass::WNT_WClass (
 
   lpszName = new char[ strlen ( aClassName ) + 1 ];
   strcpy ( (Standard_PCharacter)lpszName, aClassName );
-  lpfnWndProc = wc.lpfnWndProc;
+  lpfnWndProc = (void* )wc.lpfnWndProc;
 
 }  // end constructor
 
index b8d586fe2ffdbac890f83a9bf89bead95259ac41..201853f00a94a043f16ceab201df513e11e79561 100644 (file)
@@ -221,10 +221,10 @@ Aspect_TypeOfResize WNT_Window::DoResize() const
 
   if (wp.showCmd != SW_SHOWMINIMIZED)
   {
-    if (Abs (wp.rcNormalPosition.left   - aXLeft  ) > 2) mask |= 1;
-    if (Abs (wp.rcNormalPosition.right  - aXRight ) > 2) mask |= 2;
-    if (Abs (wp.rcNormalPosition.top    - aYTop   ) > 2) mask |= 4;
-    if (Abs (wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8;
+    if (Abs ((int )wp.rcNormalPosition.left   - aXLeft  ) > 2) mask |= 1;
+    if (Abs ((int )wp.rcNormalPosition.right  - aXRight ) > 2) mask |= 2;
+    if (Abs ((int )wp.rcNormalPosition.top    - aYTop   ) > 2) mask |= 4;
+    if (Abs ((int )wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8;
 
     switch (mask)
     {
index 633dfc2b89973820c11fe85a870dcb21fca5f903..db72502ace58bf8d71eba976fe2aa30b29499bb4 100644 (file)
@@ -377,14 +377,14 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
     chr = dir.Value ( i );
     
     switch ( chr ) {
-      
-    case _TEXT( '|' ):
-      dirRet += _TEXT( "/" );
+
+    case '|':
+      dirRet += "/";
       break;
-      
-    case _TEXT( '^' ):
-      
-      dirRet += _TEXT( ".." );
+
+    case '^':
+
+      dirRet += "..";
       break;
       
     default: