1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00

0027197: Configuration - fix compilation issues when using mingw

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)
This commit is contained in:
kgv 2016-02-28 02:07:27 +03:00 committed by abv
parent 8582eb08cc
commit 7c65581dd3
69 changed files with 624 additions and 422 deletions

View File

@ -33,9 +33,23 @@ if (WIN32)
set (CSF_gdi32 "gdi32.lib") set (CSF_gdi32 "gdi32.lib")
set (CSF_user32 "user32.lib") set (CSF_user32 "user32.lib")
set (CSF_wsock32 "wsock32.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_AviLibs "ws2_32.lib vfw32.lib")
set (CSF_OpenGlLibs "opengl32.lib glu32.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) if (USE_TCL)
set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib") set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib")
set (CSF_TclTkLibs "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib") set (CSF_TclTkLibs "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib")

View File

@ -101,17 +101,22 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (APPLE) if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
else() elseif(NOT WIN32)
set (CMAKE_SHARED_LINKER_FLAGS "-lm -z defs ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
endif() endif()
else() else()
if (NOT ANDROID) if (NOT ANDROID AND NOT MINGW)
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}") set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
endif() endif()
endif() 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}") set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif() endif()

View File

@ -128,6 +128,7 @@ proc genproj { args } {
# Setting default IDE. # Setting default IDE.
set anTarget "" set anTarget ""
set aCmpl "gcc"
switch -exact -- "$targetStation" { switch -exact -- "$targetStation" {
"wnt" {set anTarget "$::env(VCVER)"} "wnt" {set anTarget "$::env(VCVER)"}
"lin" {set anTarget "cbp"} "lin" {set anTarget "cbp"}
@ -215,7 +216,7 @@ proc genproj { args } {
set anAdmPath "$path/adm" set anAdmPath "$path/adm"
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl"
genprojbat "$anTarget" genprojbat "$anTarget"
} }
@ -260,7 +261,10 @@ proc genprojbat {theIDE} {
file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat" file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else { } else {
switch -exact -- "$theIDE" { 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" } "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}" set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
# Entry function to generate project files and solutions for IDE # 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 global path targetStation
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" } set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
@ -352,7 +361,7 @@ proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform "
"vc11" - "vc11" -
"vc12" - "vc12" -
"vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE } "vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution } "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl }
"xcd" { "xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000" set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
@ -1076,6 +1085,8 @@ proc osutils:tk:csfInExternlib { EXTERNLIB } {
return $lret 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 theCsfLibsMap - libraries map
# @param theCsfFrmsMap - frameworks map, OS X specific # @param theCsfFrmsMap - frameworks map, OS X specific
proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } { proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
@ -1085,60 +1096,75 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
unset theCsfLibsMap unset theCsfLibsMap
unset theCsfFrmsMap 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" } { if { "$theOS" == "wnt" } {
# WinAPI libraries # WinAPI libraries
set aLibsMap(CSF_kernel32) "kernel32.lib" set aLibsMap(CSF_kernel32) "kernel32"
set aLibsMap(CSF_advapi32) "advapi32.lib" set aLibsMap(CSF_advapi32) "advapi32"
set aLibsMap(CSF_gdi32) "gdi32.lib" set aLibsMap(CSF_gdi32) "gdi32"
set aLibsMap(CSF_user32) "user32.lib" set aLibsMap(CSF_user32) "user32 comdlg32"
set aLibsMap(CSF_opengl32) "opengl32.lib" set aLibsMap(CSF_opengl32) "opengl32"
set aLibsMap(CSF_wsock32) "wsock32.lib" set aLibsMap(CSF_wsock32) "wsock32"
set aLibsMap(CSF_netapi32) "netapi32.lib" set aLibsMap(CSF_netapi32) "netapi32"
set aLibsMap(CSF_AviLibs) "ws2_32.lib vfw32.lib" set aLibsMap(CSF_AviLibs) "ws2_32 vfw32"
set aLibsMap(CSF_OpenGlLibs) "opengl32.lib" set aLibsMap(CSF_OpenGlLibs) "opengl32"
set aLibsMap(CSF_winspool) "Winspool"
set aLibsMap(CSF_psapi) "Psapi"
set aLibsMap(CSF_d3d9) "d3d9"
set aLibsMap(CSF_QT) "QtCore4.lib QtGui4.lib" # the naming is different on Windows
set aLibsMap(CSF_TclLibs) "tcl86"
set aLibsMap(CSF_TclTkLibs) "tk86"
# VTK set aLibsMap(CSF_QT) "QtCore4 QtGui4"
set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
# tbb headers define different pragma lib depending on debug/release
set aLibsMap(CSF_TBB) ""
} else { } else {
set aLibsMap(CSF_FREETYPE) "freetype"
if { "$theOS" == "mac" } { if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc" set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "Appkit" set aFrmsMap(CSF_Appkit) "Appkit"
set aFrmsMap(CSF_IOKit) "IOKit" set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL" set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl" set aFrmsMap(CSF_TclLibs) "Tcl"
set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk" set aFrmsMap(CSF_TclTkLibs) "Tk"
set aLibsMap(CSF_TclTkLibs) ""
} else { } else {
if { "$theOS" == "qnx" } { 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_OpenGlLibs) "EGL GLESv2"
set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "tk8.6"
} else { } else {
set aLibsMap(CSF_ThreadLibs) "pthread rt" set aLibsMap(CSF_ThreadLibs) "pthread rt"
set aLibsMap(CSF_OpenGlLibs) "GL" set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6" set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi" set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_MotifLibs) "X11" 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 ""}} { proc osutils:vtkCsf {{theOS ""}} {
set aVtkVer "6.1" set aVtkVer "6.1"
set aLibSuffix ""
set aPathSplitter ":" set aPathSplitter ":"
if {"$theOS" == "wnt"} { if {"$theOS" == "wnt"} {
set aPathSplitter ";" set aPathSplitter ";"
set aLibSuffix ".lib"
} }
set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"] set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"]
@ -1167,7 +1190,7 @@ proc osutils:vtkCsf {{theOS ""}} {
# Additional suffices for the libraries # Additional suffices for the libraries
set anIdx 0 set anIdx 0
foreach anItem $aLibArray { foreach anItem $aLibArray {
lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix lset aLibArray $anIdx $anItem-$aVtkVer
incr anIdx incr anIdx
} }
@ -1449,24 +1472,26 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
} }
regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
set aCommonUsedTK [list] set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] { foreach tkx [osutils:commonUsedTK $theToolKit] {
lappend aCommonUsedTK "${tkx}.lib" lappend aUsedLibs "${tkx}.lib"
} }
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks 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 # correct names of referred third-party libraries that are named with suffix
# depending on VC version # 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 # and put this list to project file
#puts "$theToolKit requires $aUsedToolKits" #puts "$theToolKit requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } { 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 anIncPaths "..\\..\\..\\inc"
set aTKDefines "" set aTKDefines ""
@ -1666,23 +1691,25 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
} }
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aCommonUsedTK [list] set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] { foreach tkx [osutils:commonUsedTK $theToolKit] {
lappend aCommonUsedTK "${tkx}.lib" lappend aUsedLibs "${tkx}.lib"
} }
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks 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 # correct names of referred third-party libraries that are named with suffix
# depending on VC version # 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" } { 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 aFilesSection ""
set aVcFilesX(units) "" set aVcFilesX(units) ""
@ -1848,13 +1875,13 @@ proc osutils:justunix { listloc } {
####### CODEBLOCK ################################################################### ####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files # 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" puts stderr "Generating project files for Code Blocks"
# Generate projects for toolkits and separate workspace for each module # Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules { foreach aModule $theModules {
OS:cworkspace $aModule $aModule $theOutDir OS:cworkspace $aModule $aModule $theOutDir
OS:cbp $aModule $theOutDir OS:cbp $theCmpl $aModule $theOutDir
} }
# Generate single workspace "OCCT" containing projects from all modules # Generate single workspace "OCCT" containing projects from all modules
@ -1866,30 +1893,69 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
} }
# Generate Code Blocks projects # Generate Code Blocks projects
proc OS:cbp { theModules theOutDir } { proc OS:cbp { theCmpl theModules theOutDir } {
set aProjectFiles {} set aProjectFiles {}
foreach aModule $theModules { foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] { foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:cbptk $theOutDir $aToolKit ] lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ]
} }
foreach anExecutable [OS:executable ${aModule}] { foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:cbpx $theOutDir $anExecutable] lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable]
} }
} }
return $aProjectFiles return $aProjectFiles
} }
# Generate Code::Blocks project file for ToolKit # Generate Code::Blocks project file for ToolKit
proc osutils:cbptk { theOutDir theToolKit } { proc osutils:cbptk { theCmpl theOutDir theToolKit } {
set aUsedToolKits [list] set aUsedLibs [list]
set aFrameworks [list] set aFrameworks [list]
set anIncPaths [list] set anIncPaths [list]
set aTKDefines [list] set aTKDefines [list]
set aTKSrcFiles [list] set aTKSrcFiles [list]
osutils:tkinfo "../../.." $theToolKit aUsedToolKits aFrameworks anIncPaths aTKDefines aTKSrcFiles global path targetStation
set aWokStation "$targetStation"
return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines] # 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 $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
} }
# Generates Code Blocks workspace. # Generates Code Blocks workspace.
@ -1962,7 +2028,7 @@ proc OS:cworkspace { theSolName theModules theOutDir } {
} }
# Generate Code::Blocks project file for Executable # Generate Code::Blocks project file for Executable
proc osutils:cbpx { theOutDir theToolKit } { proc osutils:cbpx { theCmpl theOutDir theToolKit } {
global path targetStation global path targetStation
set aWokStation "$targetStation" set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)" set aWokArch "$::env(ARCH)"
@ -1970,21 +2036,22 @@ proc osutils:cbpx { theOutDir theToolKit } {
set aCbpFiles {} set aCbpFiles {}
foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] { foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] {
# collect list of referred libraries to link with # collect list of referred libraries to link with
set aUsedToolKits [list] set aUsedLibs [list]
set aFrameworks [list] set aFrameworks [list]
set anIncPaths [list] set anIncPaths [list]
set aTKDefines [list] set aTKDefines [list]
set aTKSrcFiles [list] set aTKSrcFiles [list]
set aProjName [file rootname [file tail $aSrcFile]] set aProjName [file rootname [file tail $aSrcFile]]
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedToolKits aFrameworks osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
set aDepToolkits [LibToLinkX $theToolKit $aProjName] set aDepToolkits [LibToLinkX $theToolKit $aProjName]
foreach tkx $aDepToolkits { foreach tkx $aDepToolkits {
if {[_get_type $tkx] == "t"} { if {[_get_type $tkx] == "t"} {
lappend aUsedToolKits "${tkx}" lappend aUsedLibs "${tkx}"
} }
if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} { 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])] } { if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1 set written([file tail $aSrcFile]) 1
lappend aTKSrcFiles $aSrcFile lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else { } else {
puts "Warning : in cbp there are more than one occurences for [file tail $aSrcFile]" 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 # common include paths
lappend anIncPaths "../../../inc" lappend anIncPaths "../../../inc"
# extra macros lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
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]
} }
return $aCbpFiles 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 # 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 theOutDir - output directory to place project file
# @param theProjName - project name # @param theProjName - project name
# @param theSrcFiles - list of source files # @param theSrcFiles - list of source files
@ -2037,12 +2093,60 @@ proc osutils:optinal_libs { } {
# @param theIncPaths - header search paths # @param theIncPaths - header search paths
# @param theDefines - compiler macro definitions # @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target # @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 global targetStation
set aWokStation "$targetStation" set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)" 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"] set aFile [open $aCbpFilePath "w"]
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>" puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
puts $aFile "<CodeBlocks_project_file>" 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<Project>"
puts $aFile "\t\t<Option title=\"$theProjName\" />" puts $aFile "\t\t<Option title=\"$theProjName\" />"
puts $aFile "\t\t<Option pch_mode=\"2\" />" puts $aFile "\t\t<Option pch_mode=\"2\" />"
if { "$aWokStation" == "wnt" } { puts $aFile "\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t<Build>" puts $aFile "\t\t<Build>"
# Release target configuration # 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\" />" puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else { } else {
if { "$aWokStation" == "wnt" } { 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 { } 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 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 type=\"3\" />"
} }
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />" puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />"
if { "$aWokStation" == "wnt" } { puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />" puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />" if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines) # compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>" puts $aFile "\t\t\t\t<Compiler>"
if { "$aWokStation" == "wnt" } { foreach aFlagIter $aCmplFlagsRelease {
puts $aFile "\t\t\t\t\t<Add option=\"-MD\" />" puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
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 aMacro $theDefines { foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />" 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</Compiler>"
puts $aFile "\t\t\t\t<Linker>" 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\" />" puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/lib\" />"
if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} { if { "$aWokStation" == "mac" } {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />" 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\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
puts $aFile "\t\t\t\t</Linker>" 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\" />" puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else { } else {
if { "$aWokStation" == "wnt" } { 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 { } 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 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 type=\"3\" />"
} }
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />" puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />"
if { "$aWokStation" == "wnt" } { puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />" puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />" if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
# compiler options per TARGET (including defines) # compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>" puts $aFile "\t\t\t\t<Compiler>"
if { "$aWokStation" == "wnt" } { foreach aFlagIter $aCmplFlagsDebug {
puts $aFile "\t\t\t\t\t<Add option=\"-MDd\" />" puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
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 aMacro $theDefines { foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />" 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</Compiler>"
puts $aFile "\t\t\t\t<Linker>" 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\" />" puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/libd\" />"
if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} { if { "$aWokStation" == "mac" } {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />" 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\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
puts $aFile "\t\t\t\t</Linker>" puts $aFile "\t\t\t\t</Linker>"
@ -2186,9 +2255,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
# COMMON compiler options # COMMON compiler options
puts $aFile "\t\t<Compiler>" puts $aFile "\t\t<Compiler>"
puts $aFile "\t\t\t<Add option=\"-Wall\" />" foreach aFlagIter $aCmplFlags {
puts $aFile "\t\t\t<Add option=\"-fexceptions\" />" puts $aFile "\t\t\t<Add option=\"$aFlagIter\" />"
puts $aFile "\t\t\t<Add option=\"-fPIC\" />" }
puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />" puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />"
foreach anIncPath $theIncPaths { foreach anIncPath $theIncPaths {
puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />" puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />"
@ -2197,6 +2266,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
# COMMON linker options # COMMON linker options
puts $aFile "\t\t<Linker>" puts $aFile "\t\t<Linker>"
if { "$aWokStation" == "wnt" && "$theCmpl" == "gcc" } {
puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
}
foreach aFrameworkName $theFrameworks { foreach aFrameworkName $theFrameworks {
if { "$aFrameworkName" != "" } { if { "$aFrameworkName" != "" } {
puts $aFile "\t\t\t<Add option=\"-framework $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 { foreach aLibName $theLibsList {
if { "$aLibName" != "" } { 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>" puts $aFile "\t\t</Linker>"
# list of sources # 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 { foreach aSrcFile $theSrcFiles {
if {[string equal -nocase [file extension $aSrcFile] ".mm"]} { if {[string equal -nocase [file extension $aSrcFile] ".mm"]} {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">" 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<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option compilerVar=\"CC\" />" puts $aFile "\t\t\t<Option compilerVar=\"CC\" />"
puts $aFile "\t\t</Unit>" 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 { } else {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />" puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />"
set isFirstSrcFile 0
} }
} }
if { "$aWokStation" == "wnt" } {
close $aFileLnkObj
close $aFileLnkObjd
}
puts $aFile "\t</Project>" puts $aFile "\t</Project>"
puts $aFile "</CodeBlocks_project_file>" puts $aFile "</CodeBlocks_project_file>"
close $aFile close $aFile
@ -2232,74 +2334,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
return $aCbpFilePath 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 # Define libraries to link using only EXTERNLIB file
proc LibToLinkX {thePackage theDummyName} { proc LibToLinkX {thePackage theDummyName} {
set aToolKits [LibToLink $thePackage] set aToolKits [LibToLink $thePackage]
@ -2431,7 +2465,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
upvar $theDepsRefGuids aDepsRefGuids upvar $theDepsRefGuids aDepsRefGuids
set aBuildFileSection "" 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] set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
if { "$theTargetType" == "executable" } { if { "$theTargetType" == "executable" } {
@ -2449,9 +2483,9 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
} }
osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
set aUsedToolKits [concat $aUsedToolKits $aLibs] set aUsedLibs [concat $aUsedLibs $aLibs]
set aUsedToolKits [concat $aUsedToolKits $aFrameworks] set aUsedLibs [concat $aUsedLibs $aFrameworks]
foreach tkx $aUsedToolKits { foreach tkx $aUsedLibs {
set aDepLib "${tkx}_Dep" set aDepLib "${tkx}_Dep"
set aDepLibRef "${tkx}_DepRef" set aDepLibRef "${tkx}_DepRef"

View File

@ -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%"

View File

@ -160,9 +160,13 @@ set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
goto :eof goto :eof
:concatLib32 :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 goto :eof
:concatLib64 :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 goto :eof

View File

@ -451,7 +451,7 @@ void AIS_AngleDimension::DrawArcWithText (const Handle(Prs3d_Presentation)& theP
gp_Dir aTextDir = gce_MakeDir (theFirstAttach, theSecondAttach); gp_Dir aTextDir = gce_MakeDir (theFirstAttach, theSecondAttach);
// Drawing text // Drawing text
DrawText (thePresentation, drawText (thePresentation,
aTextPos, aTextPos,
aTextDir, aTextDir,
theText, theText,
@ -696,7 +696,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
: GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint); : GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
gp_Dir aTextDir = aDimensionDir; gp_Dir aTextDir = aDimensionDir;
DrawText (thePresentation, drawText (thePresentation,
aTextPos, aTextPos,
aTextDir, aTextDir,
aLabelString, aLabelString,

View File

@ -556,7 +556,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
if (aTitle.Length()) if (aTitle.Length())
{ {
aTitleHeight += myTextHeight + aSpacer; 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(); Standard_Boolean toReverse = IsReversed();
@ -637,7 +637,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
aGroup->AddPrimitiveArray (aPrim); aGroup->AddPrimitiveArray (aPrim);
if (aStep > 0) 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 // Draw Labels
anOffset = 1.0 * Abs (aLabCount - aNum - 1) * ( aStep - aTextHeight ) / 2 + 1.0 * Abs (aLabCount - aNum - 1) * aTextHeight / 2; 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; Standard_Integer aPos2 = aLabCount - 1 - i2;
if (aFilter && !( aPos1 % aFilter )) 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; aLast1 = i1;
} }
if (aFilter && !( aPos2 % aFilter )) 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; aLast2 = i2;
} }
i1++; i1++;
@ -687,15 +687,15 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
} }
if (i0 != -1) 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 : //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 theX, const Standard_Integer theY,
const Standard_Integer theWidth, const Standard_Integer theHeight, const Standard_Integer theWidth, const Standard_Integer theHeight,
const Quantity_Color& theColor) const Quantity_Color& theColor)
@ -715,10 +715,10 @@ void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentatio
} }
//======================================================================= //=======================================================================
//function : DrawText //function : drawText
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_ColorScale::DrawText (const Handle(Prs3d_Presentation)& thePresentation, void AIS_ColorScale::drawText (const Handle(Prs3d_Presentation)& thePresentation,
const TCollection_ExtendedString& theText, const TCollection_ExtendedString& theText,
const Standard_Integer theX, const Standard_Integer theY, const Standard_Integer theX, const Standard_Integer theY,
const Quantity_Color& theColor) const Quantity_Color& theColor)

View File

@ -232,7 +232,7 @@ protected:
//! @param theWidth [in] the width of frame. //! @param theWidth [in] the width of frame.
//! @param theHeight [in] the height of frame. //! @param theHeight [in] the height of frame.
//! @param theColor [in] the color 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 theX, const Standard_Integer theY,
const Standard_Integer theWidth, const Standard_Integer theHeight, const Standard_Integer theWidth, const Standard_Integer theHeight,
const Quantity_Color& theColor); const Quantity_Color& theColor);
@ -242,7 +242,7 @@ protected:
//! @param theX [in] the X coordinate of text position. //! @param theX [in] the X coordinate of text position.
//! @param theY [in] the Y coordinate of text position. //! @param theY [in] the Y coordinate of text position.
//! @param theColor [in] the color of text. //! @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 TCollection_ExtendedString& theText,
const Standard_Integer theX, const Standard_Integer theY, const Standard_Integer theX, const Standard_Integer theY,
const Quantity_Color& theColor); const Quantity_Color& theColor);

View File

@ -393,10 +393,10 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
} }
//======================================================================= //=======================================================================
//function : DrawText //function : drawText
//purpose : //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_Pnt& theTextPos,
const gp_Dir& theTextDir, const gp_Dir& theTextDir,
const TCollection_ExtendedString& theText, 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_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
gp_Dir aTextDir = theExtensionDir; gp_Dir aTextDir = theExtensionDir;
DrawText (thePresentation, drawText (thePresentation,
aTextPos, aTextPos,
aTextDir, aTextDir,
theLabelString, theLabelString,
@ -727,7 +727,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
// add text primitives // add text primitives
if (theMode == ComputeMode_All || theMode == ComputeMode_Text) if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
{ {
DrawText (thePresentation, drawText (thePresentation,
aTextPos, aTextPos,
aTextDir, aTextDir,
aLabelString, aLabelString,

View File

@ -403,7 +403,7 @@ protected:
//! @param theLabelPosition [in] the text label vertical and horizontal positioning option //! @param theLabelPosition [in] the text label vertical and horizontal positioning option
//! respectively to the main dimension line. //! respectively to the main dimension line.
//! @return text width relative to the dimension working plane. For 2d text this value will be zero. //! @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_Pnt& theTextPos,
const gp_Dir& theTextDir, const gp_Dir& theTextDir,
const TCollection_ExtendedString& theText, const TCollection_ExtendedString& theText,

View File

@ -1456,6 +1456,9 @@ void BRepAlgo_DSAccess::PntVtxOnSectEdge
Standard_Integer& ipv2, Standard_Integer& ipv2,
TopOpeBRepDS_Kind& pvk2) TopOpeBRepDS_Kind& pvk2)
{ {
ipv1 = ipv2 = 0;
pvk1 = pvk2 = TopOpeBRepDS_UNKNOWN;
// myHB->ChangeBuilder(); // myHB->ChangeBuilder();
TopOpeBRepDS_DataStructure& DS = myHDS->ChangeDS(); TopOpeBRepDS_DataStructure& DS = myHDS->ChangeDS();
TopOpeBRepDS_Kind kind = TopOpeBRepDS_POINT; TopOpeBRepDS_Kind kind = TopOpeBRepDS_POINT;

View File

@ -2806,7 +2806,7 @@ void BSplCLib::Trimming(const Standard_Integer Degree,
TColStd_Array1OfInteger& NewMults, TColStd_Array1OfInteger& NewMults,
TColStd_Array1OfReal& NewPoles) TColStd_Array1OfReal& NewPoles)
{ {
Standard_Integer i, nbpoles, nbknots; Standard_Integer i, nbpoles=0, nbknots=0;
Standard_Real kk[2]; Standard_Real kk[2];
Standard_Integer mm[2]; Standard_Integer mm[2];
TColStd_Array1OfReal K( kk[0], 1, 2 ); TColStd_Array1OfReal K( kk[0], 1, 2 );

View File

@ -173,7 +173,7 @@ TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder()
#ifdef _WIN32 #ifdef _WIN32
TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE"); TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE");
if(hd.Length() != NULL) { if(hd.Length() != 0) {
theDefaultFolder=hd; theDefaultFolder=hd;
theDefaultFolder+=UTL::xgetenv("HOMEPATH"); theDefaultFolder+=UTL::xgetenv("HOMEPATH");
} }

View File

@ -376,7 +376,7 @@ Dico_Dictionary::Dico_Dictionary ()
else { stat = stat2; reslev = lev2; return; } 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; }
} }

View File

@ -193,7 +193,7 @@ LRESULT APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
{ {
char buffer[COMMANDSIZE]; char buffer[COMMANDSIZE];
POINT pos; POINT pos;
BOOL rep; BOOL rep = 0;
static LRESULT nbline; // Process the buffer of the edit window static LRESULT nbline; // Process the buffer of the edit window
LRESULT index; LRESULT index;

View File

@ -491,7 +491,7 @@ void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey,
} }
TCollection_AsciiString aPluginLibrary(""); TCollection_AsciiString aPluginLibrary("");
#ifndef _WIN32 #if !defined(_WIN32) || defined(__MINGW32__)
aPluginLibrary += "lib"; aPluginLibrary += "lib";
#endif #endif
aPluginLibrary += aPluginResource->Value(theKey.ToCString()); aPluginLibrary += aPluginResource->Value(theKey.ToCString());

View File

@ -14,7 +14,7 @@
commercial license or contractual agreement. commercial license or contractual agreement.
*/ */
#ifdef _MSC_VER #ifdef _WIN32
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.

View File

@ -334,7 +334,7 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
di << "Cygwin\n"; di << "Cygwin\n";
#endif #endif
#if defined(__MINGW64__) #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__) #elif defined(__MINGW32__)
di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n"; di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n";
#endif #endif

View File

@ -35,7 +35,7 @@
#endif #endif
// for capturing of cout and cerr (dup(), dup2()) // for capturing of cout and cerr (dup(), dup2())
#ifdef _MSC_VER #ifdef _WIN32
#include <io.h> #include <io.h>
#endif #endif
@ -86,8 +86,13 @@ namespace {
return; return;
// restore normal descriptors of console stream // restore normal descriptors of console stream
#ifdef _WIN32
_dup2(save_fd, std_fd);
_close(save_fd);
#else
dup2(save_fd, std_fd); dup2(save_fd, std_fd);
close(save_fd); close(save_fd);
#endif
// extract all output and copy it to log and optionally to cout // extract all output and copy it to log and optionally to cout
const int BUFSIZE = 2048; const int BUFSIZE = 2048;

View File

@ -63,13 +63,6 @@
extern Draw_Viewer dout; 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 // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30 Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
// true if complete command // true if complete command

View File

@ -1430,7 +1430,7 @@ DrawWindow::DrawWindow() :
} }
//________________________ //________________________
DrawWindow::DrawWindow(char* title, DrawWindow::DrawWindow(const char* title,
Standard_Integer X, Standard_Integer Y, Standard_Integer X, Standard_Integer Y,
Standard_Integer dX,Standard_Integer dY) : Standard_Integer dX,Standard_Integer dY) :
win(0), next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False) win(0), next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False)
@ -1440,7 +1440,7 @@ DrawWindow::DrawWindow(char* title,
Init(X, Y, dX, dY); Init(X, Y, dX, dY);
SetTitle(title); SetTitle(title);
} }
DrawWindow::DrawWindow(char* title, DrawWindow::DrawWindow(const char* title,
Standard_Integer X, Standard_Integer Y, Standard_Integer X, Standard_Integer Y,
Standard_Integer dX,Standard_Integer dY, Standard_Integer dX,Standard_Integer dY,
HWND theWin) : HWND theWin) :
@ -1657,7 +1657,7 @@ Standard_Integer DrawWindow::WidthWin() const
/*--------------------------------------------------------*\ /*--------------------------------------------------------*\
| SetTitle | SetTitle
\*--------------------------------------------------------*/ \*--------------------------------------------------------*/
void DrawWindow::SetTitle(char* title) void DrawWindow::SetTitle(const char* title)
{ {
SetWindowText(win, title); SetWindowText(win, title);
} }

View File

@ -417,12 +417,12 @@ public:
Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB); Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB);
__Draw_API DrawWindow(); __Draw_API DrawWindow();
__Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer, __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
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); Standard_Integer, Standard_Integer, HWND);
//destructeur //destructeur
__Draw_API ~DrawWindow(); __Draw_API virtual ~DrawWindow();
//methods //methods
public: public:
@ -432,7 +432,7 @@ public:
__Draw_API void SetUseBuffer(Standard_Boolean); __Draw_API void SetUseBuffer(Standard_Boolean);
// Turns on/off usage of off-screen image buffer (can be used for redrawing optimization) // 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 // Returns Standard_True if off-screen image buffer is being used
//taille et position //taille et position
@ -443,7 +443,7 @@ public:
__Draw_API Standard_Integer WidthWin() const; __Draw_API Standard_Integer WidthWin() const;
//Title //Title
__Draw_API void SetTitle(char*); __Draw_API void SetTitle(const char*);
__Draw_API char* GetTitle(); __Draw_API char* GetTitle();
//Affichage //Affichage
@ -451,7 +451,7 @@ public:
__Draw_API void Hide(); __Draw_API void Hide();
__Draw_API void Destroy(); __Draw_API void Destroy();
__Draw_API void Clear(); __Draw_API void Clear();
__Draw_API static void Flush() {} ; static void Flush() {} ;
// save snapshot // save snapshot
__Draw_API Standard_Boolean Save(const char* theFileName) const; __Draw_API Standard_Boolean Save(const char* theFileName) const;

View File

@ -1741,7 +1741,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
{ {
Handle(DrawTrSurf_Point) Handle(DrawTrSurf_Point)
N = Handle(DrawTrSurf_Point)::DownCast(d); 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(); ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield); OS.setf(ios::scientific,ios::floatfield);
OS.precision(15); OS.precision(15);
@ -1758,7 +1758,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
OS << "0 "; OS << "0 ";
OS << P.X() << " " << P.Y() << "\n"; OS << P.X() << " " << P.Y() << "\n";
} }
#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F); OS.setf(F);
#else #else
OS.setf(form); OS.setf(form);
@ -1803,7 +1803,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS)
{ {
Handle(DrawTrSurf_Triangulation) Handle(DrawTrSurf_Triangulation)
T = Handle(DrawTrSurf_Triangulation)::DownCast(d); 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(); ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield); OS.setf(ios::scientific,ios::floatfield);
OS.precision(15); OS.precision(15);
@ -1812,7 +1812,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS)
std::streamsize prec = OS.precision(15); std::streamsize prec = OS.precision(15);
#endif #endif
Poly::Write(T->Triangulation(),OS); Poly::Write(T->Triangulation(),OS);
#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F); OS.setf(F);
#else #else
OS.setf(form); OS.setf(form);
@ -1844,7 +1844,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
{ {
Handle(DrawTrSurf_Polygon3D) Handle(DrawTrSurf_Polygon3D)
T = Handle(DrawTrSurf_Polygon3D)::DownCast(d); 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(); ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield); OS.setf(ios::scientific,ios::floatfield);
OS.precision(15); OS.precision(15);
@ -1853,7 +1853,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
std::streamsize prec = OS.precision(15); std::streamsize prec = OS.precision(15);
#endif #endif
Poly::Write(T->Polygon3D(),OS); Poly::Write(T->Polygon3D(),OS);
#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F); OS.setf(F);
#else #else
OS.setf(form); OS.setf(form);
@ -1884,7 +1884,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
{ {
Handle(DrawTrSurf_Polygon2D) Handle(DrawTrSurf_Polygon2D)
T = Handle(DrawTrSurf_Polygon2D)::DownCast(d); 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(); ios::fmtflags F = OS.flags();
OS.setf(ios::scientific, ios::floatfield); OS.setf(ios::scientific, ios::floatfield);
OS.precision(15); OS.precision(15);
@ -1893,7 +1893,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
std::streamsize prec = OS.precision(15); std::streamsize prec = OS.precision(15);
#endif #endif
Poly::Write(T->Polygon2D(),OS); Poly::Write(T->Polygon2D(),OS);
#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F); OS.setf(F);
#else #else
OS.setf(form); OS.setf(form);

View File

@ -184,7 +184,7 @@ Handle(Draw_Drawable3D) DrawTrSurf_Point::Copy() const
void DrawTrSurf_Point::Dump(Standard_OStream& S) 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(); ios::fmtflags F = S.flags();
S.setf(ios::scientific,ios::floatfield); S.setf(ios::scientific,ios::floatfield);
S.precision(15); S.precision(15);
@ -196,7 +196,7 @@ void DrawTrSurf_Point::Dump(Standard_OStream& S) const
S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<endl; S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<endl;
else else
S << "Point 2d : " << myPoint.X() << ", " << myPoint.Y() <<endl; 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); S.setf(F);
#else #else
S.setf(form); S.setf(form);

View File

@ -81,7 +81,7 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
if (OpenMode() == Storage_VSNone) { if (OpenMode() == Storage_VSNone) {
#ifdef _WIN32 #if defined(_MSC_VER)
TCollection_ExtendedString aWName(aName); TCollection_ExtendedString aWName(aName);
if (aMode == Storage_VSRead) { if (aMode == Storage_VSRead) {
myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in); // ios::nocreate is not portable myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in); // ios::nocreate is not portable

View File

@ -1836,6 +1836,7 @@ Interpolation (const Standard_Real U1,
TMultiply(X3,Y3,Z3); TMultiply(X3,Y3,Z3);
return Standard_True; return Standard_True;
} }
X3 = Y3 = Z3 = XTI3 = YTI3 = ZTI3 = coef3 = U3 = 0.;
return Standard_False; return Standard_False;
} }

View File

@ -273,6 +273,7 @@
if((Theta<DomainInf) || if((Theta<DomainInf) ||
((Theta>DomainSup) && (!TwoCurves)) || ((Theta>DomainSup) && (!TwoCurves)) ||
(Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) { (Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
SigneSqrtDis = 0.;
Standard_DomainError::Raise("IntAna_Curve::Domain"); Standard_DomainError::Raise("IntAna_Curve::Domain");
} }

View File

@ -54,6 +54,10 @@
#include <TColStd_PackedMapOfInteger.hxx> #include <TColStd_PackedMapOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_SequenceOfInteger.hxx>
#ifdef _WIN32
#include <malloc.h> // for alloca()
#endif
IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder) IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
//================================================================ //================================================================

View File

@ -24,7 +24,7 @@
IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer) IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer)
#ifndef _WIN32 #if !defined(_MSC_VER)
#include <strings.h> #include <strings.h>
#endif #endif

View File

@ -181,7 +181,8 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
break; break;
case MoniTool_ValueEnum : { case MoniTool_ValueEnum : {
def.AssignCat("Enum"); def.AssignCat("Enum");
Standard_Integer startcase, endcase; Standard_Boolean match; Standard_Integer startcase=0, endcase=0;
Standard_Boolean match=0;
EnumDef (startcase,endcase,match); EnumDef (startcase,endcase,match);
Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase); Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase);
def.AssignCat(mess); def.AssignCat(mess);

View File

@ -69,6 +69,7 @@ NCollection_UtfIterator.hxx
NCollection_UtfIterator.lxx NCollection_UtfIterator.lxx
NCollection_UtfString.hxx NCollection_UtfString.hxx
NCollection_UtfString.lxx NCollection_UtfString.lxx
NCollection_UtfString.cxx
NCollection_Vec2.hxx NCollection_Vec2.hxx
NCollection_Vec3.hxx NCollection_Vec3.hxx
NCollection_Vec4.hxx NCollection_Vec4.hxx

View File

@ -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;
}

View File

@ -272,6 +272,28 @@ void NCollection_UtfString<Type>::FromUnicode (const TypeFrom* theStringU
strFree (anOldBuffer); 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 // function : FromLocale
// purpose : // purpose :
@ -280,34 +302,14 @@ template<typename Type> inline
void NCollection_UtfString<Type>::FromLocale (const char* theString, void NCollection_UtfString<Type>::FromLocale (const char* theString,
const Standard_Integer theLength) const Standard_Integer theLength)
{ {
#if(defined(_WIN32) || defined(__WIN32__)) NCollection_UtfStringTool aConvertor;
// use WinAPI wchar_t* aWideBuffer = aConvertor.FromLocale (theString);
int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0); if (aWideBuffer == NULL)
if (aWideSize <= 0)
{ {
Clear(); Clear();
return; 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); 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)
{
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 const Standard_Integer theSizeBytes) const
{ {
NCollection_UtfString<wchar_t> aWideCopy (myString, myLength); NCollection_UtfString<wchar_t> aWideCopy (myString, myLength);
#if(defined(_WIN32) || defined(__WIN32__)) return NCollection_UtfStringTool::ToLocale (aWideCopy.ToCString(), theBuffer, theSizeBytes);
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;
} }
// ======================================================================= // =======================================================================

View File

@ -34,7 +34,7 @@ NCollection_WinHeapAllocator::NCollection_WinHeapAllocator
#endif #endif
myToZeroMemory (Standard_False) myToZeroMemory (Standard_False)
{ {
#if(defined(_WIN32) || defined(__WIN32__)) #if defined(_WIN32) && (_WIN32_WINNT >= 0x0501)
// activate LHF to improve small size allocations // activate LHF to improve small size allocations
ULONG aHeapInfo = 2; ULONG aHeapInfo = 2;
HeapSetInformation (myHeapH, HeapCompatibilityInformation, HeapSetInformation (myHeapH, HeapCompatibilityInformation,

View File

@ -267,9 +267,7 @@ Standard_Boolean OSD_DirectoryIterator :: More () {
void OSD_DirectoryIterator :: Next () { void OSD_DirectoryIterator :: Next () {
if ( myFirstCall && !( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) || if ( ! myFirstCall || ! ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
!myFirstCall
) {
do { do {

View File

@ -384,7 +384,7 @@ return OSD_UNKNOWN ;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Read content of a file // Read content of a file
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void OSD_File::Read( Standard_Address& Buffer, void OSD_File::Read(const Standard_Address Buffer,
const Standard_Integer Nbyte, const Standard_Integer Nbyte,
Standard_Integer& Readbyte) Standard_Integer& Readbyte)
{ {
@ -841,11 +841,12 @@ void OSD_File::Rewind() {
#if defined(__CYGWIN32__) || defined(__MINGW32__) #if defined(__CYGWIN32__) || defined(__MINGW32__)
#define VAC #define VAC
#define _int64 int
#endif #endif
#pragma comment( lib, "WSOCK32.LIB" ) #if defined(_MSC_VER)
#pragma comment( lib, "WINSPOOL.LIB" ) #pragma comment( lib, "WSOCK32.LIB" )
#pragma comment( lib, "WINSPOOL.LIB" )
#endif
#define ACE_HEADER_SIZE ( sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD ) ) #define ACE_HEADER_SIZE ( sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD ) )
@ -1085,19 +1086,18 @@ void OSD_File :: Read (
} }
Standard_Integer NbyteRead; Standard_Integer NbyteRead;
Standard_Address buff;
TEST_RAISE( "Read" ); TEST_RAISE( "Read" );
buff = ( Standard_Address )new Standard_Character[ Nbyte + 1 ]; char* buff = new Standard_Character[ Nbyte + 1 ];
Read ( buff, Nbyte, NbyteRead ); Read ( buff, Nbyte, NbyteRead );
( ( Standard_PCharacter )buff )[ NbyteRead ] = 0; buff[ NbyteRead ] = 0;
if ( NbyteRead != 0 ) if ( NbyteRead != 0 )
Buffer = ( Standard_PCharacter )buff; Buffer = buff;
else else
@ -1259,7 +1259,7 @@ void OSD_File :: ReadLine (
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void OSD_File :: Read ( void OSD_File :: Read (
Standard_Address& Buffer, const Standard_Address Buffer,
const Standard_Integer Nbyte, Standard_Integer& Readbyte const Standard_Integer Nbyte, Standard_Integer& Readbyte
) { ) {
@ -1456,7 +1456,7 @@ OSD_KindFile OSD_File :: KindOfFile () const {
typedef struct _osd_wnt_key { typedef struct _osd_wnt_key {
HKEY hKey; HKEY hKey;
LPTSTR keyPath; const char* keyPath;
} OSD_WNT_KEY; } OSD_WNT_KEY;
@ -1627,23 +1627,26 @@ Standard_Boolean OSD_File :: IsLocked () {
// Return size of a file // Return size of a file
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
Standard_Size OSD_File :: Size () { Standard_Size OSD_File::Size()
{
Standard_Integer retVal; TEST_RAISE("Size");
#if (_WIN32_WINNT >= 0x0500)
TEST_RAISE( "Size" ); LARGE_INTEGER aSize;
aSize.QuadPart = 0;
LARGE_INTEGER aSize; if (GetFileSizeEx (myFileHandle, &aSize) == 0)
aSize.QuadPart = 0; {
retVal = GetFileSizeEx (myFileHandle, &aSize); _osd_wnt_set_error (myError, OSD_WFile);
}
if ( retVal == 0 ) return (Standard_Size)aSize.QuadPart;
#else
_osd_wnt_set_error ( myError, OSD_WFile ); DWORD aSize = GetFileSize (myFileHandle, NULL);
if (aSize == INVALID_FILE_SIZE)
return (Standard_Size)aSize.QuadPart; {
_osd_wnt_set_error (myError, OSD_WFile);
} // end OSD_File :: Size }
return aSize;
#endif
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Print contains of a file // Print contains of a file
@ -1701,9 +1704,9 @@ PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd (
DWORD dwAccessOwner; DWORD dwAccessOwner;
DWORD dwAccessWorld; DWORD dwAccessWorld;
DWORD dwAccessAdminDir; DWORD dwAccessAdminDir;
DWORD dwAccessGroupDir; // DWORD dwAccessGroupDir;
DWORD dwAccessOwnerDir; DWORD dwAccessOwnerDir;
DWORD dwAccessWorldDir; // DWORD dwAccessWorldDir;
DWORD dwACLsize = sizeof ( ACL ); DWORD dwACLsize = sizeof ( ACL );
DWORD dwIndex = 0; DWORD dwIndex = 0;
PTOKEN_OWNER pTkOwner = NULL; PTOKEN_OWNER pTkOwner = NULL;
@ -1769,9 +1772,9 @@ retry:
dwAccessWorld = _get_access_mask ( prot.World () ); dwAccessWorld = _get_access_mask ( prot.World () );
dwAccessAdminDir = _get_dir_access_mask ( prot.System () ); 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 () ); dwAccessOwnerDir = _get_dir_access_mask ( prot.User () );
dwAccessWorldDir = _get_dir_access_mask ( prot.World () ); // dwAccessWorldDir = _get_dir_access_mask ( prot.World () );
if ( dwAccessGroup != 0 ) { if ( dwAccessGroup != 0 ) {

View File

@ -117,7 +117,7 @@ public:
//! may be less than Nbyte if the number of bytes left in the file //! may be less than Nbyte if the number of bytes left in the file
//! is less than Nbyte bytes. For this reason the output //! is less than Nbyte bytes. For this reason the output
//! parameter Readbyte will contain the number of read bytes. //! 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 //! Attempts to write Nbyte bytes from the AsciiString to the file
//! associated to the object File. //! associated to the object File.

View File

@ -345,9 +345,7 @@ Standard_Boolean OSD_FileIterator :: More () {
void OSD_FileIterator :: Next () { void OSD_FileIterator :: Next () {
if ( myFirstCall && ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) || if ( ! myFirstCall || ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
!myFirstCall
) {
do { do {

View File

@ -187,7 +187,9 @@ Standard_Integer OSD_Host::Error()const{
#include <OSD_Host.hxx> #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, ... ); void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );

View File

@ -58,11 +58,18 @@ void OSD_MemInfo::Update()
myCounters[anIter] = Standard_Size(-1); myCounters[anIter] = Standard_Size(-1);
} }
#if (defined(_WIN32) || defined(__WIN32__)) #if defined(_WIN32)
#if (_WIN32_WINNT >= 0x0500)
MEMORYSTATUSEX aStatEx; MEMORYSTATUSEX aStatEx;
aStatEx.dwLength = sizeof(aStatEx); aStatEx.dwLength = sizeof(aStatEx);
GlobalMemoryStatusEx (&aStatEx); GlobalMemoryStatusEx (&aStatEx);
myCounters[MemVirtual] = Standard_Size(aStatEx.ullTotalVirtual - aStatEx.ullAvailVirtual); 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 // use Psapi library
HANDLE aProcess = GetCurrentProcess(); HANDLE aProcess = GetCurrentProcess();

View File

@ -11,6 +11,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifdef _WIN32
#include <windows.h>
#endif
#include <OSD_OpenFile.hxx> #include <OSD_OpenFile.hxx>
#include <TCollection_ExtendedString.hxx> #include <TCollection_ExtendedString.hxx>
#include <NCollection_UtfString.hxx> #include <NCollection_UtfString.hxx>
@ -23,7 +27,7 @@ FILE* OSD_OpenFile(const char* theName,
const char* theMode) const char* theMode)
{ {
FILE* aFile = 0; FILE* aFile = 0;
#ifdef _WIN32 #if defined(_WIN32)
// file name is treated as UTF-8 string and converted to UTF-16 one // file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True); const TCollection_ExtendedString aFileNameW (theName, Standard_True);
const TCollection_ExtendedString aFileModeW (theMode, Standard_True); const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
@ -43,7 +47,7 @@ FILE* OSD_OpenFile(const TCollection_ExtendedString& theName,
const char* theMode) const char* theMode)
{ {
FILE* aFile = 0; FILE* aFile = 0;
#ifdef _WIN32 #if defined(_WIN32)
const TCollection_ExtendedString aFileModeW (theMode, Standard_True); const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(), aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(),
(const wchar_t* )aFileModeW.ToExtString()); (const wchar_t* )aFileModeW.ToExtString());
@ -63,7 +67,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
const char* theName, const char* theName,
const std::ios_base::openmode theMode) 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 // file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True); const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode); theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
@ -80,7 +84,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
const TCollection_ExtendedString& theName, const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode) const std::ios_base::openmode theMode)
{ {
#ifdef _WIN32 #if defined(_WIN32) && defined(_MSC_VER)
theBuff.open ((const wchar_t* )theName.ToExtString(), theMode); theBuff.open ((const wchar_t* )theName.ToExtString(), theMode);
#else #else
// conversion in UTF-8 for linux // conversion in UTF-8 for linux
@ -97,7 +101,7 @@ void OSD_OpenStream(std::ofstream& theStream,
const char* theName, const char* theName,
const std::ios_base::openmode theMode) 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 // file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True); const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode); theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
@ -114,7 +118,7 @@ void OSD_OpenStream(std::ofstream& theStream,
const TCollection_ExtendedString& theName, const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode) const std::ios_base::openmode theMode)
{ {
#ifdef _WIN32 #if defined(_WIN32) && defined(_MSC_VER)
theStream.open ((const wchar_t* )theName.ToExtString(), theMode); theStream.open ((const wchar_t* )theName.ToExtString(), theMode);
#else #else
// conversion in UTF-8 for linux // conversion in UTF-8 for linux
@ -131,7 +135,7 @@ void OSD_OpenStream (std::ifstream& theStream,
const char* theName, const char* theName,
const std::ios_base::openmode theMode) 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 // file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True); const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode); theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode);
@ -148,7 +152,7 @@ void OSD_OpenStream (std::ifstream& theStream,
const TCollection_ExtendedString& theName, const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode) const std::ios_base::openmode theMode)
{ {
#ifdef _WIN32 #if defined(_WIN32) && defined(_MSC_VER)
theStream.open ((const wchar_t*)theName.ToExtString(), theMode); theStream.open ((const wchar_t*)theName.ToExtString(), theMode);
#else #else
// conversion in UTF-8 for linux // conversion in UTF-8 for linux

View File

@ -1103,7 +1103,7 @@ Standard_Integer OSD_Path :: TrekLength () const {
Standard_Integer i = 1; Standard_Integer i = 1;
Standard_Integer retVal = 0; Standard_Integer retVal = 0;
if ( myTrek.IsEmpty () || myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|' ) if ( myTrek.IsEmpty () || (myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|') )
return retVal; return retVal;

View File

@ -197,8 +197,9 @@ Standard_Integer OSD_Process::Error()const{
#include <OSD_WNT_1.hxx> #include <OSD_WNT_1.hxx>
#include <LMCONS.H> /// pour UNLEN ( see MSDN about GetUserName() ) #include <LMCONS.H> /// pour UNLEN ( see MSDN about GetUserName() )
#if defined(_MSC_VER)
#pragma warning( disable : 4700 ) #pragma warning( disable : 4700 )
#endif
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... ); void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );

View File

@ -35,10 +35,6 @@
# endif # endif
# endif /* OSDAPI */ # endif /* OSDAPI */
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#define _TINT int
#endif
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
# endif /* __cplusplus */ # endif /* __cplusplus */

View File

@ -24,6 +24,12 @@
#endif #endif
#include <windows.h> #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_ACCESS_VIOLATION.hxx>
#include <OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx> #include <OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx>
#include <OSD_Exception_ILLEGAL_INSTRUCTION.hxx> #include <OSD_Exception_ILLEGAL_INSTRUCTION.hxx>

View File

@ -559,7 +559,7 @@ void* OpenGl_Context::findProc (const char* theFuncName)
#if defined(HAVE_EGL) #if defined(HAVE_EGL)
return (void* )eglGetProcAddress (theFuncName); return (void* )eglGetProcAddress (theFuncName);
#elif defined(_WIN32) #elif defined(_WIN32)
return wglGetProcAddress (theFuncName); return (void* )wglGetProcAddress (theFuncName);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL; return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL;
#else #else

View File

@ -20,6 +20,9 @@
#include <Standard_Assert.hxx> #include <Standard_Assert.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#ifdef _WIN32
#include <malloc.h> // for alloca()
#endif
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderObject,OpenGl_Resource) IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderObject,OpenGl_Resource)

View File

@ -28,6 +28,10 @@
#include <OpenGl_GlCore32.hxx> #include <OpenGl_GlCore32.hxx>
#ifdef _WIN32
#include <malloc.h> // for alloca()
#endif
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource) IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource)
OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector(); OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector();

View File

@ -122,13 +122,13 @@ Handle(CDM_MetaData) PCDM_ReferenceIterator::MetaData(const Standard_Boolean ) c
switch ( chr ) { switch ( chr ) {
case _TEXT( '|' ): case '|':
dirRet += _TEXT( "/" ); dirRet += "/";
break; break;
case _TEXT( '^' ): case '^':
dirRet += _TEXT( ".." ); dirRet += "..";
break; break;
default: default:

View File

@ -2385,7 +2385,7 @@ static int StackOverflow (int i = -1)
#endif #endif
// this code does not work with optimize mode on Windows // this code does not work with optimize mode on Windows
#ifdef _WIN32 #if defined(_MSC_VER)
#pragma optimize( "", off ) #pragma optimize( "", off )
#endif #endif
static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 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; return 0;
} }
#ifdef _WIN32 #if defined(_MSC_VER)
#pragma optimize( "", on ) #pragma optimize( "", on )
#endif #endif

View File

@ -84,7 +84,7 @@ Standard_MMgrFactory::Standard_MMgrFactory()
aVar = getenv ("MMGT_OPT"); aVar = getenv ("MMGT_OPT");
Standard_Integer anAllocId = (aVar ? atoi (aVar): OCCT_MMGT_OPT_DEFAULT); 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); static const DWORD _SSE2_FEATURE_BIT(0x04000000);
if ( anAllocId == 2 ) if ( anAllocId == 2 )
{ {

View File

@ -72,7 +72,7 @@ inline void Standard_ASSERT_DO_NOTHING() {}
// User messages are activated in debug mode only // User messages are activated in debug mode only
#ifdef _DEBUG #ifdef _DEBUG
#if (defined(_WIN32) || defined(__WIN32__)) #if (defined(_WIN32) || defined(__WIN32__))
#if defined(_MSC_VER) #if defined(_MSC_VER) || defined(__MINGW64__)
// VS-specific intrinsic // VS-specific intrinsic
#define Standard_ASSERT_DBGBREAK_() __debugbreak() #define Standard_ASSERT_DBGBREAK_() __debugbreak()
#else #else

View File

@ -32,7 +32,7 @@ namespace
CLocalePtr() CLocalePtr()
#ifdef HAVE_XLOCALE_H #ifdef HAVE_XLOCALE_H
: myLocale (newlocale (LC_ALL_MASK, "C", NULL)) : myLocale (newlocale (LC_ALL_MASK, "C", NULL))
#elif defined(_WIN32) #elif defined(_WIN32) && !defined(__MINGW32__)
: myLocale (_create_locale (LC_ALL, "C")) : myLocale (_create_locale (LC_ALL, "C"))
#else #else
: myLocale (NULL) : myLocale (NULL)
@ -43,7 +43,7 @@ namespace
{ {
#ifdef HAVE_XLOCALE_H #ifdef HAVE_XLOCALE_H
freelocale (myLocale); freelocale (myLocale);
#elif defined(_WIN32) #elif defined(_WIN32) && !defined(__MINGW32__)
_free_locale (myLocale); _free_locale (myLocale);
#endif #endif
} }

View File

@ -65,7 +65,7 @@ public:
#ifdef HAVE_XLOCALE_H #ifdef HAVE_XLOCALE_H
typedef locale_t clocale_t; typedef locale_t clocale_t;
#elif defined(_WIN32) #elif defined(_WIN32) && !defined(__MINGW32__)
typedef _locale_t clocale_t; typedef _locale_t clocale_t;
#else #else
typedef void* clocale_t; typedef void* clocale_t;

View File

@ -63,7 +63,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
#ifdef __APPLE__ #ifdef __APPLE__
// There are a lot of *_l functions availalbe on Mac OS X - we use them // There are a lot of *_l functions availalbe on Mac OS X - we use them
#define SAVE_TL() #define SAVE_TL()
#elif defined(_WIN32) #elif defined(_WIN32) && !defined(__MINGW32__)
// MSVCRT has equivalents with slightly different syntax // MSVCRT has equivalents with slightly different syntax
#define SAVE_TL() #define SAVE_TL()
#define strtod_l(thePtr, theNextPtr, theLocale) _strtod_l(thePtr, theNextPtr, theLocale) #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 // glibc version for android platform use locale-independent implementation of
// strtod, strtol, strtoll functions. For other system with locale-depended // strtod, strtol, strtoll functions. For other system with locale-depended
// implementations problems may appear if "C" locale is not set explicitly. // 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. #error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
#endif #endif
#define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr) #define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr)

View File

@ -17,7 +17,7 @@
#ifndef _Standard_values_HeaderFile #ifndef _Standard_values_HeaderFile
# define _Standard_values_HeaderFile # define _Standard_values_HeaderFile
#ifdef _WIN32 #if defined(_MSC_VER)
# include <limits> # include <limits>
#else #else
# include <limits.h> # include <limits.h>

View File

@ -57,7 +57,7 @@ TCollection_AsciiString::TCollection_AsciiString()
// Create an asciistring from a Standard_CString // Create an asciistring from a Standard_CString
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring) TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring)
: mystring(0) : mystring(0), mylength(0)
{ {
if (astring) { if (astring) {
mylength = Standard_Integer( strlen(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, TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring,
const Standard_Integer aLen ) const Standard_Integer aLen )
: mystring(0) : mystring(0), mylength(aLen)
{ {
if (astring) { if (astring) {
mylength = aLen ;
mystring = Allocate(mylength+1); mystring = Allocate(mylength+1);
strncpy( mystring , astring , mylength ); strncpy( mystring , astring , mylength );
mystring [ mylength ] = '\0' ; mystring [ mylength ] = '\0' ;

View File

@ -133,6 +133,7 @@ TCollection_ExtendedString::TCollection_ExtendedString()
TCollection_ExtendedString::TCollection_ExtendedString TCollection_ExtendedString::TCollection_ExtendedString
(const Standard_CString astring, (const Standard_CString astring,
const Standard_Boolean isMultiByte) const Standard_Boolean isMultiByte)
: mystring(0), mylength(0)
{ {
if (astring) { if (astring) {
if(!isMultiByte) { if(!isMultiByte) {
@ -166,6 +167,7 @@ TCollection_ExtendedString::TCollection_ExtendedString
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
TCollection_ExtendedString::TCollection_ExtendedString TCollection_ExtendedString::TCollection_ExtendedString
(const Standard_ExtString astring) (const Standard_ExtString astring)
: mystring(0), mylength(0)
{ {
if (astring) { if (astring) {

View File

@ -7,3 +7,4 @@ CSF_XwLibs
CSF_OpenGlLibs CSF_OpenGlLibs
CSF_user32 CSF_user32
CSF_gdi32 CSF_gdi32
CSF_d3d9

View File

@ -4,3 +4,6 @@ CSF_gdi32
CSF_user32 CSF_user32
CSF_TBB CSF_TBB
CSF_dl CSF_dl
CSF_wsock32
CSF_winspool
CSF_psapi

View File

@ -69,7 +69,11 @@ void TopOpeBRepBuild_GIter::Next()
void TopOpeBRepBuild_GIter::Current(TopAbs_State& s1, TopAbs_State& s2) const 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; Standard_Integer i1,i2;
MYGTOPO.Index(myII,i1,i2); MYGTOPO.Index(myII,i1,i2);
s1 = MYGTOPO.GState(i1); s1 = MYGTOPO.GState(i1);

View 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_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); Standard_Boolean b = Value(i1,i2);
return b; return b;
} }

View File

@ -1446,7 +1446,9 @@ Standard_EXPORT Standard_Integer FUN_ds_hasI2d(
Standard_Boolean is3d = Standard_False; Standard_Boolean is3d = Standard_False;
for (; itF.More(); itF.Next()){ for (; itF.More(); itF.Next()){
const Handle(TopOpeBRepDS_Interference)& IF = itF.Value(); 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 (GE != GF) continue;
if (SF==isb) { if (SF==isb) {
is3d = Standard_True; is3d = Standard_True;

View File

@ -20,7 +20,9 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#pragma comment( lib, "comdlg32.lib" ) #if defined(_MSC_VER)
#pragma comment( lib, "comdlg32.lib" )
#endif
#endif #endif

View File

@ -139,7 +139,7 @@
#include <TColStd_HArray1OfAsciiString.hxx> #include <TColStd_HArray1OfAsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx> #include <TColStd_HSequenceOfAsciiString.hxx>
#ifdef _WIN32 #if defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE # define _CRT_SECURE_NO_DEPRECATE
# pragma warning (disable:4996) # pragma warning (disable:4996)
#endif #endif

View File

@ -234,7 +234,7 @@ const Handle(MMgt_TShared)& ViewerTest::WClass()
#if defined(_WIN32) #if defined(_WIN32)
if (theWClass.IsNull()) 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, CS_VREDRAW | CS_HREDRAW, 0, 0,
::LoadCursor (NULL, IDC_ARROW)); ::LoadCursor (NULL, IDC_ARROW));
} }
@ -8649,7 +8649,7 @@ static Standard_Integer VProgressiveMode (Draw_Interpretor& /*theDI*/,
Standard_Boolean toExit = Standard_False; Standard_Boolean toExit = Standard_False;
MSG aMsg; 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)) if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b))
{ {

View File

@ -63,7 +63,7 @@ WNT_WClass::WNT_WClass (
lpszName = new char[ strlen ( aClassName ) + 1 ]; lpszName = new char[ strlen ( aClassName ) + 1 ];
strcpy ( (Standard_PCharacter)lpszName, aClassName ); strcpy ( (Standard_PCharacter)lpszName, aClassName );
lpfnWndProc = wc.lpfnWndProc; lpfnWndProc = (void* )wc.lpfnWndProc;
} // end constructor } // end constructor

View File

@ -221,10 +221,10 @@ Aspect_TypeOfResize WNT_Window::DoResize() const
if (wp.showCmd != SW_SHOWMINIMIZED) if (wp.showCmd != SW_SHOWMINIMIZED)
{ {
if (Abs (wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1; if (Abs ((int )wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1;
if (Abs (wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2; if (Abs ((int )wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2;
if (Abs (wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4; if (Abs ((int )wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4;
if (Abs (wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8; if (Abs ((int )wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8;
switch (mask) switch (mask)
{ {

View File

@ -378,13 +378,13 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
switch ( chr ) { switch ( chr ) {
case _TEXT( '|' ): case '|':
dirRet += _TEXT( "/" ); dirRet += "/";
break; break;
case _TEXT( '^' ): case '^':
dirRet += _TEXT( ".." ); dirRet += "..";
break; break;
default: default: