--- /dev/null
+// ADN
+//
+// 11/1995
+//
+
+#include <CPPIntExt.hxx>
+#include <CPPIntExt_Predefined.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+
+// Declarations Incompletes
+
+
+extern "C" {
+
+ Handle(TColStd_HSequenceOfHAsciiString) Standard_EXPORT CPPInt_TemplatesUsed();
+
+ void Standard_EXPORT CPPInt_Extract(const Handle(MS_MetaSchema)& ams,
+ const Handle(TCollection_HAsciiString)& aname,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Standard_CString);
+
+ Handle(TColStd_HSequenceOfHAsciiString) Standard_EXPORT CPPEng_TemplatesUsed();
+
+ void Standard_EXPORT CPPEng_Extract(const Handle(MS_MetaSchema)& ams,
+ const Handle(TCollection_HAsciiString)& aname,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Standard_CString);
+
+}
+
+// CPPInt_TemplatesUsed
+
+Handle(TColStd_HSequenceOfHAsciiString) CPPInt_TemplatesUsed()
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+
+ result->Append(new TCollection_HAsciiString("Interface_Template.edl"));
+
+ return result;
+}
+
+
+Handle(TColStd_HSequenceOfHAsciiString) CPPEng_TemplatesUsed()
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+
+ result->Append(new TCollection_HAsciiString("Engine_Template.edl"));
+
+ return result;
+}
+
+
+void CPPInt_InterfExtract(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(EDL_API) api = new EDL_API;
+
+ for(Standard_Integer i = 1; i <= edlsfullpath->Length(); i++) {
+ api->AddIncludeDirectory(edlsfullpath->Value(i)->ToCString());
+ }
+
+ if (api->Execute("Interface_Template.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPInt_InterfExtract" << "unable to load Interface_Template.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ Handle(TCollection_HAsciiString) FileNamexx = new TCollection_HAsciiString(outdir);
+ FileNamexx->AssignCat(aName);
+ FileNamexx->AssignCat(".cxx");
+ outfile->Append(FileNamexx);
+
+ Handle(TCollection_HAsciiString) FileNamedat = new TCollection_HAsciiString(outdir);
+ FileNamedat->AssignCat(aName);
+ FileNamedat->AssignCat("_ExportedMethods.dat");
+ outfile->Append(FileNamedat);
+
+ if (api->OpenFile("Interfilecxx",FileNamexx->ToCString()) == EDL_NORMAL) {
+
+ if (api->OpenFile("Interfiledat",FileNamedat->ToCString()) == EDL_NORMAL) {
+
+ Handle(MS_Interface) srcInterface = aMeta->GetInterface(aName);
+
+ CPPIntExt_ProcessHeader(srcInterface,api);
+
+
+
+ // Maps for includes
+ MS_MapOfType incmaptype;
+ MS_MapOfType mapusedtype;
+ MS_MapOfGlobalEntity incmappack;
+ // Map for Methods
+ MS_MapOfMethod expmap;
+
+
+ CPPIntExt_LoadMethods(aMeta,srcInterface,api,expmap,incmaptype,mapusedtype,incmappack);
+ CPPIntExt_ProcessIncludes(srcInterface,api,incmaptype,incmappack);
+
+ CPPIntExt_ProcessTypes(aMeta,srcInterface,api,mapusedtype);
+
+ if (expmap.Extent() < CPPINTEXT_MAXINTFSWITCH) {
+ CPPIntExt_ProcessExec(srcInterface,api,mapusedtype);
+
+ CPPIntExt_ProcessCases(aMeta,srcInterface,api,expmap);
+
+ CPPIntExt_ProcessBottom(srcInterface,api);
+ }
+ else {
+
+ TColStd_SequenceOfInteger switchcount;
+
+ CPPIntExt_ProcessMultiCases(aMeta,srcInterface,api,expmap,switchcount);
+
+ CPPIntExt_ProcessMultiExec(srcInterface,api,switchcount,mapusedtype);
+ }
+
+ api->CloseFile("Interfiledat");
+ }
+ else {
+ ErrorMsg << "CPPInt_InterfExtract" << "Cannot open file " << FileNamedat->ToCString() << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ api->CloseFile("Interfilecxx");
+ }
+ else {
+ ErrorMsg << "CPPInt_InterfExtract" << "Cannot open file " << FileNamexx->ToCString() << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
+void CPPInt_EnginExtract(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile)
+{
+ Handle(MS_Engine) srcEngine = aMeta->GetEngine(aName);
+ Handle(EDL_API) api = new EDL_API;
+
+ for(Standard_Integer i = 1; i <= edlsfullpath->Length(); i++) {
+ api->AddIncludeDirectory(edlsfullpath->Value(i)->ToCString());
+ }
+
+ if (api->Execute("Engine_Template.edl") != EDL_NORMAL) {
+ ErrorMsg << "CPPInt_EnginExtract" << "unable to load Engine_Template.edl" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ Handle(TCollection_HAsciiString) FileNamexx = new TCollection_HAsciiString(outdir);
+ FileNamexx->AssignCat(aName);
+ FileNamexx->AssignCat(".cxx");
+ outfile->Append(FileNamexx);
+
+ Handle(TCollection_HAsciiString) FileNamell = new TCollection_HAsciiString(outdir);
+ FileNamell->AssignCat(aName);
+ FileNamell->AssignCat(".ll");
+ outfile->Append(FileNamell);
+
+ Handle(TCollection_HAsciiString) FileNameInit = new TCollection_HAsciiString(outdir);
+ FileNameInit->AssignCat("Engine_Init_.cxx");
+// outfile->Append(FileNameInit);
+
+ if (api->OpenFile("Enginefilecxx",FileNamexx->ToCString()) == EDL_NORMAL) {
+
+ if (api->OpenFile("Enginefilell",FileNamell->ToCString()) == EDL_NORMAL) {
+
+ if (api->OpenFile("Enginefileinit",FileNameInit->ToCString()) == EDL_NORMAL) {
+
+ Handle(TColStd_HSequenceOfHAsciiString) seqint = new TColStd_HSequenceOfHAsciiString();
+ Handle(TColStd_HSequenceOfHAsciiString) refseqint = srcEngine->Interfaces();
+
+ Handle(TCollection_HAsciiString) inteng = new TCollection_HAsciiString("EngineInterface");
+ seqint->Append(inteng);
+ for (Standard_Integer i=1; i<=refseqint->Length(); i++) {
+ seqint->Append(refseqint->Value(i));
+ }
+
+ CPPIntExt_ProcessCxx(srcEngine,api,seqint);
+
+ // Maps for includes
+ MS_MapOfType incmaptype;
+ MS_MapOfGlobalEntity incmappack;
+ // Map for Methods
+ MS_MapOfMethod expmap;
+
+
+ CPPIntExt_LoadMethods(aMeta,srcEngine,api,expmap,incmaptype,incmappack,seqint);
+
+ CPPIntExt_ProcessCcl(aMeta,srcEngine,api,incmaptype,incmappack);
+
+ CPPIntExt_ProcessEngineInit(aMeta,srcEngine,api,incmaptype);
+
+ api->CloseFile("Enginefileinit");
+ }
+ else {
+ ErrorMsg << "CPPInt_EnginExtract" << "Cannot open file " << FileNameInit->ToCString() << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+ api->CloseFile("Enginefilell");
+
+ }
+ else {
+ ErrorMsg << "CPPInt_EnginExtract" << "Cannot open file " << FileNamell->ToCString() << endm;
+ Standard_NoSuchObject::Raise();
+ }
+ api->CloseFile("Enginefilecxx");
+
+ }
+ else {
+ ErrorMsg << "CPPInt_EnginExtract" << "Cannot open file " << FileNamexx->ToCString() << endm;
+ Standard_NoSuchObject::Raise();
+ }
+}
+
+
+// Standard extractor API : launch the extraction of Interface or Engine
+// files from <aName>.
+//
+
+void CPPInt_Extract(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Standard_CString)
+{
+ // before begining, we look if the entity is an Interface...
+ //
+ if (aMeta->IsInterface(aName)) {
+ CPPInt_InterfExtract(aMeta,aName,edlsfullpath,outdir,outfile);
+ }
+ else {
+ ErrorMsg << "CPPInt_Extract" << aName->ToCString() << " is not an interface" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+}
+
+void CPPEng_Extract(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(TCollection_HAsciiString)& aName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& edlsfullpath,
+ const Handle(TCollection_HAsciiString)& outdir,
+ const Handle(TColStd_HSequenceOfHAsciiString)& outfile,
+ const Standard_CString)
+{
+ // before begining, we look if the entity is an Engine...
+ //
+ if (aMeta->IsEngine(aName)) {
+ CPPInt_EnginExtract(aMeta,aName,edlsfullpath,outdir,outfile);
+ }
+ else {
+ ErrorMsg << "CPPEng_Extract" << aName->ToCString() << " is not an engine" << endm;
+ Standard_NoSuchObject::Raise();
+ }
+
+}
+
--- /dev/null
+// ADN
+//
+// 11/1995
+//
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Interface.hxx>
+#include <MS_Engine.hxx>
+#include <EDL_API.hxx>
+#include <MS_MapOfType.hxx>
+#include <MS_MapOfMethod.hxx>
+#include <MS_MapOfGlobalEntity.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+
+
+void CPPIntExt_LoadMethods(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ MS_MapOfMethod&,
+ MS_MapOfType&,
+ MS_MapOfType&,
+ MS_MapOfGlobalEntity&,
+ Standard_Boolean AddArgs=Standard_False);
+
+
+void CPPIntExt_LoadMethods(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Engine)&,
+ const Handle(EDL_API)&,
+ MS_MapOfMethod&,
+ MS_MapOfType&,
+ MS_MapOfGlobalEntity&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+
+void CPPIntExt_ProcessIncludes(const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const MS_MapOfType&,
+ const MS_MapOfGlobalEntity&);
+
+void CPPIntExt_ProcessHeader(const Handle(MS_Interface)&,
+ const Handle(EDL_API)&);
+
+void CPPIntExt_ProcessTypes(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const MS_MapOfType&);
+
+void CPPIntExt_ProcessExec(const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const MS_MapOfType&);
+
+void CPPIntExt_ProcessMultiExec(const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const TColStd_SequenceOfInteger&,
+ const MS_MapOfType&);
+
+
+void CPPIntExt_ProcessBottom(const Handle(MS_Interface)&,
+ const Handle(EDL_API)&);
+
+void CPPIntExt_ProcessCases(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const MS_MapOfMethod&);
+
+void CPPIntExt_ProcessMultiCases(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const MS_MapOfMethod&,
+ TColStd_SequenceOfInteger&);
+
+void CPPIntExt_ProcessCxx(const Handle(MS_Engine)&,
+ const Handle(EDL_API)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+
+void CPPIntExt_ProcessCcl(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Engine)&,
+ const Handle(EDL_API)&,
+ MS_MapOfType&,
+ MS_MapOfGlobalEntity&);
+
+
+void CPPIntExt_ProcessEngineInit(const Handle(MS_MetaSchema)&,
+ const Handle(MS_Engine)&,
+ const Handle(EDL_API)&,
+ MS_MapOfType&);
+
--- /dev/null
+// ADN
+//
+// 11/1995
+//
+
+#include <stdio.h>
+
+
+#include <MS_Interface.hxx>
+#include <MS_Engine.hxx>
+#include <MS_MapOfType.hxx>
+#include <MS_MapOfGlobalEntity.hxx>
+#include <MS_MapOfMethod.hxx>
+#include <MS_DataMapIteratorOfMapOfGlobalEntity.hxx>
+#include <MS_DataMapIteratorOfMapOfType.hxx>
+#include <MS_Class.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Enum.hxx>
+#include <MS_MetaSchema.hxx>
+#include <WOKTools_SortOfHAsciiString.hxx>
+#include <WOKTools_Array1OfHAsciiString.hxx>
+#include <WOKTools_CompareOfHAsciiString.hxx>
+#include <EDL_API.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+#define NBDIGITINH 10
+
+Standard_Boolean CPPIntExt_IsRef(const Handle(MS_Type)&,
+ const Handle(MS_MetaSchema)&);
+
+
+void CPPIntExt_ProcessIncludes(const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const MS_MapOfType& maptype,
+ const MS_MapOfGlobalEntity& mappack)
+{
+ Standard_Integer i,count;
+ WOKTools_CompareOfHAsciiString cmptool;
+ if (mappack.Extent() > 0) {
+ MS_DataMapIteratorOfMapOfGlobalEntity itpack(mappack);
+ WOKTools_Array1OfHAsciiString arpack(1,mappack.Extent());
+ count =1;
+ while (itpack.More()) {
+ arpack(count) = itpack.Value()->Name();
+ count++;
+ itpack.Next();
+ }
+ WOKTools_SortOfHAsciiString::Sort(arpack,cmptool);
+ Standard_Integer i;
+ for (i=1; i<=arpack.Length(); i++) {
+ api->AddVariable("%PKName",arpack(i)->ToCString());
+ api->Apply("%TextPkInc",
+ "InterfPkInclude");
+ api->WriteFile("Interfilecxx",
+ "%TextPkInc");
+ }
+ }
+ if (maptype.Extent() > 0) {
+ MS_DataMapIteratorOfMapOfType ittype(maptype);
+ WOKTools_Array1OfHAsciiString artype(1,maptype.Extent());
+ count =1;
+ while (ittype.More()) {
+ artype(count) = new TCollection_HAsciiString(ittype.Key());
+ count++;
+ ittype.Next();
+ }
+ WOKTools_SortOfHAsciiString::Sort(artype,cmptool);
+ for (i=1; i<=artype.Length(); i++) {
+ api->AddVariable("%CLName",artype(i)->ToCString());
+ if (maptype(artype(i))->IsKind(STANDARD_TYPE(MS_Class))) {
+ api->Apply("%TextCLInc",
+ "InterfClassInclude");
+ }
+ else {
+ api->Apply("%TextCLInc",
+ "InterfNatClassInclude");
+ }
+ api->WriteFile("Interfilecxx",
+ "%TextCLInc");
+ }
+ }
+
+}
+
+void CPPIntExt_ProcessHeader(const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api)
+{
+ api->Apply("%TextHeader",
+ "InterfHeader");
+ api->WriteFile("Interfilecxx",
+ "%TextHeader");
+
+}
+
+
+void CPPIntExt_ProcessTypes(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const MS_MapOfType& maptype)
+{
+ Standard_Integer i;
+ MS_MapOfType mapvaltype;
+ MS_DataMapIteratorOfMapOfType ittyp1(maptype);
+ Standard_Boolean treated;
+ Handle(MS_Type) curtype;
+ while (ittyp1.More()) {
+ treated = Standard_False;
+ curtype = ittyp1.Value();
+ if (curtype->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(TCollection_HAsciiString) deepname = Handle(MS_Alias)::DownCast(curtype)->DeepType();
+ curtype = aMeta->GetType(deepname);
+ }
+ if (curtype->IsKind(STANDARD_TYPE(MS_Class))) {
+ if (!Handle(MS_Class)::DownCast(curtype)->IsStorable()) {
+ if (!CPPIntExt_IsRef(curtype,aMeta)) {
+ treated = Standard_True;
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(curtype);
+ mapvaltype.Bind(thecl->FullName(),thecl);
+ Handle(TColStd_HSequenceOfHAsciiString) theinh = thecl->GetFullInheritsNames();
+ for (i=1; i<= theinh->Length(); i++) {
+ mapvaltype.Bind(theinh->Value(i),
+ aMeta->GetType(theinh->Value(i)));
+ }
+ }
+ }
+ }
+ else if (curtype->IsKind(STANDARD_TYPE(MS_Enum))) {
+ api->AddVariable("%CLName",curtype->FullName()->ToCString());
+ api->Apply("%TextDecl",
+ "InterfInitEnumType");
+ api->WriteFile("Interfilecxx",
+ "%TextDecl");
+ treated = Standard_True;
+ }
+ if (!treated) {
+ api->AddVariable("%CLName",curtype->FullName()->ToCString());
+ api->Apply("%TextDecl",
+ "InterfInitGlobType");
+ api->WriteFile("Interfilecxx",
+ "%TextDecl");
+ }
+ ittyp1.Next();
+ }
+
+ char numinh[NBDIGITINH];
+
+ MS_DataMapIteratorOfMapOfType ittyp2(mapvaltype);
+
+ while (ittyp2.More()) {
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(ittyp2.Value());
+ Handle(TColStd_HSequenceOfHAsciiString) seqpar = thecl->GetFullInheritsNames();
+ Handle(TCollection_HAsciiString) inhdeclar = new TCollection_HAsciiString();
+ Handle(TCollection_HAsciiString) inhlist = new TCollection_HAsciiString();
+ for (i = 1; i<= seqpar->Length(); i++) {
+ api->AddVariable("%NumInh",i);
+ api->AddVariable("%InhName",seqpar->Value(i)->ToCString());
+ api->Apply("%TextInh",
+ "InterfInitDeclInhType");
+ inhdeclar->AssignCat(api->GetVariableValue("%TextInh")->ToCString());
+ inhlist->AssignCat("aType");
+ sprintf(numinh,"%d",i);
+ inhlist->AssignCat(numinh);
+ inhlist->AssignCat((Standard_CString)",\n");
+ }
+ api->AddVariable("%CLName",thecl->FullName()->ToCString());
+ api->AddVariable("%InhDeclar",inhdeclar->ToCString());
+ api->AddVariable("%InhList",inhlist->ToCString());
+ api->AddVariable("%NbInh",thecl->GetInheritsNames()->Length());
+ api->Apply("%TextDecType",
+ "InterfInitDefType");
+ api->WriteFile("Interfilecxx",
+ "%TextDecType");
+
+ ittyp2.Next();
+ }
+
+}
+
+void CPPIntExt_ProcessExec(const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const MS_MapOfType& maptype)
+{
+ api->AddVariable("%IntName",srcInterface->Name()->ToCString());
+ api->Apply("%TextExec",
+ "InterfExec");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+ MS_DataMapIteratorOfMapOfType ittyp(maptype);
+ while (ittyp.More()) {
+ if (!ittyp.Value()->IsKind(STANDARD_TYPE(MS_Alias))) {
+ api->AddVariable("%CLName",ittyp.Key()->ToCString());
+ api->Apply("%TextTypeCall",
+ "InterfInitTypeCall");
+ api->WriteFile("Interfilecxx",
+ "%TextTypeCall");
+ }
+ ittyp.Next();
+ }
+
+ api->Apply("%TextExec",
+ "InterfExecContinue");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+
+
+
+}
+
+void CPPIntExt_ProcessBottom(const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api)
+{
+ api->Apply("%TextBottom",
+ "InterfBottom");
+ api->WriteFile("Interfilecxx",
+ "%TextBottom");
+
+}
+
+void CPPIntExt_ProcessMultiExec(const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const TColStd_SequenceOfInteger& seqcase,
+ const MS_MapOfType& maptype)
+{
+ api->AddVariable("%IntName",srcInterface->Name()->ToCString());
+ api->Apply("%TextExec",
+ "InterfMultiExec");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+ MS_DataMapIteratorOfMapOfType ittyp(maptype);
+ while (ittyp.More()) {
+ if (!ittyp.Value()->IsKind(STANDARD_TYPE(MS_Alias))) {
+ api->AddVariable("%CLName",ittyp.Key()->ToCString());
+ api->Apply("%TextTypeCall",
+ "InterfInitTypeCall");
+ api->WriteFile("Interfilecxx",
+ "%TextTypeCall");
+ }
+ ittyp.Next();
+ }
+
+ api->Apply("%TextExec",
+ "InterfMultiExecContinue");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+
+ for (Standard_Integer i=1; i<seqcase.Length(); i++) {
+ api->AddVariable("%NumCaseFunc",i);
+ api->AddVariable("%NumCaseFirst",seqcase(i));
+ api->AddVariable("%NumCaseLast",seqcase(i+1));
+ api->Apply("%TextCaseCall",
+ "InterfMultiCaseCall");
+ api->WriteFile("Interfilecxx",
+ "%TextCaseCall");
+
+ }
+
+
+ api->AddVariable("%IntMaxCase",seqcase(seqcase.Length()));
+ api->Apply("%TextBottom",
+ "InterfMultiBottom");
+ api->WriteFile("Interfilecxx",
+ "%TextBottom");
+
+}
+
+
+void CPPIntExt_ProcessCxx(const Handle(MS_Engine)& srcEngine,
+ const Handle(EDL_API)& api,
+ const Handle(TColStd_HSequenceOfHAsciiString)& seqint)
+{
+ api->AddVariable("%NbInterf",seqint->Length());
+ api->AddVariable("%EngineName",srcEngine->Name()->ToCString());
+ api->Apply("%TextHeader",
+ "EngineCxxHeader");
+ api->WriteFile("Enginefilecxx",
+ "%TextHeader");
+
+ Standard_Integer i;
+ for (i=1; i<= seqint->Length(); i++) {
+ api->AddVariable("%NumInt",i);
+ api->AddVariable("%IntName",seqint->Value(i)->ToCString());
+ api->Apply("%TextLoad",
+ "EngineCxxLoadMet");
+ api->WriteFile("Enginefilecxx",
+ "%TextLoad");
+ }
+ api->Apply("%TextBottom",
+ "EngineCxxBottom");
+ api->WriteFile("Enginefilecxx",
+ "%TextBottom");
+
+
+}
+
--- /dev/null
+// ADN
+//
+// 11/1995
+//
+
+#include <MS_Type.hxx>
+#include <MS_Class.hxx>
+#include <MS_Param.hxx>
+#include <MS_Method.hxx>
+#include <MS_InstMet.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_Interface.hxx>
+#include <MS_NatType.hxx>
+#include <MS_Enum.hxx>
+#include <MS_Alias.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <MS_DataMapIteratorOfMapOfMethod.hxx>
+#include <EDL_API.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <WOKTools_Array1OfHAsciiString.hxx>
+#include <WOKTools_CompareOfHAsciiString.hxx>
+#include <WOKTools_SortOfHAsciiString.hxx>
+
+#include <CPPIntExt_Predefined.hxx>
+
+Standard_Boolean CPPIntExt_IsRef(const Handle(MS_Type)& atyp,
+ const Handle(MS_MetaSchema)& aMeta)
+{
+ Handle(MS_Class) thearg = Handle(MS_Class)::DownCast(atyp);
+ if (!thearg.IsNull()) {
+ return (thearg->IsTransient() || thearg->IsPersistent());
+ }
+ Handle(MS_Alias) theal = Handle(MS_Alias)::DownCast(atyp);
+ if (!theal.IsNull()) {
+ Handle(TCollection_HAsciiString) deept = theal->DeepType();
+ return CPPIntExt_IsRef(aMeta->GetType(deept),aMeta);
+ }
+ return Standard_False;
+}
+
+Handle(TCollection_HAsciiString)
+ CPPIntExt_BuildAnArg(const Handle(MS_Param)& aparam,
+ const Standard_Integer position,
+ const Handle(EDL_API)& api,
+ const Handle(MS_MetaSchema)& aMeta)
+{
+ api->AddVariable("%NumArg",position);
+ api->AddVariable("%TypArg",aparam->Type()->FullName()->ToCString());
+ if (CPPIntExt_IsRef(aparam->Type(),aMeta)) {
+ api->Apply("%TextArg",
+ "InterfHandleArg");
+ }
+ else {
+ api->Apply("%TextArg",
+ "InterfArg");
+ }
+ return api->GetVariableValue("%TextArg");
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) CPPIntExt_BuildArgs(const Handle(MS_Method)& aMet,
+ const Handle(EDL_API)& api,
+ const Handle(MS_MetaSchema)& aMeta)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) seqres = new TColStd_HSequenceOfHAsciiString();
+ Handle(MS_HArray1OfParam) theargs = aMet->Params();
+ Standard_Boolean oncemore = Standard_True;
+
+ Standard_Integer nbargs;
+
+ if(theargs.IsNull())
+ nbargs = 0;
+ else
+ nbargs = theargs->Length();
+
+ while (oncemore) {
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString();
+
+ for (Standard_Integer i=1; i<=nbargs; i++) {
+ if (i > 1) {
+ result->AssignCat(", ");
+ }
+ result->AssignCat(CPPIntExt_BuildAnArg(theargs->Value(i),i,api,aMeta));
+ }
+
+ seqres->Append(result);
+
+ if (nbargs > 0) {
+ if (theargs->Value(nbargs)->GetValueType() == MS_NONE) {
+ oncemore = Standard_False;
+ }
+ else {
+ nbargs--;
+ }
+ }
+ else {
+ oncemore = Standard_False;
+ }
+ }
+ return seqres;
+}
+
+void
+CPPIntExt_WriteCase(const Standard_Integer casenumber,
+ const Handle(EDL_API)& api)
+{
+
+ api->AddVariable("%NumCase",casenumber);
+
+ api->Apply("%TextCase",
+ "InterfCase");
+ api->WriteFile("Interfilecxx",
+ "%TextCase");
+}
+
+void
+CPPIntExt_WriteBreak(const Handle(EDL_API)& api)
+{
+ api->Apply("%TextBreak",
+ "InterfBreak");
+ api->WriteFile("Interfilecxx",
+ "%TextBreak");
+
+}
+
+void
+CPPIntExt_WriteArgsDat(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Method)& amet,
+ const Handle(EDL_API)& api,
+ const Standard_Integer nbremove)
+{
+ Handle(MS_HArray1OfParam) params = amet->Params();
+ if(!params.IsNull())
+ api->WriteFileConst("Interfiledat",params->Length()-nbremove);
+ else
+ api->WriteFileConst("Interfiledat",0-nbremove);
+
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+
+ if(!params.IsNull()) {
+ for (Standard_Integer i=1; i<= params->Length()-nbremove; i++) {
+ Handle(MS_Type) thetype = params->Value(i)->Type();
+ if (thetype->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(TCollection_HAsciiString) deepname = Handle(MS_Alias)::DownCast(thetype)->DeepType();
+ thetype = aMeta->GetType(deepname);
+ }
+ api->WriteFileConst("Interfiledat",thetype->FullName()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+ if (params->Value(i)->IsIn()) {
+ if (params->Value(i)->IsOut()) {
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineInOut);
+ }
+ else {
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineIn);
+ }
+ }
+ else {
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineOut);
+ }
+ }
+ }
+}
+
+
+void CPPIntExt_WriteMethodDat(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(EDL_API)& api,
+ const Standard_Integer nbremove)
+{
+ api->WriteFileConst("Interfiledat",amet->Name()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+
+ if (amet->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ Handle(MS_Type) theclass = aMeta->GetType(Handle(MS_InstMet)::DownCast(amet)->Class());
+ api->WriteFileConst("Interfiledat",theclass->FullName()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineInstance);
+ }
+ else {
+ Handle(MS_ExternMet) pkmet = Handle(MS_ExternMet)::DownCast(amet);
+ if (!pkmet.IsNull()) {
+ api->WriteFileConst("Interfiledat",pkmet->Package()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EnginePackage);
+ }
+ else {
+ api->WriteFileConst("Interfiledat",Handle(MS_ClassMet)::DownCast(amet)->Class()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineClass);
+ }
+ }
+ CPPIntExt_WriteArgsDat(aMeta,
+ amet,
+ api,
+ nbremove);
+ Handle(MS_Param) theret = amet->Returns();
+ if (theret.IsNull()) {
+ api->WriteFileConst("Interfiledat","0\n");
+ }
+ else {
+ api->WriteFileConst("Interfiledat","1\n");
+ Handle(MS_Type) rettype = theret->Type();
+ if (rettype->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(TCollection_HAsciiString) deepname = Handle(MS_Alias)::DownCast(rettype)->DeepType();
+ rettype = aMeta->GetType(deepname);
+ }
+ api->WriteFileConst("Interfiledat",rettype->FullName()->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+ }
+}
+
+void
+CPPIntExt_WriteMetOut(const Handle(MS_Method)&,
+ const Handle(MS_MetaSchema)&,
+ const Handle(MS_Interface)&,
+ const Handle(EDL_API)&,
+ const Standard_Integer);
+void
+CPPIntExt_WriteConstructor(const Handle(MS_Construc)& ametconst,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ Standard_Integer& count)
+{
+ Handle(TCollection_HAsciiString) theclass = ametconst->Class();
+ Handle(MS_Type) thetype = aMeta->GetType(theclass);
+ if (!Handle(MS_Class)::DownCast(thetype)->Deferred()) {
+ Handle(TColStd_HSequenceOfHAsciiString) seqargs = CPPIntExt_BuildArgs(ametconst,api,aMeta);
+ for (Standard_Integer i=1; i<= seqargs->Length(); i++) {
+
+ CPPIntExt_WriteCase(count,api);
+ Handle(TCollection_HAsciiString) args = seqargs->Value(i);
+ api->AddVariable("%ArgsConstruc",
+ args->ToCString());
+ api->AddVariable("%CLName",theclass->ToCString());
+ if (CPPIntExt_IsRef(thetype,aMeta)) {
+ api->Apply("%TextConstructor",
+ "InterfHandleConstructor");
+ }
+ else {
+ api->Apply("%TextConstructor",
+ "InterfConstructor");
+ }
+ api->WriteFile("Interfilecxx",
+ "%TextConstructor");
+ CPPIntExt_WriteMetOut(ametconst,aMeta,srcInterface,api,0);
+ CPPIntExt_WriteBreak(api);
+ count++;
+ // ecriture .dat
+ api->WriteFileConst("Interfiledat",CPPIntPredef_Create);
+ api->WriteFileConst("Interfiledat",theclass->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_EngineConstructor);
+ CPPIntExt_WriteArgsDat(aMeta,ametconst,api,i-1);
+ api->WriteFileConst("Interfiledat","1\n");
+
+ api->WriteFileConst("Interfiledat",theclass->ToCString());
+ api->WriteFileConst("Interfiledat",CPPIntPreDef_NewLine);
+
+ }
+ }
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) CPPIntExt_BuildMethodBody(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api)
+{
+ api->AddVariable("%MetName",amet->Name()->ToCString());
+
+ Handle(TColStd_HSequenceOfHAsciiString) seqargs = CPPIntExt_BuildArgs(amet,api,aMeta);
+ Handle(TColStd_HSequenceOfHAsciiString) seqres = new TColStd_HSequenceOfHAsciiString();
+
+ for (Standard_Integer i=1; i<= seqargs->Length(); i++) {
+ api->AddVariable("%ArgsMet",seqargs->Value(i)->ToCString());
+
+ if (amet->IsKind(STANDARD_TYPE(MS_InstMet))) {
+ Handle(MS_Type) theclass = aMeta->GetType(Handle(MS_InstMet)::DownCast(amet)->Class());
+
+ api->AddVariable("%CLName",theclass->FullName()->ToCString());
+ if (CPPIntExt_IsRef(theclass,aMeta)) {
+ api->Apply("%TextBody",
+ "InterfInstMethodHandleBody");
+ }
+ else {
+ api->Apply("%TextBody",
+ "InterfInstMethodBody");
+ }
+ }
+ else {
+ Handle(MS_ExternMet) pkmet = Handle(MS_ExternMet)::DownCast(amet);
+
+ if (!pkmet.IsNull()) {
+ api->AddVariable("%CLName",pkmet->Package()->ToCString());
+ }
+ else {
+ api->AddVariable("%CLName",
+ Handle(MS_ClassMet)::DownCast(amet)->Class()->ToCString());
+ }
+ api->Apply("%TextBody",
+ "InterfClassMethodBody");
+ }
+ seqres->Append(api->GetVariableValue("%TextBody"));
+ }
+
+ return seqres;
+}
+
+void
+CPPIntExt_WriteMetOut(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const Standard_Integer nbargsminus)
+{
+ Handle(MS_HArray1OfParam) parameters = amet->Params();
+
+ if(!parameters.IsNull()) {
+ for (Standard_Integer i=1; i<= parameters->Length() - nbargsminus; i++) {
+ if (parameters->Value(i)->IsOut()) {
+ if (parameters->Value(i)->Type()->IsKind(STANDARD_TYPE(MS_NatType))) {
+ Handle(TCollection_HAsciiString) thearg =
+ CPPIntExt_BuildAnArg(parameters->Value(i),
+ i,
+ api,
+ aMeta);
+ api->AddVariable("%Arg",thearg->ToCString());
+ api->AddVariable("%Pos",i);
+ if (parameters->Value(i)->Type()->IsKind(STANDARD_TYPE(MS_Enum))) {
+ api->Apply("%TextOutArg",
+ "InterfEngineOutArgEnum");
+ }
+ else {
+ api->Apply("%TextOutArg",
+ "InterfEngineOutArg");
+ }
+ api->WriteFile("Interfilecxx",
+ "%TextOutArg");
+ }
+ }
+ }
+ }
+}
+
+
+void
+CPPIntExt_WriteCall(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ Standard_Integer& count)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) seqfunc = CPPIntExt_BuildMethodBody(amet,aMeta,srcInterface,api);
+ for (Standard_Integer i=1; i<= seqfunc->Length(); i++) {
+ CPPIntExt_WriteCase(count,api);
+ Handle(TCollection_HAsciiString) func = seqfunc->Value(i);
+ func->AssignCat(";");
+ api->WriteFileConst("Interfilecxx",func->ToCString());
+ CPPIntExt_WriteMetOut(amet,aMeta,srcInterface,api,i-1);
+ CPPIntExt_WriteBreak(api);
+ CPPIntExt_WriteMethodDat(amet,aMeta,api,i-1);
+ count++;
+ }
+}
+
+Standard_Boolean CPPIntExt_HasPublicMagic(const Handle(MS_Type)& atyp)
+{
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(atyp);
+ if (thecl.IsNull()) return Standard_True;
+ Handle(MS_HSequenceOfMemberMet) methods = thecl->GetMethods();
+ for (Standard_Integer i=1; i<= methods->Length(); i++) {
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ Handle(MS_HArray1OfParam) parameters = methods->Value(i)->Params();
+ if (!parameters.IsNull()) {
+ if (parameters->Length() == 1) {
+ if (parameters->Value(1)->Type() == atyp) {
+ if (methods->Value(i)->Private()) {
+ return Standard_False;
+ }
+ return Standard_True;
+ }
+ }
+ }
+ }
+ }
+ return Standard_True;
+}
+
+Standard_Boolean CPPIntExt_HasPublicEmpty(const Handle(MS_Type)& atyp)
+{
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(atyp);
+ if (thecl.IsNull()) return Standard_False;
+ Handle(MS_HSequenceOfMemberMet) methods = thecl->GetMethods();
+ for (Standard_Integer i=1; i<= methods->Length(); i++) {
+ if (methods->Value(i)->IsKind(STANDARD_TYPE(MS_Construc))) {
+ Handle(MS_HArray1OfParam) parameters = methods->Value(i)->Params();
+ if (parameters.IsNull()) {
+ if (methods->Value(i)->Private()) {
+ return Standard_False;
+ }
+ return Standard_True;
+ }
+ }
+ }
+ return Standard_False;
+}
+
+
+void
+CPPIntExt_WriteRetClass(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ Standard_Integer& count)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) seqfunc = CPPIntExt_BuildMethodBody(amet,aMeta,srcInterface,api);
+ for (Standard_Integer i=1; i<= seqfunc->Length(); i++) {
+ Handle(TCollection_HAsciiString) func = seqfunc->Value(i);
+
+ CPPIntExt_WriteCase(count,api);
+ api->AddVariable("%TextEngineHandle",func->ToCString());
+ Handle(MS_Param) theret = amet->Returns();
+ api->AddVariable("%CLName",theret->TypeName()->ToCString());
+ Handle(MS_Type) therettyp = theret->Type();
+ if (CPPIntExt_IsRef(therettyp,aMeta)) {
+ api->Apply("%TextCall",
+ "InterfNewEHHandle");
+ }
+ else if (amet->IsRefReturn()) {
+ api->Apply("%TextCall",
+ "InterfNewEHRef");
+ }
+ else if (CPPIntExt_HasPublicMagic(therettyp)) {
+ api->Apply("%TextCall",
+ "InterfNewEHMagic");
+ }
+ else if (CPPIntExt_HasPublicEmpty(therettyp)) {
+ api->Apply("%TextCall",
+ "InterfNewEHEmpty");
+ }
+ else {
+ api->Apply("%TextCall",
+ "InterfNewEHMalloc");
+ }
+ api->WriteFile("Interfilecxx",
+ "%TextCall");
+ CPPIntExt_WriteMetOut(amet,aMeta,srcInterface,api,i-1);
+ CPPIntExt_WriteBreak(api);
+ CPPIntExt_WriteMethodDat(amet,aMeta,api,i-1);
+ count++;
+ }
+}
+
+void
+CPPIntExt_WriteRetNat(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ Standard_Integer& count)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) seqfunc = CPPIntExt_BuildMethodBody(amet,aMeta,srcInterface,api);
+ for (Standard_Integer i=1; i<= seqfunc->Length(); i++) {
+ Handle(TCollection_HAsciiString) func = seqfunc->Value(i);
+ CPPIntExt_WriteCase(count,api);
+ api->AddVariable("%TextEngineHandle",func->ToCString());
+ if (amet->Returns()->Type()->IsKind(STANDARD_TYPE(MS_Enum))) {
+ api->Apply("%TextCall",
+ "InterfEngineReturnEnum");
+ }
+ else {
+ api->Apply("%TextCall",
+ "InterfEngineReturn");
+ }
+ api->WriteFile("Interfilecxx",
+ "%TextCall");
+ CPPIntExt_WriteMetOut(amet,aMeta,srcInterface,api,i-1);
+ CPPIntExt_WriteBreak(api);
+ CPPIntExt_WriteMethodDat(amet,aMeta,api,i-1);
+ count++;
+ }
+}
+
+void
+CPPIntExt_WriteMethod(const Handle(MS_Method)& amet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ Standard_Integer& count)
+{
+ Handle(MS_Param) parret = amet->Returns();
+ if (parret.IsNull()) {
+ CPPIntExt_WriteCall(amet,aMeta,srcInterface,api,count);
+ }
+ else {
+ Handle(MS_Type) typret = parret->Type();
+ if (typret->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(TCollection_HAsciiString) deepname = Handle(MS_Alias)::DownCast(typret)->DeepType();
+ typret = aMeta->GetType(deepname);
+ }
+ if (typret->IsKind(STANDARD_TYPE(MS_Class))) {
+ CPPIntExt_WriteRetClass(amet,aMeta,srcInterface,api,count);
+ }
+ else {
+ CPPIntExt_WriteRetNat(amet,aMeta,srcInterface,api,count);
+ }
+ }
+}
+
+void CPPIntExt_ProcessCases(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const MS_MapOfMethod& expmap)
+{
+ MS_DataMapIteratorOfMapOfMethod itmet(expmap);
+ WOKTools_Array1OfHAsciiString armet(1,expmap.Extent());
+ Standard_Integer count = 1;
+ while (itmet.More()) {
+ armet(count) = itmet.Value()->FullName();
+ count++;
+ itmet.Next();
+ }
+ WOKTools_CompareOfHAsciiString cmpmet;
+ WOKTools_SortOfHAsciiString::Sort(armet,cmpmet);
+
+ count = 1;
+
+ for(Standard_Integer i=1;i<=armet.Length(); i++) {
+ Handle(MS_Method) themet = expmap(armet(i));
+ Handle(MS_Construc) metconstr = Handle(MS_Construc)::DownCast(themet);
+ if (!metconstr.IsNull()) {
+ CPPIntExt_WriteConstructor(metconstr,aMeta,srcInterface,api,count);
+ }
+ else {
+ CPPIntExt_WriteMethod(themet,aMeta,srcInterface,api,count);
+ }
+ }
+}
+
+
+void CPPIntExt_ProcessMultiCases(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ const MS_MapOfMethod& expmap,
+ TColStd_SequenceOfInteger& switchcount)
+{
+ switchcount.Clear();
+ switchcount.Append(1);
+ MS_DataMapIteratorOfMapOfMethod itmet(expmap);
+ WOKTools_Array1OfHAsciiString armet(1,expmap.Extent());
+ Standard_Integer count = 1;
+ while (itmet.More()) {
+ armet(count) = itmet.Value()->FullName();
+ count++;
+ itmet.Next();
+ }
+ WOKTools_CompareOfHAsciiString cmpmet;
+ WOKTools_SortOfHAsciiString::Sort(armet,cmpmet);
+
+ count = 1;
+ Standard_Integer countintcase =1;
+ api->AddVariable("%IntName",srcInterface->Name()->ToCString());
+ api->AddVariable("%NumCaseFunc",1);
+ api->Apply("%TextExec",
+ "InterfMultiFuncCall");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+
+ for(Standard_Integer i=1;i<=armet.Length(); i++) {
+ if ((count - switchcount(countintcase)) >= CPPINTEXT_MAXINTFSWITCH) {
+ api->Apply("%TextExec",
+ "InterfMultiFuncEndCall");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+ countintcase++;
+ switchcount.Append(count);
+ api->AddVariable("%IntName",srcInterface->Name()->ToCString());
+ api->AddVariable("%NumCaseFunc",countintcase);
+ api->Apply("%TextExec",
+ "InterfMultiFuncCall");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+ }
+
+ Handle(MS_Method) themet = expmap(armet(i));
+ Handle(MS_Construc) metconstr = Handle(MS_Construc)::DownCast(themet);
+ if (!metconstr.IsNull()) {
+ CPPIntExt_WriteConstructor(metconstr,aMeta,srcInterface,api,count);
+ }
+ else {
+ CPPIntExt_WriteMethod(themet,aMeta,srcInterface,api,count);
+ }
+ }
+ api->Apply("%TextExec",
+ "InterfMultiFuncEndCall");
+ api->WriteFile("Interfilecxx",
+ "%TextExec");
+ switchcount.Append(count);
+}
--- /dev/null
+// ADN
+//
+// 12/1995
+//
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Engine.hxx>
+#include <MS_Class.hxx>
+#include <MS_Package.hxx>
+#include <MS_Enum.hxx>
+#include <MS_MapOfType.hxx>
+#include <MS_DataMapIteratorOfMapOfType.hxx>
+#include <MS_DataMapIteratorOfMapOfGlobalEntity.hxx>
+#include <MS_MapOfGlobalEntity.hxx>
+#include <EDL_API.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+
+void CPPIntExt_ProcessCcl(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Engine)& srcEngine,
+ const Handle(EDL_API)& api,
+ MS_MapOfType& maptype,
+ MS_MapOfGlobalEntity& mappack)
+{
+ // Writing Classes declarations
+
+ MS_DataMapIteratorOfMapOfType ittype1(maptype);
+
+ while (ittype1.More()) {
+ if (ittype1.Value()->IsKind(STANDARD_TYPE(MS_Class))) {
+ api->AddVariable("%CLName",ittype1.Key()->ToCString());
+ api->Apply("%TextDefClass",
+ "EngineLLDefClass");
+ api->WriteFile("Enginefilell",
+ "%TextDefClass");
+ }
+ ittype1.Next();
+ }
+ // Writing Packages declarations
+
+ MS_DataMapIteratorOfMapOfGlobalEntity itpack(mappack);
+
+ while (itpack.More()) {
+ api->AddVariable("%PKName",itpack.Key()->ToCString());
+ api->Apply("%TextDefPackage",
+ "EngineLLDefPackage");
+ api->WriteFile("Enginefilell",
+ "%TextDefPackage");
+ itpack.Next();
+ }
+
+ // Writing Enums
+
+ MS_DataMapIteratorOfMapOfType ittype2(maptype);
+
+
+ while (ittype2.More()) {
+ if (ittype2.Value()->IsKind(STANDARD_TYPE(MS_Enum))) {
+ Handle(MS_Enum) theenum = Handle(MS_Enum)::DownCast(ittype2.Value());
+ Handle(TColStd_HSequenceOfHAsciiString) seqval = theenum->Enums();
+ for (Standard_Integer i=1; i<= seqval->Length(); i++) {
+ api->AddVariable("%EnumMember",
+ seqval->Value(i)->ToCString());
+ api->AddVariable("%EnumValue",i-1);
+ api->Apply("%TextDefEnum",
+ "EngineLLSetEnum");
+ api->WriteFile("Enginefilell",
+ "%TextDefEnum");
+ }
+ }
+ ittype2.Next();
+ }
+}
+
+
+
--- /dev/null
+// ADN
+//
+// 12/1995
+//
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Engine.hxx>
+#include <MS_Class.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Enum.hxx>
+#include <MS_MapOfType.hxx>
+#include <MS_DataMapIteratorOfMapOfType.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <EDL_API.hxx>
+
+#define NBDIGITINH 10
+
+#include <stdio.h>
+
+Standard_Boolean CPPIntExt_IsRef(const Handle(MS_Type)&,
+ const Handle(MS_MetaSchema)&);
+
+void
+CPPIntExt_ProcessEngineInit(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Engine)& srcEngine,
+ const Handle(EDL_API)& api,
+ MS_MapOfType& maptype)
+{
+ api->Apply("%TextHeader",
+ "EngineInitHeader");
+ api->WriteFile("Enginefileinit",
+ "%TextHeader");
+
+ // Remplissage map des types par valeurs (et hierarchie)
+
+ Standard_Integer i;
+
+ MS_MapOfType mapvaltype;
+ MS_MapOfType mapenum;
+ MS_DataMapIteratorOfMapOfType ittyp1(maptype);
+ Standard_Boolean treated;
+ Handle(MS_Type) curtype;
+ while (ittyp1.More()) {
+ treated = Standard_False;
+ curtype = ittyp1.Value();
+ if (curtype->IsKind(STANDARD_TYPE(MS_Alias))) {
+ Handle(TCollection_HAsciiString) deepname = Handle(MS_Alias)::DownCast(curtype)->DeepType();
+ curtype = aMeta->GetType(deepname);
+ }
+ if (curtype->IsKind(STANDARD_TYPE(MS_Class))) {
+ if (!Handle(MS_Class)::DownCast(curtype)->IsStorable()) {
+ if (!CPPIntExt_IsRef(curtype,aMeta)) {
+ treated = Standard_True;
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(curtype);
+ mapvaltype.Bind(thecl->FullName(),thecl);
+ Handle(TColStd_HSequenceOfHAsciiString) theinh = thecl->GetFullInheritsNames();
+ for (i=1; i<= theinh->Length(); i++) {
+ mapvaltype.Bind(theinh->Value(i),
+ aMeta->GetType(theinh->Value(i)));
+ }
+ }
+ }
+ }
+ else if (curtype->IsKind(STANDARD_TYPE(MS_Enum))) {
+ if (!mapenum.IsBound(curtype->FullName())) {
+ api->AddVariable("%CLName",curtype->FullName()->ToCString());
+ api->Apply("%TextDecl",
+ "EngineInitEnumType");
+ api->WriteFile("Enginefileinit",
+ "%TextDecl");
+ treated = Standard_True;
+ mapenum.Bind(curtype->FullName(),curtype);
+ }
+ }
+ if (!treated) {
+ api->AddVariable("%CLName",curtype->FullName()->ToCString());
+ api->Apply("%TextDecl",
+ "EngineInitGlobType");
+ api->WriteFile("Enginefileinit",
+ "%TextDecl");
+ }
+ ittyp1.Next();
+ }
+
+ char numinh[NBDIGITINH];
+
+ MS_DataMapIteratorOfMapOfType ittyp2(mapvaltype);
+
+ while (ittyp2.More()) {
+ Handle(MS_Class) thecl = Handle(MS_Class)::DownCast(ittyp2.Value());
+ Handle(TColStd_HSequenceOfHAsciiString) seqpar = thecl->GetFullInheritsNames();
+ Handle(TCollection_HAsciiString) inhdeclar = new TCollection_HAsciiString();
+ Handle(TCollection_HAsciiString) inhlist = new TCollection_HAsciiString();
+ for (i = 1; i<= seqpar->Length(); i++) {
+ api->AddVariable("%NumInh",i);
+ api->AddVariable("%InhName",seqpar->Value(i)->ToCString());
+ api->Apply("%TextInh",
+ "EngineInitDeclInhType");
+ inhdeclar->AssignCat(api->GetVariableValue("%TextInh")->ToCString());
+ inhlist->AssignCat("aType");
+ sprintf(numinh,"%d",i);
+ inhlist->AssignCat(numinh);
+ inhlist->AssignCat((Standard_CString)",\n");
+ }
+ api->AddVariable("%CLName",thecl->FullName()->ToCString());
+ api->AddVariable("%InhDeclar",inhdeclar->ToCString());
+ api->AddVariable("%InhList",inhlist->ToCString());
+ api->AddVariable("%NbInh",thecl->GetInheritsNames()->Length());
+ api->Apply("%TextDecType",
+ "EngineInitDefType");
+ api->WriteFile("Enginefileinit",
+ "%TextDecType");
+
+ ittyp2.Next();
+ }
+
+ api->Apply("%TextInitFunc",
+ "EngineInitFunction");
+ api->WriteFile("Enginefileinit",
+ "%TextInitFunc");
+ MS_DataMapIteratorOfMapOfType ittyp3(maptype);
+ while (ittyp3.More()) {
+ if (!ittyp3.Value()->IsKind(STANDARD_TYPE(MS_Alias))) {
+ api->AddVariable("%CLName",ittyp3.Key()->ToCString());
+ api->Apply("%TextTypeCall",
+ "EngineInitTypeCall");
+ api->WriteFile("Enginefileinit",
+ "%TextTypeCall");
+ }
+ ittyp3.Next();
+ }
+
+ api->Apply("%TextInitFunc",
+ "EngineInitBody");
+ api->WriteFile("Enginefileinit",
+ "%TextInitFunc");
+
+}
+
--- /dev/null
+// ADN
+//
+// 11/1995
+//
+
+#include <MS.hxx>
+#include <MS_Method.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_Interface.hxx>
+#include <MS_Engine.hxx>
+#include <MS_Class.hxx>
+#include <MS_Enum.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Param.hxx>
+#include <MS_MapOfMethod.hxx>
+#include <MS_MapOfType.hxx>
+#include <MS_MapOfGlobalEntity.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <EDL_API.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+void CPPIntExt_ProcessAMethod(const Handle(MS_Method)& themet,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs)
+{
+ if (!themet->Private()) {
+ if (MS::IsExportableMethod(aMeta,themet)) {
+ expmap.Bind(themet->FullName(),themet);
+ Handle(MS_Param) theret = themet->Returns();
+ if (!theret.IsNull()) {
+ maptype.Bind(theret->TypeName(),theret->Type());
+ mapusedtype.Bind(theret->TypeName(),theret->Type());
+ }
+ Handle(MS_HArray1OfParam) theargs = themet->Params();
+ if (!theargs.IsNull()) {
+ for (Standard_Integer i=theargs->Lower(); i<= theargs->Upper(); i++) {
+ if (AddArgs) {
+ maptype.Bind(theargs->Value(i)->TypeName(),
+ theargs->Value(i)->Type());
+ }
+ mapusedtype.Bind(theargs->Value(i)->TypeName(),
+ theargs->Value(i)->Type());
+ }
+ }
+ }
+ else {
+ WarningMsg << "CPPIntExt_ProcessAMethod"
+ << "Cannot export method " << themet->FullName()->ToCString() << endm;
+ }
+ }
+}
+
+void CPPIntExt_ProcessAClass(const Handle(MS_Class)& theclass,
+ const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs)
+{
+ if (MS::IsExportableClass(aMeta,theclass,Standard_False,Standard_False)) {
+ maptype.Bind(theclass->FullName(),theclass);
+ mapusedtype.Bind(theclass->FullName(),theclass);
+ Handle(MS_HSequenceOfMemberMet) themets = theclass->GetMethods();
+ for (Standard_Integer i=1; i<= themets->Length(); i++) {
+ if (!themets->Value(i)->Private()) {
+ if (!themets->Value(i)->IsProtected()) {
+ CPPIntExt_ProcessAMethod(themets->Value(i),aMeta,srcInterface,api,expmap,
+ maptype,mapusedtype,mappack,AddArgs);
+ }
+ }
+ }
+ }
+ else {
+ WarningMsg << "CPPIntExt_ProcessAClass"
+ << "Cannot export class " << theclass->FullName()->ToCString() << endm;
+ }
+}
+
+
+void
+CPPIntExt_ProcessClasses(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) classesnames = srcInterface->Classes();
+ for (Standard_Integer i=1; i<= classesnames->Length(); i++) {
+ Handle(MS_Class) curcl = Handle(MS_Class)::DownCast(aMeta->GetType(classesnames->Value(i)));
+ CPPIntExt_ProcessAClass(curcl,aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ }
+}
+
+void
+CPPIntExt_ProcessPackages(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) pknames = srcInterface->Packages();
+ for (Standard_Integer i=1; i<= pknames->Length(); i++) {
+ Handle(MS_Package) curpk = aMeta->GetPackage(pknames->Value(i));
+ Handle(MS_HSequenceOfExternMet) mets = curpk->Methods();
+ Standard_Integer j;
+ if (!mets->IsEmpty()) {
+ mappack.Bind(curpk->Name(),curpk);
+ for (j=1; j<= mets->Length(); j++) {
+ CPPIntExt_ProcessAMethod(mets->Value(j),aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ }
+ }
+ Handle(TColStd_HSequenceOfHAsciiString) classesnames = curpk->Classes();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Class) curcl = Handle(MS_Class)::DownCast(aMeta->GetType(fullname));
+ if (!curcl->Private()) {
+ CPPIntExt_ProcessAClass(curcl,aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ }
+ }
+ classesnames = curpk->Enums();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Type) curtyp = aMeta->GetType(fullname);
+ if (!curtyp->Private()) {
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ classesnames = curpk->Aliases();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Type) curtyp = aMeta->GetType(fullname);
+ if (!curtyp->Private()) {
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ classesnames = curpk->Pointers();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Type) curtyp = aMeta->GetType(fullname);
+ if (!curtyp->Private()) {
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ classesnames = curpk->Importeds();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Type) curtyp = aMeta->GetType(fullname);
+ if (!curtyp->Private()) {
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ classesnames = curpk->Primitives();
+ for (j=1; j<= classesnames->Length(); j++) {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(pknames->Value(i),
+ classesnames->Value(j));
+ Handle(MS_Type) curtyp = aMeta->GetType(fullname);
+ if (!curtyp->Private()) {
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ }
+}
+
+void
+CPPIntExt_ProcessMethods(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) metnames = srcInterface->Methods();
+ for (Standard_Integer i=1; i<= metnames->Length(); i++) {
+ Handle(MS_Method) curmet = MS::GetMethodFromFriendName(aMeta,
+ metnames->Value(i));
+ Handle(MS_ExternMet) extmet = Handle(MS_ExternMet)::DownCast(curmet);
+ if (!extmet.IsNull()) {
+ if (!extmet->Private()) {
+ Handle(MS_Package) curpk = aMeta->GetPackage(extmet->Package());
+ mappack.Bind(curpk->Name(),curpk);
+ }
+ }
+ else {
+ Handle(MS_MemberMet) memmet = Handle(MS_MemberMet)::DownCast(curmet);
+ if (!memmet.IsNull()) {
+ if (!memmet->Private()) {
+ Handle(MS_Type) curtyp = aMeta->GetType(memmet->Class());
+ maptype.Bind(curtyp->FullName(),curtyp);
+ mapusedtype.Bind(curtyp->FullName(),curtyp);
+ }
+ }
+ }
+ CPPIntExt_ProcessAMethod(curmet,aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ }
+}
+
+
+void CPPIntExt_LoadMethods(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Interface)& srcInterface,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfType& mapusedtype,
+ MS_MapOfGlobalEntity& mappack,
+ Standard_Boolean AddArgs = Standard_False)
+{
+ CPPIntExt_ProcessClasses(aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ CPPIntExt_ProcessPackages(aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+ CPPIntExt_ProcessMethods(aMeta,srcInterface,api,expmap,maptype,mapusedtype,mappack,AddArgs);
+}
+
+
+void CPPIntExt_LoadMethods(const Handle(MS_MetaSchema)& aMeta,
+ const Handle(MS_Engine)& srcEngine,
+ const Handle(EDL_API)& api,
+ MS_MapOfMethod& expmap,
+ MS_MapOfType& maptype,
+ MS_MapOfGlobalEntity& mappack,
+ const Handle(TColStd_HSequenceOfHAsciiString)& seqint)
+{
+ MS_MapOfType alltypes;
+ for (Standard_Integer i=1; i<= seqint->Length(); i++) {
+ Handle(MS_Interface) srcint = aMeta->GetInterface(seqint->Value(i));
+ CPPIntExt_LoadMethods(aMeta,srcint,api,expmap,maptype,alltypes,mappack,Standard_True);
+ }
+}
--- /dev/null
+// Set de variables pour .dat
+
+#define CPPIntPredef_Create "Create\n"
+#define CPPIntPreDef_EngineIn "Engine_In\n"
+#define CPPIntPreDef_EngineOut "Engine_Out\n"
+#define CPPIntPreDef_EngineInOut "Engine_InOut\n"
+#define CPPIntPreDef_NewLine '\n'
+
+// copie de l'enum de Engine MethodCategory
+#define CPPIntPreDef_EnginePackage "1\n"
+#define CPPIntPreDef_EngineClass "2\n"
+#define CPPIntPreDef_EngineInstance "3\n"
+#define CPPIntPreDef_EngineConstructor "4\n"
+
+#define CPPINTEXT_MAXINTFSWITCH 512
+
--- /dev/null
+-- File: Engine_Template.edl
+-- Author: Kernel
+-- History: Thu Dec 21 16:50:43 1995 Kernel Creation
+-- Copyright: Matra Datavision 1995
+
+-- =====================================================
+-- Headers for Engines (Engine.cxx and Engine_Init_.cxx)
+-- =====================================================
+
+@template EngineCxxHeader(%NbInterf,%EngineName) is
+$//----------------------------------------------
+$// Transient Engine Builder Version 1.0
+$// Engine Stub
+$// Copyright (c) 1993,1996 MATRA DATAVISION
+$//----------------------------------------------
+$#include <Engine.hxx>
+$#include <Engine_EnginePlugin.hxx>
+$#include <Engine_ExecutionError.hxx>
+$#include <Engine_Signature.hxx>
+$
+$Handle_Standard_Type& Engine_Handle_Type_(){
+$
+$
+$static Handle_Standard_Transient _Ancestors[]= {
+$
+$NULL};
+$
+$static Handle_Standard_Type _aType =
+$ new Standard_Type("Engine_Handle",
+$ 0, // size is useless
+$ 0,
+$ (Standard_Address)_Ancestors,
+$ (Standard_Address)NULL);
+$return _aType;
+$}
+$
+$void Engine_EnginePlugin::LoadMethods() {}
+$
+$extern "C" Standard_EXPORT void %EngineName_CallLoadMethod(Engine_EnginePlugin& anEngP)
+${
+$
+$ anEngP.CreatePArrayOfInterfacePlugin(%NbInterf) ;
+@end;
+
+@template EngineInitHeader() is
+$//------------------------------------------
+$// Transient Engine Builder Version 1.0
+$// Engine main program
+$// Copyright (c) 1993,1996 MATRA DATAVISION
+$//------------------------------------------
+$#include <signal.h>
+$#include <fstream.h>
+$#include <Engine.hxx>
+$#include <Engine_Signature.hxx>
+$#include <Engine_Argument.hxx>
+$#include <Engine_SequenceOfArgument.hxx>
+$#include <Engine_PSequenceOfArgument.hxx>
+$#include <Engine_AVLSearchTreeOfSignature.hxx>
+$#define CSF1
+$#define LENGTH 255
+$int K_VERBOSE_INIT;
+$// ------------------
+@end;
+
+-- ==================
+-- Engine.cxx Loading
+-- ==================
+
+@template EngineCxxLoadMet(%NumInt,%IntName) is
+$ anEngP.LoadMethods(%NumInt,"%IntName");
+@end;
+
+
+@template EngineCxxContExec() is
+$
+$}
+$
+$void Engine::Execute (const Engine_Signature& aSignature,
+$ const Standard_Address theObject)
+${
+$ Standard_SStream Err;
+$ char* ErrMsg="Error: We have found an interface but we can't execute it:";
+$
+$ switch(aSignature.InterfaceId()) {
+$
+@end;
+
+@template EngineCxxCase(%NumInt,%IntName) is
+$ case %NumInt : {
+$ void %IntName_Execute(const Engine_Signature&,
+$ const Standard_Address);
+$ %IntName_Execute(aSignature,theObject);
+$ break;
+$ }
+$
+@end;
+
+-- =====================
+-- Engine.ll Definitions
+-- =====================
+
+@template EngineLLDefClass(%CLName) is
+$(generic-call %CLName classmethod-generic-call)
+@end;
+
+@template EngineLLDefPackage(%PKName) is
+$(generic-call %PKName packagemethod-generic-call)
+@end;
+
+@template EngineLLSetEnum(%EnumMember,%EnumValue) is
+$(setq %EnumMember %EnumValue)
+@end;
+
+-- =============================
+-- Engine_Init types definitions
+-- =============================
+
+@template EngineInitDefType(%CLName,%InhDeclar,%InhList,%NbInh) is
+$
+@end;
+
+@template EngineInitDeclInhType(%InhName,%NumInh) is
+$
+@end;
+
+@template EngineInitEnumType(%CLName) is
+$
+@end;
+
+@template EngineInitGlobType(%CLName) is
+$
+@end;
+
+
+-- ====================
+-- Engine_Init Function
+-- ====================
+
+@template EngineInitFunction() is
+$
+$void Engine_Init_(Engine_AVLSearchTreeOfSignature& anAVLTree,
+$ const Standard_Integer InterfaceId,
+$ const Standard_CString InterfaceName){
+$
+@end;
+
+@template EngineInitTypeCall(%CLName) is
+$
+@end;
+
+
+@template EngineInitBody() is
+$
+$ char *Get_Engine_Path(void) ;
+$
+$ char MethodName[LENGTH];
+$ char ModuleName[LENGTH];
+$ char Buff [LENGTH];
+$ char Category [LENGTH];
+$ char TypeArg [LENGTH];
+$ Engine_MethodCategory TheCategory ;
+$ Engine_ModeType TheMode ;
+$ int j ;
+$ int NbArg ;
+$ int MethodId = 1 ;
+$ Engine_PSequenceOfArgument Args;
+$ char *FileName;
+$
+$ //char EnginePath[257] ;
+$ char *EnginePath;
+$ //struct STATUS sts;
+$
+$
+$ EnginePath = Get_Engine_Path();
+$ if (EnginePath[0] != '/') {
+$ cerr << "error: Unable to find the engine path" << endl;
+$ }
+$
+$ FileName = new char [ strlen ( EnginePath )
+$ + strlen ( InterfaceName ) + 1
+$ + strlen ("_ExportedMethods.dat") + 1 ];
+$ strcpy (FileName,EnginePath);
+$ strcat (FileName,"-");
+$ strcat (FileName,InterfaceName);
+$ strcat (FileName,"_ExportedMethods.dat");
+$ ifstream file ( FileName );
+$ cout << "\rFileName = " << FileName << "\r" << endl;
+$ while ( file.getline(MethodName,(int)sizeof(Buff) ) ){
+$ file.getline(ModuleName,(int)sizeof(Buff));
+$ file.getline(Category ,(int)sizeof(Buff));
+$ TheCategory = (Engine_MethodCategory) atoi (Category);
+$ file.getline(Buff ,(int)sizeof(Buff));
+$ NbArg = atoi ( Buff );
+$ Args = new Engine_SequenceOfArgument;
+$ for ( j = 1; j <= NbArg; j++){
+$ file.getline(TypeArg,(int)sizeof(Buff));
+$ file.getline(Buff ,(int)sizeof(Buff));
+$ TheMode = (Engine_ModeType) atoi ( Buff );
+$ Args->Append(Engine_Argument(TypeArg,TheMode));
+$ }
+$ file.getline(Buff ,(int)sizeof(Buff));
+$ NbArg = atoi ( Buff );
+$ if(NbArg){
+$ file.getline(TypeArg,(int)sizeof(Buff));
+$ anAVLTree.Insert (Engine_Signature(
+$ MethodName,
+$ ModuleName,
+$ TheCategory,
+$ Args,
+$ Engine_Argument (TypeArg),
+$ MethodId++,
+$ InterfaceId
+$ ));
+$ }
+$ else {
+$ anAVLTree.Insert (Engine_Signature(
+$ MethodName,
+$ ModuleName,
+$ TheCategory,
+$ Args,
+$ Engine_Argument (),
+$ MethodId++,
+$ InterfaceId
+$ ));
+$ }
+$ }
+$ delete [] FileName;
+$
+$
+$}
+@end;
+
+-- =================
+-- Engine.cxx Bottom
+-- =================
+
+@template EngineCxxBottom() is
+$
+$}
+$
+@end;
--- /dev/null
+CPPIntExt.hxx
+CPPIntExt_Predefined.hxx
+CPPIntExt.cxx
+CPPIntExt_Body.cxx
+CPPIntExt_Case.cxx
+CPPIntExt_Load.cxx
+CPPIntExt_Ccl.cxx
+CPPIntExt_EInit.cxx
+FILES
+Interface_Template.edl
+Engine_Template.edl
--- /dev/null
+-- File: Interface_Template.cdl
+-- Created: Thu Dec 21 16:48:50 1995
+-- Author: Kernel
+-- <kernel@dekpon>
+---Copyright: Matra Datavision 1995
+
+-- =====================
+-- Header for Interfaces
+-- =====================
+
+@template InterfHeader() is
+$//----------------------------------------------
+$// Transient Interface Builder Version 1.0
+$// Stub Server Interface
+$// Copyright (c) 1993,1996 MATRA DATAVISION
+$//----------------------------------------------
+$
+$#include <Standard_Macro.hxx>
+$class Handle_Standard_Type;
+$#include <memory.h>
+$
+$#include <Standard_PrimitiveTypes.hxx>
+$#include <Standard_ShortReal.hxx>
+$#include <Standard_ErrorHandler.hxx>
+$#include <Standard_NullObject.hxx>
+$
+$#include <Engine.hxx>
+$#include <Engine_Handle.hxx>
+$#include <Engine_Signature.hxx>
+$#include <Engine_Argument.hxx>
+$#include <Engine_MethodException.hxx>
+$#include <Engine_ExecutionError.hxx>
+$#include <Engine_ArrayOfArguments.hxx>
+$#include <Engine_PArrayOfArguments.hxx>
+$#include <Engine_AVLSearchTreeOfSignature.hxx>
+$
+$void Engine_InterfacePlugin::Execute (const Engine_PSignature& ,
+$ const Standard_Address ) const
+${}
+$
+@end;
+
+-- ================
+-- include of class
+-- ================
+
+@template InterfPkInclude(%PKName) is
+$#include <%PKName.hxx>
+@end;
+
+@template InterfClassInclude(%CLName) is
+$#ifndef _%CLName_HeaderFile
+$#include <%CLName.hxx>
+$#endif
+@end;
+
+@template InterfNatClassInclude(%CLName) is
+$#ifndef _%CLName_HeaderFile
+$#include <%CLName.hxx>
+$#endif
+@end;
+
+-- ===============================
+-- Interface Body (Execute method)
+-- ===============================
+
+
+@template InterfExec(%IntName) is
+$
+$
+$extern "C" Standard_EXPORT void %IntName_CallExecute (Engine_InterfacePlugin& anint,
+$ const Engine_PSignature& aSignature,
+$ const Standard_Address theObject)
+${
+$ char* ErrMsg = "Error: We have found a method but we can't execute it:";
+$
+$
+$ static k_init = 0;
+$ if (!k_init) {
+$ k_init =1;
+$
+@end;
+
+@template InterfExecContinue() is
+$ return;
+$ }
+$ Standard_SStream Err;
+$ Engine_Handle *theHandle;
+$ Standard_Integer theCase = aSignature->MethodId();
+$ Engine_PArrayOfArguments Args = aSignature->PArrayOfArguments();
+$ Engine_Status Eng_Status = Engine_Succes;
+$ {
+$ try {
+$ switch(theCase) {
+@end;
+
+@template InterfMultiExec(%IntName) is
+$
+$
+$extern "C" Standard_EXPORT void %IntName_CallExecute (Engine_InterfacePlugin& anint,
+$ const Engine_PSignature& aSignature,
+$ const Standard_Address theObject)
+${
+$ char* ErrMsg = "Error: We have found a method but we can't execute it:";
+$
+$ static k_init = 0;
+$ if (!k_init) {
+$ k_init =1;
+$
+@end;
+
+@template InterfMultiExecContinue() is
+$ return;
+$ }
+$ Standard_SStream Err;
+$ Engine_Handle *theHandle;
+$ Standard_Integer theCase = aSignature->MethodId();
+$ Engine_PArrayOfArguments Args = aSignature->PArrayOfArguments();
+$ Engine_Status Eng_Status = Engine_Succes;
+$ {
+$ try {
+$
+@end;
+
+
+-- =========================
+-- Interface Switch Elements
+-- =========================
+
+
+@template InterfCase(%NumCase) is
+$ case %NumCase : {
+$
+@end;
+
+@template InterfBreak() is
+$ } break;
+$
+@end;
+
+-- ===============
+-- Interface Calls
+-- ===============
+
+
+@template InterfArg(%TypArg,%NumArg) is
+$*(%TypArg *)(Args->ChangeValue(%NumArg).Value())
+@end;
+
+@template InterfHandleArg(%TypArg,%NumArg) is
+$*(Handle(%TypArg) *)(Args->ChangeValue(%NumArg).Value())
+@end;
+
+@template InterfConstructor(%CLName,%ArgsConstruc) is
+$ %CLName *aHand = new %CLName(%ArgsConstruc);
+$ theHandle=new Engine_Handle((Standard_Address)aHand,STANDARD_TYPE(%CLName));
+$ Engine::Return(*theHandle);
+@end;
+
+@template InterfHandleConstructor(%CLName,%ArgsConstruc) is
+$ Handle(%CLName) aHand = new %CLName(%ArgsConstruc);
+$ theHandle = new Engine_Handle(aHand,STANDARD_TYPE(%CLName));
+$ Engine::Return(*theHandle);
+@end;
+
+@template InterfClassMethodBody(%CLName,%MetName,%ArgsMet) is
+$%CLName::%MetName(%ArgsMet)
+@end;
+
+@template InterfInstMethodBody(%CLName,%MetName,%ArgsMet) is
+$((%CLName *) theObject)->%MetName(%ArgsMet)
+@end;
+
+@template InterfInstMethodHandleBody(%CLName,%MetName,%ArgsMet) is
+$(* ((Handle(%CLName) *) theObject))->%MetName(%ArgsMet)
+@end;
+
+@template InterfNewEHHandle(%TextEngineHandle,%CLName) is
+$theHandle = new Engine_Handle(%TextEngineHandle,STANDARD_TYPE(%CLName));
+$Engine::Return(*theHandle);
+@end;
+
+@template InterfNewEHRef(%TextEngineHandle,%CLName) is
+$const %CLName& aRet = %TextEngineHandle;
+$theHandle = new Engine_Handle((Standard_Address) &aRet,STANDARD_TYPE(%CLName),Standard_False);
+$Engine::Return(*theHandle);
+@end;
+
+@template InterfNewEHMagic(%TextEngineHandle,%CLName) is
+$%CLName *aRet = new %CLName(%TextEngineHandle);
+$theHandle = new Engine_Handle((Standard_Address) aRet,STANDARD_TYPE(%CLName));
+$Engine::Return(*theHandle);
+@end;
+
+@template InterfNewEHEmpty(%TextEngineHandle,%CLName) is
+$%CLName *aRet = new %CLName();
+$*aRet = %TextEngineHandle;
+$theHandle = new Engine_Handle((Standard_Address) aRet,STANDARD_TYPE(%CLName));
+$Engine::Return(*theHandle);
+@end;
+
+@template InterfNewEHMalloc(%TextEngineHandle,%CLName) is
+$%CLName *aRet = ((%CLName *) malloc(sizeof(%CLName)));
+$*aRet = %TextEngineHandle;
+$theHandle = new Engine_Handle((Standard_Address) aRet,STANDARD_TYPE(%CLName));
+$Engine::Return(*theHandle);
+@end;
+
+@template InterfEngineOutArg(%Arg,%Pos) is
+$Engine::Return(%Arg,%Pos);
+@end;
+
+@template InterfEngineOutArgEnum(%Arg,%Pos) is
+$Engine::Return((Standard_Integer) %Arg,%Pos);
+@end;
+
+@template InterfEngineReturn(%TextEngineHandle) is
+$Engine::Return(%TextEngineHandle);
+@end;
+
+@template InterfEngineReturnEnum(%TextEngineHandle) is
+$Engine::Return((Standard_Integer) %TextEngineHandle);
+@end;
+
+-- =========================
+-- Interface Multi-Case Call
+-- =========================
+
+
+@template InterfMultiFuncCall(%IntName, %NumCaseFunc) is
+$
+$static void %IntName_Execute_%NumCaseFunc(const Standard_Integer theCase,
+$ Engine_PArrayOfArguments& Args,
+$ const Standard_Address theObject)
+${
+$ Engine_Handle *theHandle;
+$
+$ switch(theCase) {
+$
+@end;
+
+@template InterfMultiFuncEndCall() is
+$ }
+$}
+$
+@end;
+
+@template InterfMultiCaseCall(%IntName, %NumCaseFunc, %NumCaseFirst, %NumCaseLast) is
+$
+$ if ((theCase >= %NumCaseFirst) && (theCase < %NumCaseLast)) {
+$ %IntName_Execute_%NumCaseFunc(theCase,Args,theObject);
+$ }
+$
+@end;
+
+-- ================
+-- Interface Bottom
+-- ================
+
+
+@template InterfBottom() is
+$
+$ default:
+$ Err << ErrMsg; aSignature->Display(Err); Err << (char) 0;
+$ Engine::Return(Err.rdbuf()->str(),-1);
+$ Eng_Status = Engine_Error;
+$ break;
+$ }
+$
+$ }
+$ catch(Standard_Failure) {
+$#ifdef OBJS
+$ os_transaction* curTrans = os_transaction::get_current();
+$ if (curTrans) os_transaction::abort_top_level ();
+$#endif
+$ Err << "Exception: ";
+$ aSignature->Display(Err);
+$ Err << ": raises the exception: "
+$ <<Standard_Failure::Caught();
+$ Err << (char) 0;
+$ Engine::Return(Err.rdbuf()->str(),-1);
+$ Eng_Status = Engine_Exception;
+$ }
+$ }
+$
+$ switch(Eng_Status) {
+$ case Engine_Exception:Engine_MethodException::Raise(Err.rdbuf()->str());
+$ case Engine_Error :Engine_ExecutionError::Raise(Err.rdbuf()->str());
+$ }
+$}
+@end;
+
+@template InterfMultiBottom(%IntMaxCase) is
+$
+$ if ((theCase <= 0) || (theCase >= %IntMaxCase)) {
+$ Err << ErrMsg; aSignature->Display(Err); Err << (char) 0;
+$ Engine::Return(Err.rdbuf()->str(),-1);
+$ Eng_Status = Engine_Error;
+$ }
+$
+$ }
+$ catch(Standard_Failure) {
+$#ifdef OBJS
+$ os_transaction* curTrans = os_transaction::get_current();
+$ if (curTrans) os_transaction::abort_top_level ();
+$#endif
+$ Err << "Exception: ";
+$ aSignature->Display(Err);
+$ Err << ": raises the exception: "
+$ <<Standard_Failure::Caught();
+$ Err << (char) 0;
+$ Engine::Return(Err.rdbuf()->str(),-1);
+$ Eng_Status = Engine_Exception;
+$ }
+$ }
+$
+$ switch(Eng_Status) {
+$ case Engine_Exception:Engine_MethodException::Raise(Err.rdbuf()->str());
+$ case Engine_Error :Engine_ExecutionError::Raise(Err.rdbuf()->str());
+$ }
+$}
+@end;
+
+@template InterfInitDefType(%CLName,%InhDeclar,%InhList,%NbInh) is
+$
+$Handle_Standard_Type& %CLName_Type_(){
+$
+$static Handle_Standard_Type _aType;
+$if (_aType.IsNull()) {
+$ _aType = Standard_Type::Find("%CLName");
+$ if (_aType.IsNull()) {
+$%InhDeclar
+$static Handle_Standard_Transient _Ancestors[]= {
+$%InhList
+$NULL};
+$
+$_aType =
+$ new Standard_Type("%CLName",
+$ 0, // size is useless
+$ %NbInh,
+$ (Standard_Address)_Ancestors,
+$ (Standard_Address)NULL);
+$ }
+$ }
+$return _aType;
+$}
+$
+@end;
+
+@template InterfInitDeclInhType(%InhName,%NumInh) is
+$Handle_Standard_Type& %InhName_Type_();
+$static Handle_Standard_Type aType%NumInh = STANDARD_TYPE(%InhName);
+@end;
+
+@template InterfInitEnumType(%CLName) is
+$
+$Handle_Standard_Type& %CLName_Type_(){
+$
+$static Handle_Standard_Transient _Ancestors[]= {
+$NULL};
+$
+$static Handle_Standard_Type _aType =
+$ new Standard_Type("%CLName",
+$ 0, // size is useless
+$ 0,
+$ 0,
+$ (Standard_Address)_Ancestors,
+$ (Standard_Address)NULL);
+$return _aType;
+$}
+$
+@end;
+
+@template InterfInitGlobType(%CLName) is
+$Handle_Standard_Type& %CLName_Type_();
+@end;
+
+@template InterfInitTypeCall(%CLName) is
+$ %CLName_Type_();
+@end;
+
+