Warnings issued by gcc 8.1.0 are eliminated.
New function OSD_FunctionCast() is introduced to explicitly mark places where the conversion from the pointer to one function type to the pointer to another function type takes place and to suppress gcc warning "-Wcast-function-type" (introduced in gcc 8.1.0).
}
BiTgte_ContactType Type = BiTgte_VertexVertex;
- switch (Type1) {
-
- case TopAbs_VERTEX:
- switch (Type2) {
- case TopAbs_VERTEX: Type = BiTgte_VertexVertex; break;
- case TopAbs_EDGE: Type = BiTgte_EdgeVertex; break;
- case TopAbs_FACE: Type = BiTgte_FaceVertex; break;
- default:
+ switch (Type1)
+ {
+ case TopAbs_VERTEX:
+ switch (Type2)
+ {
+ case TopAbs_VERTEX: Type = BiTgte_VertexVertex; break;
+ case TopAbs_EDGE: Type = BiTgte_EdgeVertex; break;
+ case TopAbs_FACE: Type = BiTgte_FaceVertex; break;
+ default:
+ break;
+ }
break;
- }
-
- case TopAbs_EDGE:
- switch (Type2) {
- case TopAbs_EDGE: Type = BiTgte_EdgeEdge; break;
- case TopAbs_FACE: Type = BiTgte_FaceEdge; break;
- default:
+
+ case TopAbs_EDGE:
+ switch (Type2)
+ {
+ case TopAbs_EDGE: Type = BiTgte_EdgeEdge; break;
+ case TopAbs_FACE: Type = BiTgte_FaceEdge; break;
+ default:
+ break;
+ }
break;
- }
-
- case TopAbs_FACE:
- switch (Type2) {
- case TopAbs_FACE: Type = BiTgte_FaceEdge; break;
+
+ case TopAbs_FACE:
+ switch (Type2)
+ {
+ case TopAbs_FACE: Type = BiTgte_FaceEdge; break;
+ default:
+ break;
+ }
+ break;
+
default:
break;
- }
- default:
- break;
}
-
+
return Type;
}
#include <D3DHost_GraphicDriver.hxx>
#include <TCollection_ExtendedString.hxx>
+#include <OSD_Function.hxx>
IMPLEMENT_STANDARD_RTTIEXT(D3DHost_View,OpenGl_View)
{
// retrieve D3D9Ex function dynamically (available only since Vista+)
typedef HRESULT (WINAPI* Direct3DCreate9Ex_t)(UINT , IDirect3D9Ex** );
- Direct3DCreate9Ex_t Direct3DCreate9ExProc = (Direct3DCreate9Ex_t )GetProcAddress (aLib, "Direct3DCreate9Ex");
+ Direct3DCreate9Ex_t Direct3DCreate9ExProc = OSD_FunctionCast<Direct3DCreate9Ex_t> (GetProcAddress (aLib, "Direct3DCreate9Ex"));
if (Direct3DCreate9ExProc != NULL)
{
Direct3DCreate9ExProc(D3D_SDK_VERSION, &aD3dLibEx);
typedef BOOL (WINAPI *SetDllDirectoryW_t)(const wchar_t* thePathName);
HMODULE aKern32Module = GetModuleHandleW (L"kernel32");
SetDllDirectoryW_t aFunc = (aKern32Module != NULL)
- ? (SetDllDirectoryW_t )GetProcAddress (aKern32Module, "SetDllDirectoryW") : NULL;
+ ? OSD_FunctionCast<SetDllDirectoryW_t> (GetProcAddress (aKern32Module, "SetDllDirectoryW")) : NULL;
if (aFunc != NULL)
{
aFunc (aUserDllPath.ToWideString());
// fp = (void (*)(Draw_Interpretor&, const TCollection_AsciiString&)) f;
// (*fp) (theDI, theKey);
- void (*fp) (Draw_Interpretor&) = NULL;
- fp = (void (*)(Draw_Interpretor&)) f;
+ void (*fp) (Draw_Interpretor&) = OSD_FunctionCast<void (*) (Draw_Interpretor&)> (f);
(*fp) (theDI);
}
y2=a4;
}
-static DWORD WINAPI tkLoop(VOID);
+static DWORD WINAPI tkLoop (LPVOID theThreadParameter);
#ifdef _TK
static Tk_Window mainWindow;
#endif
dwMainThreadId = GetCurrentThreadId();
//necessary for normal Tk operation
- hThread = CreateThread(NULL, // no security attributes
- 0, // use default stack size
- (LPTHREAD_START_ROUTINE) tkLoop, // thread function
- NULL, // no thread function argument
- 0, // use default creation flags
- &IDThread);
+ hThread = CreateThread (NULL, // no security attributes
+ 0, // use default stack size
+ tkLoop, // thread function
+ NULL, // no thread function argument
+ 0, // use default creation flags
+ &IDThread);
if (!hThread) {
std::cout << "Failed to create Tcl/Tk main loop thread. Switching to batch mode..." << std::endl;
Draw_Batch = Standard_True;
/*--------------------------------------------------------*\
| readStdinThreadFunc
\*--------------------------------------------------------*/
-static DWORD WINAPI readStdinThreadFunc()
+static DWORD WINAPI readStdinThreadFunc (const LPVOID theThreadParameter)
{
+ (void)theThreadParameter;
if (!Draw_IsConsoleSubsystem)
{
return 1;
/*--------------------------------------------------------*\
| tkLoop: implements Tk_Main()-like behaviour in a separate thread
\*--------------------------------------------------------*/
-static DWORD WINAPI tkLoop(VOID)
+static DWORD WINAPI tkLoop (const LPVOID theThreadParameter)
{
+ (void)theThreadParameter;
Tcl_CreateExitHandler(exitProc, 0);
Draw_Interpretor& aCommands = Draw::GetInterpretor();
#endif
}
}
- catch (Standard_Failure)
+ catch (const Standard_Failure&)
{
std::cout << "tkLoop: exception in TK_Init\n";
}
DWORD IDThread;
HANDLE hThread;
if (Draw_IsConsoleSubsystem) {
- hThread = CreateThread(NULL, // no security attributes
- 0, // use default stack size
- (LPTHREAD_START_ROUTINE) readStdinThreadFunc, // thread function
- NULL, // no thread function argument
- 0, // use default creation flags
- &IDThread); // returns thread identifier
+ hThread = CreateThread (NULL, // no security attributes
+ 0, // use default stack size
+ readStdinThreadFunc, // thread function
+ NULL, // no thread function argument
+ 0, // use default creation flags
+ &IDThread); // returns thread identifier
if (!hThread) {
std::cout << "pb in creation of the thread reading stdin" << std::endl;
Draw_IsConsoleSubsystem = Standard_False;
{
// Reverse the bytes throughout the buffer
const Standard_ExtCharacter* const anEnd =
- reinterpret_cast<const Standard_ExtCharacter* const>(&anMsgBuffer[aFileSize]);
+ reinterpret_cast<const Standard_ExtCharacter*>(&anMsgBuffer[aFileSize]);
for (Standard_ExtCharacter* aPtr = aUnicodeBuffer; aPtr < anEnd; aPtr++)
{
#ifndef OSD_Function_HeaderFile
#define OSD_Function_HeaderFile
+#include <Standard_Std.hxx>
+
// This is in fact a pointer to a function.
// This is not an "enumeration" but a trick to solve an omission from CDL.
typedef int (* OSD_Function)(...);
+//! Converts the given pointer to function @p theFromFunction
+//! to the type of the pointer to function specified as the first template argument @p TheToFunction.
+//! This function is necessary to explicitly mark the places where such conversion takes place
+//! and to suppress @em gcc warning @c -Wcast-function-type.
+//! @tparam TheToFunction the type to which the given pointer to function must be casted
+//! (it may be the type of the function or the type of the pointer to function)
+//! @tparam TheFromFunction the type of the function to be casted
+//! @tparam AToFunction it is not an actual template parameter,
+//! but a simple alias needed to reduce the amount of boilerplate
+//! @param theFromFunction the pointer to the function to be casted
+//! @return the pointer of the function of type @c AToFunction* that is the result of the cast
+template <typename TheToFunction,
+ typename TheFromFunction,
+ typename AToFunction = typename opencascade::std::remove_pointer<TheToFunction>::type>
+typename opencascade::std::enable_if<opencascade::std::is_function<AToFunction>::value
+ && opencascade::std::is_function<TheFromFunction>::value,
+ AToFunction*>::type
+OSD_FunctionCast (TheFromFunction* const theFromFunction)
+{
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+# if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-function-type"
+# endif
+#endif
+ return reinterpret_cast<AToFunction*> (theFromFunction);
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+# if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))
+# pragma GCC diagnostic pop
+# endif
+#endif
+}
+
#endif
#include <OSD_Parallel.hxx>
+#include <OSD_Function.hxx>
+
#ifdef _WIN32
#include <windows.h>
#include <process.h>
HMODULE aKern32Module = GetModuleHandleW(L"kernel32");
LPFN_ISWOW64PROCESS aFunIsWow64 = (aKern32Module == NULL) ? (LPFN_ISWOW64PROCESS )NULL
- : (LPFN_ISWOW64PROCESS)GetProcAddress(aKern32Module, "IsWow64Process");
+ : OSD_FunctionCast<LPFN_ISWOW64PROCESS> (GetProcAddress(aKern32Module, "IsWow64Process"));
return aFunIsWow64 != NULL &&
aFunIsWow64(GetCurrentProcess(), &bIsWow64) &&
typedef BOOL (WINAPI *LPFN_GSI)(LPSYSTEM_INFO );
HMODULE aKern32 = GetModuleHandleW(L"kernel32");
- LPFN_GSI aFuncSysInfo = (LPFN_GSI )GetProcAddress(aKern32, "GetNativeSystemInfo");
+ LPFN_GSI aFuncSysInfo = OSD_FunctionCast<LPFN_GSI> (GetProcAddress(aKern32, "GetNativeSystemInfo"));
// So, they suggest 32-bit apps should call this instead of the other in WOW64
if ( aFuncSysInfo != NULL )
OSD_Function OSD_SharedLibrary :: DlSymb ( const Standard_CString Name ) const {
- OSD_Function func = ( OSD_Function )GetProcAddress ( ( HMODULE )myHandle, Name );
+ OSD_Function func = OSD_FunctionCast<OSD_Function> (GetProcAddress ((HMODULE)myHandle, Name));
if ( func == NULL )
if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
{
size_t anOldDirLength;
- StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength);
+ StringCchLengthW (oldDir, MAX_PATH, &anOldDirLength);
+ const size_t aNameLength = anOldDirLength + WILD_CARD_LEN + sizeof (L'\x00');
if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
- && (pName = (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
+ && (pName = (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
{
- StringCchCopyW (pName, sizeof(pName) / sizeof(pName[0]), oldDir);
- StringCchCatW (pName, sizeof(pName), WILD_CARD);
+ StringCchCopyW (pName, aNameLength, oldDir);
+ StringCchCatW (pName, aNameLength, WILD_CARD);
retVal = TRUE;
hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
for (BOOL fFind = hFindFile != INVALID_HANDLE_VALUE; fFind; fFind = FindNextFileW (hFindFile, pFD))
continue;
}
- size_t anOldDirLength2 = 0, aNewDirLength = 0, aFileNameLength = 0;
- StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength2);
- StringCchLengthW (newDir, sizeof(newDir) / sizeof(newDir[0]), &aNewDirLength);
+ size_t aNewDirLength = 0, aFileNameLength = 0;
+ StringCchLengthW (newDir, MAX_PATH, &aNewDirLength);
StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
- if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
- || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aNewDirLength + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
+ const size_t aFullNameSrcLength = anOldDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+ const size_t aFullNameDstLength = aNewDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+ if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
+ || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
{
break;
}
- StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), oldDir);
- StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
- StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
+ StringCchCopyW (pFullNameSrc, aFullNameSrcLength, oldDir);
+ StringCchCatW (pFullNameSrc, aFullNameSrcLength, L"/");
+ StringCchCatW (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
- StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), newDir);
- StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
- StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
+ StringCchCopyW (pFullNameDst, aFullNameDstLength, newDir);
+ StringCchCatW (pFullNameDst, aFullNameDstLength, L"/");
+ StringCchCatW (pFullNameDst, aFullNameDstLength, pFD->cFileName);
if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
{
size_t aDirSrcLength = 0;
- StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength);
+ StringCchLengthW (dirSrc, MAX_PATH, &aDirSrcLength);
+ const size_t aNameLength = aDirSrcLength + WILD_CARD_LEN + sizeof (L'\x00');
if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
- && (pName = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
+ && (pName = (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
{
- StringCchCopyW(pName, sizeof(pName) / sizeof(pName[0]), dirSrc);
- StringCchCatW (pName, sizeof(pName) / sizeof(pName[0]), WILD_CARD);
+ StringCchCopyW(pName, aNameLength, dirSrc);
+ StringCchCatW (pName, aNameLength, WILD_CARD);
retVal = TRUE;
hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
continue;
}
- size_t aDirSrcLength2 = 0, aDirDstLength = 0, aFileNameLength = 0;
- StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength2);
- StringCchLengthW (dirDst, sizeof(dirDst) / sizeof(dirDst[0]), &aDirDstLength);
+ size_t aDirDstLength = 0, aFileNameLength = 0;
+ StringCchLengthW (dirDst, MAX_PATH, &aDirDstLength);
StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
- if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
- || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aDirDstLength + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
+ const size_t aFullNameSrcLength = aDirSrcLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+ const size_t aFullNameDstLength = aDirDstLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+ if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
+ || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
{
break;
}
- StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), dirSrc);
- StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
- StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
+ StringCchCopyW (pFullNameSrc, aFullNameSrcLength, dirSrc);
+ StringCchCatW (pFullNameSrc, aFullNameSrcLength, L"/");
+ StringCchCatW (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
- StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), dirDst);
- StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
- StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
+ StringCchCopyW (pFullNameDst, aFullNameDstLength, dirDst);
+ StringCchCatW (pFullNameDst, aFullNameDstLength, L"/");
+ StringCchCatW (pFullNameDst, aFullNameDstLength, pFD->cFileName);
if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
retVal = CopyDirectory (pFullNameSrc, pFullNameDst);
#include <OSD.hxx>
#include <OSD_Exception_CTRL_BREAK.hxx>
+#include <OSD_Function.hxx>
#include <Standard_DivideByZero.hxx>
#include <Standard_Overflow.hxx>
#include <Standard_Assert.hxx>
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
switch( signum ) {
case SIGFPE :
- if ( signal( signum , (void(*)(int))SIGWntHandler ) == SIG_ERR )
+ if (signal (signum, OSD_FunctionCast<void (*) (int)> (SIGWntHandler)) == SIG_ERR)
std::cout << "signal error" << std::endl ;
switch( sub_code ) {
case _FPE_INVALID :
}
break ;
case SIGSEGV :
- if ( signal( signum, (void(*)(int))SIGWntHandler ) == SIG_ERR )
+ if (signal (signum, OSD_FunctionCast<void (*) (int)> (SIGWntHandler)) == SIG_ERR)
std::cout << "signal error" << std::endl ;
CallHandler( EXCEPTION_ACCESS_VIOLATION ,0,0) ;
break ;
case SIGILL :
- if ( signal( signum, (void(*)(int))SIGWntHandler ) == SIG_ERR )
+ if (signal (signum, OSD_FunctionCast<void (*) (int)> (SIGWntHandler)) == SIG_ERR)
std::cout << "signal error" << std::endl ;
CallHandler( EXCEPTION_ILLEGAL_INSTRUCTION ,0,0) ;
break ;
SignalFuncType aPreviousFunc = SIG_DFL;
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
{
- aPreviousFunc = signal(aSignalTypes[i], (SignalFuncType)SIGWntHandler);
+ aPreviousFunc = signal (aSignalTypes[i], OSD_FunctionCast<SignalFuncType> (SIGWntHandler));
}
if (theSignalMode == OSD_SignalMode_Unset ||
(theSignalMode == OSD_SignalMode_SetUnhandled && aPreviousFunc != SIG_DFL && aPreviousFunc != SIG_ERR))
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Graphic3d_GraphicDriver.hxx>
+#include <OSD_Function.hxx>
#include <memory>
wglMakeCurrent (aDevCtxTmp, aRendCtxTmp);
typedef const char* (WINAPI *wglGetExtensionsStringARB_t)(HDC theDeviceContext);
- wglGetExtensionsStringARB_t aGetExtensions = (wglGetExtensionsStringARB_t )wglGetProcAddress ("wglGetExtensionsStringARB");
+ wglGetExtensionsStringARB_t aGetExtensions = OSD_FunctionCast<wglGetExtensionsStringARB_t> (wglGetProcAddress ("wglGetExtensionsStringARB"));
const char* aWglExts = (aGetExtensions != NULL) ? aGetExtensions (wglGetCurrentDC()) : NULL;
if (OpenGl_Context::CheckExtension (aWglExts, "WGL_ARB_pixel_format"))
{
- aChoosePixProc = (wglChoosePixelFormatARB_t )wglGetProcAddress ("wglChoosePixelFormatARB");
+ aChoosePixProc = OSD_FunctionCast<wglChoosePixelFormatARB_t> (wglGetProcAddress ("wglChoosePixelFormatARB"));
}
if (OpenGl_Context::CheckExtension (aWglExts, "WGL_ARB_create_context_profile"))
{
- aCreateCtxProc = (wglCreateContextAttribsARB_t )wglGetProcAddress ("wglCreateContextAttribsARB");
+ aCreateCtxProc = OSD_FunctionCast<wglCreateContextAttribsARB_t> (wglGetProcAddress ("wglCreateContextAttribsARB"));
}
}
typedef GLXContext (*glXCreateContextAttribsARB_t)(Display* dpy, GLXFBConfig config,
GLXContext share_context, Bool direct,
const int* attrib_list);
- glXCreateContextAttribsARB_t aCreateCtxProc = (glXCreateContextAttribsARB_t )glXGetProcAddress((const GLubyte* )"glXCreateContextAttribsARB");
+ glXCreateContextAttribsARB_t aCreateCtxProc = OSD_FunctionCast<glXCreateContextAttribsARB_t> (glXGetProcAddress((const GLubyte* )"glXCreateContextAttribsARB"));
if (!theCaps->contextCompatible)
{
int aCoreCtxAttribs[] =
}
else
f = theMapOfFunctions(pid);
-
- Standard_Transient* (*fp) (const Standard_GUID&) = NULL;
- fp = (Standard_Transient* (*)(const Standard_GUID&)) f;
+
+ Standard_Transient* (*fp) (const Standard_GUID&) = OSD_FunctionCast<Standard_Transient* (*)(const Standard_GUID&)> (f);
Handle(Standard_Transient) theServiceFactory = (*fp) (aGUID);
return theServiceFactory;
it.Initialize (empty);
}
- catch (Standard_Failure)
+ catch (const Standard_Failure&)
{
di << "Cannot initialize TopoDS_Iterator with null shape\n";
return 0;
TopoDS_Wire empty;
BRepLib_MakeWire aWBuilder (empty);
}
- catch (Standard_Failure)
+ catch (const Standard_Failure&)
{
di << "Cannot initialize BRepLib_MakeWire with null wire\n";
}
}
-//=======================================================================
-//function : MyVISEDG
-//purpose :
-//=======================================================================
-static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/,
- Standard_Integer n, const char** a)
-{
- if (n >4) return 1;
- TopoDS_Shape MaListe = DBRep::Get(a[1]);
- if (MaListe.IsNull()) return 1;
- TopoDS_Compound TheList = TopoDS::Compound(MaListe);
- if (TheList.IsNull()) return 1;
- Standard_Real toler = 0.001;
- int create = 0;
- if ( n >= 3) toler = Draw::Atof(a[2]);
- if (n == 4 && !strcmp(a[3],"C")) create = 1;
- ShapeAnalysis_FreeBounds F(TheList,toler);
- //
- //
- //
- char name[100];
- char num[5];
- if (!create)
- {
- TopoDS_Compound Wires = F.GetClosedWires();
- TopoDS_Iterator S(Wires);
- Standard_Integer iwire = 0;
- while (S.More())
- {
- Sprintf (num,"%d",iwire);
- name[0] = 'w';
- name[1] = '\0';
- strncat(name,num,strlen(num));
- name[strlen(name)] = '\0';
- DBRep::Set(name,S.Value());
- S.Next();
- iwire++;
- }
- iwire = 0;
- TopoDS_Compound Edges = F.GetOpenWires();
- S.Initialize(Edges);
- iwire = 0;
- while (S.More())
- {
- Sprintf (num,"%d",iwire);
- name[0] = 'E';
- name[1] = '\0';
- strncat(name,num,strlen(num));
- name[strlen(name)] = '\0';
- DBRep::Set(name,S.Value());
- S.Next();
- iwire++;
- }
- }
- else
- {
- }
- return 0;
-}
-
static Standard_Integer getareacontour (Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
theCommands.Add("fbclose",
"shp sewtoler closetoler [splitclosed [splitopen]] - closes free bounds; use sewtoler <= 0 for shells (no sewing call)",
__FILE__, closefreebounds, groupold);
- theCommands.Add("K_VISEDG",
- "K_VISEDG Visu of free edge of a compound of faces.",
- __FILE__, MyVISEDG, groupold);
-
+
theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
theCommands.Add ("checkselfintersection","wire [face]", __FILE__,checkselfintersection,g);
theCommands.Add ("checkedge","edge [face]", __FILE__,checkedge,g);