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

@@ -35,6 +35,7 @@
#include <TColStd_HSequenceOfReal.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Graphic3d_GraphicDevice.hxx>
#include <Draw.hxx>
#include <Draw_Window.hxx>
#include <Draw_Viewer.hxx>
#include <Aspect_WindowDriver.hxx>
@@ -106,7 +107,7 @@ static Standard_Boolean shouldDUP() {
"QA_DUP",TCL_GLOBAL_ONLY);
#endif
Standard_Integer aDUP=1;
if((adup != NULL) && (atof(adup) == 0)) {
if((adup != NULL) && (Draw::Atof(adup) == 0)) {
aDUP = 0;
}
@@ -363,16 +364,16 @@ static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& theDi,
anAISWindow->Size (aWindowSizeX, aWindowSizeY);
Standard_Integer anArgIter = 1;
const Standard_Integer aPickCoordX = atoi (theArgs[anArgIter++]);
const Standard_Integer aPickCoordY = atoi (theArgs[anArgIter++]);
const Standard_Integer aPickCoordX = Draw::Atoi (theArgs[anArgIter++]);
const Standard_Integer aPickCoordY = Draw::Atoi (theArgs[anArgIter++]);
const Standard_Integer aRadius = (theArgsNb == 3) ? 0 : 1;
Image_ColorRGBF aColorInput = {{ 0.0f, 0.0f, 0.0f }};
if (theArgsNb == 6)
{
aColorInput.r() = (Standard_ShortReal )atof (theArgs[anArgIter++]);
aColorInput.g() = (Standard_ShortReal )atof (theArgs[anArgIter++]);
aColorInput.b() = (Standard_ShortReal )atof (theArgs[anArgIter++]);
aColorInput.r() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
aColorInput.g() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
aColorInput.b() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
}
Image_PixMap anImage;
@@ -495,9 +496,9 @@ static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integ
Standard_Integer QAAIS_MousePoint_X = 0;
Standard_Integer QAAIS_MousePoint_Y = 0;
Standard_Character QAAIS_MousePointX[32];
sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
Standard_Character QAAIS_MousePointY[32];
sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
Standard_ShortReal QAAIS_ColorRED = 0;
Standard_ShortReal QAAIS_ColorGRN = 0;
Standard_ShortReal QAAIS_ColorBLU = 0;
@@ -524,8 +525,8 @@ static Standard_Integer QAAISGetColorCoord (Draw_Interpretor& di, Standard_Integ
QAAIS_ColorView -> SetBackgroundColor (QAAIS_ShowingColor);
QAAIS_ColorView -> Redraw ();
QAAIS_CoordWindow.Clear();
sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
Sprintf (QAAIS_MousePointX, "X : %d", QAAIS_MousePoint_X);
Sprintf (QAAIS_MousePointY, "Y : %d", QAAIS_MousePoint_Y);
QAAIS_CoordWindow.DrawString (30, 35, QAAIS_MousePointX);
QAAIS_CoordWindow.DrawString (125, 35, QAAIS_MousePointY);
}
@@ -628,7 +629,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di,
static Standard_Integer ViewId(const Standard_CString a)
{
Standard_Integer id = atoi(a);
Standard_Integer id = Draw::Atoi(a);
if ((id < 0) || (id >= MAXVIEW)) {
cout << "Incorrect view-id, must be in 0.."<<MAXVIEW-1<<endl;
return -1;