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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

1
src/Plugin/FILES Executable file
View File

@@ -0,0 +1 @@
Plugin_Macro.hxx

21
src/Plugin/Plugin.cdl Executable file
View File

@@ -0,0 +1,21 @@
-- File: Plugin.cdl
-- Created: Fri Feb 28 16:58:57 1997
-- Author: Jean-Louis Frenkel
-- <rmi@frilox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
package Plugin
uses TCollection,OSD
is
exception Failure inherits Failure from Standard;
private class MapOfFunctions instantiates DataMap from TCollection(AsciiString from TCollection ,Function from OSD, AsciiString from TCollection);
Load(aGUID: GUID from Standard) returns Transient from Standard
raises Failure from Plugin;
end Plugin;

87
src/Plugin/Plugin.cxx Executable file
View File

@@ -0,0 +1,87 @@
// File: Plugin.cxx
// Created: Thu Mar 6 15:49:00 1997
// Author: Mister rmi
// <rmi@frilox.paris1.matra-dtv.fr>
#include <Plugin.ixx>
#include <Plugin_MapOfFunctions.hxx>
#include <OSD_SharedLibrary.hxx>
#include <Resource_Manager.hxx>
#include <Plugin_Failure.hxx>
#include <TCollection_AsciiString.hxx>
static Standard_Character tc[1000];
static Standard_PCharacter thePluginId = tc;
//=======================================================================
//function : Load
//purpose :
//=======================================================================
Handle(Standard_Transient) Plugin::Load(const Standard_GUID& aGUID)
{
aGUID.ToCString(thePluginId);
TCollection_AsciiString pid(thePluginId);
static Plugin_MapOfFunctions theMapOfFunctions;
OSD_Function f;
if(!theMapOfFunctions.IsBound(pid)) {
Handle(Resource_Manager) PluginResource = new Resource_Manager("Plugin");
TCollection_AsciiString theResource(thePluginId);
theResource += ".Location";
if(!PluginResource->Find(theResource.ToCString())) {
Standard_SStream aMsg; aMsg << "could not find the resource:";
aMsg << theResource.ToCString()<< endl;
cout << "could not find the resource:"<<theResource.ToCString()<< endl;
Plugin_Failure::Raise(aMsg);
}
TCollection_AsciiString thePluginLibrary("");
#ifndef WNT
thePluginLibrary += "lib";
#endif
thePluginLibrary += PluginResource->Value(theResource.ToCString());
#ifdef WNT
thePluginLibrary += ".dll";
#elif defined(__APPLE__)
thePluginLibrary += ".dylib";
#elif defined (HPUX) || defined(_hpux)
thePluginLibrary += ".sl";
#else
thePluginLibrary += ".so";
#endif
OSD_SharedLibrary theSharedLibrary(thePluginLibrary.ToCString());
if(!theSharedLibrary.DlOpen(OSD_RTLD_LAZY)) {
TCollection_AsciiString error(theSharedLibrary.DlError());
Standard_SStream aMsg; aMsg << "could not open:";
aMsg << PluginResource->Value(theResource.ToCString());
aMsg << "; reason:";
aMsg << error.ToCString();
cout << "could not open: " << PluginResource->Value(theResource.ToCString())<< " ; reason: "<< error.ToCString() << endl;
Plugin_Failure::Raise(aMsg);
}
f = theSharedLibrary.DlSymb("PLUGINFACTORY");
if( f == NULL ) {
TCollection_AsciiString error(theSharedLibrary.DlError());
Standard_SStream aMsg; aMsg << "could not find the factory in:";
aMsg << PluginResource->Value(theResource.ToCString());
aMsg << error.ToCString();
Plugin_Failure::Raise(aMsg);
}
theMapOfFunctions.Bind(pid,f);
}
else
f = theMapOfFunctions(pid);
Handle(Standard_Transient) (*fp) (const Standard_GUID&) = NULL;
fp = (Handle(Standard_Transient) (*)(const Standard_GUID&)) f;
Handle(Standard_Transient) theServiceFactory = (*fp) (aGUID);
return theServiceFactory;
}

17
src/Plugin/Plugin_Macro.hxx Executable file
View File

@@ -0,0 +1,17 @@
// File: Plugin_Macro.hxx
// Created: Tue Mar 4 10:47:14 1997
// Author: Mister rmi
// <rmi@frilox.paris1.matra-dtv.fr>
#ifndef _Plugin_Macro_HeaderFile
#define _Plugin_Macro_HeaderFile
#define PLUGIN(name) \
extern "C" {Standard_EXPORT Handle(Standard_Transient) PLUGINFACTORY(const Standard_GUID&);} \
Handle(Standard_Transient) PLUGINFACTORY(const Standard_GUID& aGUID) { \
return name::Factory(aGUID);}\
\
#endif