//
// 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 version 2.1 as published
+// 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.
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Draw.ixx>
-
-#if defined(HAVE_TIME_H) || defined(WNT)
-# include <time.h>
-#endif
+#include <Draw.hxx>
#include <Draw_Appli.hxx>
-#include <OSD.hxx>
-#include <OSD_Environment.hxx>
-#include <OSD_Timer.hxx>
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-
-#include <Draw_Window.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Standard_Stream.hxx>
-#include <Standard_Version.hxx>
-
#include <Draw_Drawable3D.hxx>
+#include <Draw_Failure.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_ProgressIndicator.hxx>
-
-#include <Draw_MapOfFunctions.hxx>
+#include <Draw_Window.hxx>
+#include <gp_Pnt2d.hxx>
+#include <OSD.hxx>
+#include <OSD_Environment.hxx>
#include <OSD_SharedLibrary.hxx>
+#include <OSD_Timer.hxx>
+#include <Plugin_MapOfFunctions.hxx>
#include <Resource_Manager.hxx>
-#include <Draw_Failure.hxx>
-#include <TCollection_AsciiString.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <Standard_Stream.hxx>
+#include <Standard_Version.hxx>
+#include <TCollection_AsciiString.hxx>
#include <tcl.h>
-
// on MSVC, use #pragma to define name of the Tcl library to link with,
// depending on Tcl version number
#ifdef _MSC_VER
// *******************************************************************
// read an init file
// *******************************************************************
-#ifdef WNT
+#ifdef _WIN32
extern console_semaphore_value volatile console_semaphore;
extern char console_command[1000];
#endif
static void ReadInitFile (const TCollection_AsciiString& theFileName)
{
TCollection_AsciiString aPath = theFileName;
-#ifdef WNT
+#ifdef _WIN32
if (!Draw_Batch) {
try {
aPath.ChangeAll ('\\', '/');
Sprintf (com, "source %s", aPath.ToCString());
Draw_Interprete (com);
delete [] com;
-#ifdef WNT
+#ifdef _WIN32
}
#endif
}
return PInd;
}
-#ifndef WNT
+#ifndef _WIN32
/*--------------------------------------------------------*\
| exitProc: finalization handler for Tcl/Tk thread. Forces parent process to die
\*--------------------------------------------------------*/
// *****************************************************************
// set signals
// *****************************************************************
- OSD::SetSignal();
+ OSD::SetSignal(Standard_False);
#ifdef _WIN32
// in interactive mode, force Windows to report dll loading problems interactively
// *****************************************************************
// init X window and create display
// *****************************************************************
-#ifdef WNT
+#ifdef _WIN32
HWND hWnd = NULL;
#endif
if (!Draw_Batch)
-#ifdef WNT
+#ifdef _WIN32
Draw_Batch=!Init_Appli(hInst, hPrevInst, nShow, hWnd);
#else
Draw_Batch=!Init_Appli();
// *****************************************************************
Draw_InitAppli(theCommands);
-#ifndef WNT
+#ifndef _WIN32
Tcl_CreateExitHandler(exitProc, 0);
#endif
{
if (getenv ("CASROOT") == NULL)
{
-#ifdef WNT
+#ifdef _WIN32
ReadInitFile ("ddefault");
#else
cout << " the CASROOT variable is mandatory to Run OpenCascade "<< endl;
ReadInitFile (aRunFile);
// provide a clean exit, this is useful for some analysis tools
if ( ! isInteractiveForced )
-#ifndef WNT
+#ifndef _WIN32
return;
#else
ExitProcess(0);
Draw_Interprete (aCommand.ToCString());
// provide a clean exit, this is useful for some analysis tools
if ( ! isInteractiveForced )
-#ifndef WNT
+#ifndef _WIN32
return;
#else
ExitProcess(0);
// X loop
// *****************************************************************
if (XLoop) {
-#ifdef WNT
+#ifdef _WIN32
Run_Appli(hWnd);
#else
Run_Appli(Draw_Interprete);
else
{
char cmd[255];
- do {
+ for (;;)
+ {
cout << "Viewer>";
i = -1;
do {
cin.get(cmd[++i]);
} while ((cmd[i] != '\n') && (!cin.fail()));
cmd[i] = '\0';
- } while (Draw_Interprete(cmd) != (unsigned int ) -2);
+ Draw_Interprete(cmd);
+ }
}
-#ifdef WNT
+#ifdef _WIN32
// Destruction de l'application
Destroy_Appli(hInst);
#endif
return r;
}
-
-//=================================================================================
-//
-//=================================================================================
-void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey,
- const TCollection_AsciiString& theResourceFileName) {
-
- static Draw_MapOfFunctions theMapOfFunctions;
- OSD_Function f;
-
- if(!theMapOfFunctions.IsBound(theKey)) {
-
- Handle(Resource_Manager) aPluginResource = new Resource_Manager(theResourceFileName.ToCString());
- if(!aPluginResource->Find(theKey.ToCString())) {
- Standard_SStream aMsg; aMsg << "Could not find the resource:";
- aMsg << theKey.ToCString()<< endl;
- cout << "could not find the resource:"<<theKey.ToCString()<< endl;
- Draw_Failure::Raise(aMsg);
- }
-
- TCollection_AsciiString aPluginLibrary("");
-#ifndef WNT
- aPluginLibrary += "lib";
-#endif
- aPluginLibrary += aPluginResource->Value(theKey.ToCString());
-#ifdef WNT
- aPluginLibrary += ".dll";
-#elif __APPLE__
- aPluginLibrary += ".dylib";
-#elif defined (HPUX) || defined(_hpux)
- aPluginLibrary += ".sl";
-#else
- aPluginLibrary += ".so";
-#endif
- OSD_SharedLibrary aSharedLibrary(aPluginLibrary.ToCString());
- if(!aSharedLibrary.DlOpen(OSD_RTLD_LAZY)) {
- TCollection_AsciiString error(aSharedLibrary.DlError());
- Standard_SStream aMsg; aMsg << "Could not open: ";
- aMsg << aPluginResource->Value(theKey.ToCString());
- aMsg << "; reason: ";
- aMsg << error.ToCString();
-#ifdef DEB
- cout << "could not open: " << aPluginResource->Value(theKey.ToCString())<< " ; reason: "<< error.ToCString() << endl;
-#endif
- Draw_Failure::Raise(aMsg);
- }
- f = aSharedLibrary.DlSymb("PLUGINFACTORY");
- if( f == NULL ) {
- TCollection_AsciiString error(aSharedLibrary.DlError());
- Standard_SStream aMsg; aMsg << "Could not find the factory in: ";
- aMsg << aPluginResource->Value(theKey.ToCString());
- aMsg << error.ToCString();
- Draw_Failure::Raise(aMsg);
- }
- theMapOfFunctions.Bind(theKey, f);
- }
- else
- f = theMapOfFunctions(theKey);
-
-// void (*fp) (Draw_Interpretor&, const TCollection_AsciiString&) = NULL;
-// fp = (void (*)(Draw_Interpretor&, const TCollection_AsciiString&)) f;
-// (*fp) (theDI, theKey);
-
- void (*fp) (Draw_Interpretor&) = NULL;
- fp = (void (*)(Draw_Interpretor&)) f;
- (*fp) (theDI);
-
-}
-
-
//=================================================================================
//
//=================================================================================
TCollection_AsciiString& theUserDefaultsDirectory,
const Standard_Boolean Verbose ) {
- static Draw_MapOfFunctions theMapOfFunctions;
+ static Plugin_MapOfFunctions theMapOfFunctions;
OSD_Function f;
if(!theMapOfFunctions.IsBound(theKey)) {
}
TCollection_AsciiString aPluginLibrary("");
-#ifndef WNT
+#if !defined(_WIN32) || defined(__MINGW32__)
aPluginLibrary += "lib";
#endif
aPluginLibrary += aPluginResource->Value(theKey.ToCString());
-#ifdef WNT
+#ifdef _WIN32
aPluginLibrary += ".dll";
#elif __APPLE__
aPluginLibrary += ".dylib";
aMsg << aPluginResource->Value(theKey.ToCString());
aMsg << "; reason: ";
aMsg << error.ToCString();
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "could not open: " << aPluginResource->Value(theKey.ToCString())<< " ; reason: "<< error.ToCString() << endl;
#endif
Draw_Failure::Raise(aMsg);