1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0022898: IGES import fails in german environment

Added DRAW command dlocale to set and query current locale of the C subsystem
Equivalents of C functions working with conversions of strings to/from reals added in Standard_CString, providing locale-independent behavior (using always "C" locale)
In DRAW packages, calls to atof() and atoi() are replaced by direct calls to Draw::Atof() and Draw::Atoi(), respectively, instead of substituting by #define
Use of atof(), strtod(), and *scanf() involving floating point conversions in OCCT code replaced by locale-independent Atof() and Strtod()
Calls to sprintf() involving floating point in OCCT code are replaced by call to locale-independent Sprintf(), except a few places where converted strings are used immediately for display in the 3d viewer
Changes of global locale are eliminated throughout OCCT code
Proposed correction for GNU libC where v*printf_l functions are absent
Added test case (bugs xde bug22898) for data exchange operations with non-standard locale
Use xlocale on Mac OS X and within glibc
Corrected strtod_l wrapper
Generate error rather than warning
Introduce Standard_CLocaleSentry replacement for removed OSD_Localizer
Standard_CLocaleSentry - copy locale string
Standard_CLocaleSentry - use _configthreadlocale on Windows
Standard_CLocaleSentry::GetCLocale() - return locale_t rather than void*
Corrected misprint in ~Standard_CLocaleSentry()
Use French locale in bug22898 test case
Mark test case as skipped if locale is unavailable on tested system.
Use fr_FR locale for tests on Mac OS X
This commit is contained in:
abv
2013-02-01 18:41:16 +04:00
parent 3bea4c165c
commit 91322f44fd
203 changed files with 2707 additions and 2807 deletions

View File

@@ -97,9 +97,9 @@ static Standard_Integer writestl
Standard_Boolean isASCIIMode = Standard_False;
Standard_Boolean isInParallel = Standard_False;
if (argc > 3) {
isASCIIMode = (atoi(argv[3]) == 0);
isASCIIMode = (Draw::Atoi(argv[3]) == 0);
if (argc > 4) {
isInParallel = (atoi(argv[4]) == 1);
isInParallel = (Draw::Atoi(argv[4]) == 1);
Standard::SetReentrant(isInParallel);
}
}
@@ -222,9 +222,9 @@ static Standard_Integer storevrml
}
else {
TopoDS_Shape shape = DBRep::Get(argv[1]);
Standard_Real defl = atof(argv[3]);
Standard_Real defl = Draw::Atof(argv[3]);
Standard_Integer type = 1;
if(argc > 4) type = atoi(argv[4]);
if(argc > 4) type = Draw::Atoi(argv[4]);
type = Max(0, type);
type = Min(2, type);
@@ -347,8 +347,7 @@ static Standard_Integer meshdm
Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
if( !aMesh.IsNull() )
{
Standard_Integer DisplayMode = 0;
sscanf( argv[2], "%i", &DisplayMode );
Standard_Integer DisplayMode = Draw::Atoi (argv[2]);
Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
@@ -381,8 +380,7 @@ static Standard_Integer meshsm
Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
if( !aMesh.IsNull() )
{
Standard_Integer SelMode = 0;
sscanf( argv[2], "%i", &SelMode );
Standard_Integer SelMode = Draw::Atoi (argv[2]);
Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
@@ -438,10 +436,9 @@ static Standard_Integer setcolor
Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
if( !aMesh.IsNull() )
{
Standard_Real r, g, b;
sscanf( argv[2], "%lf", &r );
sscanf( argv[3], "%lf", &g );
sscanf( argv[4], "%lf", &b );
Standard_Real r = Draw::Atof (argv[2]);
Standard_Real g = Draw::Atof (argv[3]);
Standard_Real b = Draw::Atof (argv[4]);
aMesh->GetDrawer()->SetColor( (MeshVS_DrawerAttribute)Param, Quantity_Color( r, g, b, Quantity_TOC_RGB ) );
Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
@@ -477,8 +474,7 @@ static Standard_Integer meshmat
Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
if( !aMesh.IsNull() )
{
Standard_Integer mat;
sscanf( argv[2], "%i", &mat );
Standard_Integer mat = Draw::Atoi (argv[2]);
Graphic3d_MaterialAspect aMatAsp =
(Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)mat;
@@ -507,8 +503,7 @@ static Standard_Integer shrink
Handle( MeshVS_Mesh ) aMesh = getMesh( argv[1], di );
if( !aMesh.IsNull() )
{
Standard_Real sh;
sscanf( argv[2], "%lf", &sh );
Standard_Real sh = Draw::Atof (argv[2]);
aMesh->GetDrawer()->SetDouble( MeshVS_DA_ShrinkCoeff, sh );
Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
@@ -773,7 +768,7 @@ static Standard_Integer meshcolors( Draw_Interpretor& di,
if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none") )
{
Handle(MeshVS_PrsBuilder) aTempBuilder;
Standard_Integer reflection = atoi(argv[3]);
Standard_Integer reflection = Draw::Atoi(argv[3]);
for (int count = 0 ; count < aMesh->GetBuildersCount(); count++ ){
aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder"));
@@ -928,13 +923,13 @@ static Standard_Integer mesh_edge_width( Draw_Interpretor& di,
}
const char* aWidthStr = argv[ 2 ];
if ( aWidthStr == 0 || atof( aWidthStr ) <= 0 )
if ( aWidthStr == 0 || Draw::Atof( aWidthStr ) <= 0 )
{
di << "Width must be real value more than zero" << "\n";
return 0;
}
double aWidth = atof( aWidthStr );
double aWidth = Draw::Atof( aWidthStr );
Handle(AIS_InteractiveContext) anIC = ViewerTest::GetAISContext();
if ( anIC.IsNull() )