--- /dev/null
+WOKBuilder_MSExtractorExtractPtr.hxx
+WOKBuilder_MSExtractorTemplatesPtr.hxx
+WOKBuilder_MSTranslatorPtr.hxx
--- /dev/null
+-- File: WOKBuilder.cdl
+-- Created: Thu Aug 10 20:38:11 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+package WOKBuilder
+
+ ---Purpose:
+
+uses
+ MS,
+ WOKUtils,
+ WOKTools,
+ OSD,
+ TColStd,
+ TCollection,
+ MMgt,
+ OSD
+
+is
+
+ imported MSTranslatorPtr;
+ imported MSExtractorTemplatesPtr;
+ imported MSExtractorExtractPtr;
+
+ enumeration BuildStatus is Unbuilt, Success, Failed
+ ---Purpose: Status of a construction process
+ end BuildStatus;
+
+ enumeration MSActionType is
+ -- Type modification Type Flag
+ TypeModified,
+ -- Detailled translate actions type
+ Package, Interface, Client, Engine, Schema, Executable, Component,
+ SchUses, DirectUses, Uses, GlobEnt,
+ Instantiate, InstToStd,
+ InterfaceTypes, SchemaTypes, PackageMethods,
+ GenType, CompleteType, SchemaType, Inherits, TypeUses,
+ -- Type extraction Type flag
+ TypeExtracted,
+ -- Detailled extraction type
+ HeaderExtract, SchemaExtract, ServerExtract, ClientExtract, EngineExtract, TemplateExtract
+ end MSActionType;
+
+ enumeration MSActionStatus is NotDefined, OutOfDate, UpToDate, HasFailed
+ end MSActionStatus;
+
+ enumeration LibReferenceType is ShortRef, LongRef, FullPath
+ end LibReferenceType;
+
+ deferred class Entity;
+ class EntityHasher from WOKBuilder;
+
+ deferred class Specification;
+
+ class CDLFile;
+ --class ODLFile;
+
+ class MSEntity;
+ class MSEntityHasher;
+ ---Purpose: Entite dans le MS (fichier cdl traduit).
+ -- dans le MS en cours
+
+ class Include;
+
+ class CodeGenFile;
+
+ class Compilable;
+
+ class ObjectFile;
+ class MFile;
+
+ class DEFile;
+ class DLLFile;
+ class EXEFile;
+ class PDBFile;
+
+ deferred class Library;
+
+ class SharedLibrary;
+ class ArchiveLibrary;
+
+ -- Windows NT --------
+ --
+ class ImportLibrary; --
+ class StaticLibrary; --
+ class ExportLibrary; --
+ --
+ ----------------------
+
+ class Executable;
+
+ class Miscellaneous;
+
+ class CompressedFile;
+ class TarFile;
+
+ class MSchema;
+
+ deferred class Tool;
+
+ deferred class ToolInProcess;
+
+ deferred class MSTool;
+
+ class MSTranslator;
+
+ class MSAction;
+ class MSActionID;
+ class MSTranslatorIterator;
+
+ deferred class MSExtractor;
+ class MSTemplateExtractor;
+ class MSHeaderExtractor;
+ class MSServerExtractor;
+ class MSClientExtractor;
+ class MSEngineExtractor;
+
+ class MSExtractorIterator;
+
+ deferred class ToolInShell;
+
+ class CodeGenerator;
+ class Compiler;
+
+ class Archiver;
+ class ArchiveExtract;
+
+ deferred class Linker;
+ class SharedLinker;
+ class ExecutableLinker;
+
+ ------------------------------------------
+ ------- Windows NT ----------------------
+ ------------------------------------------
+ --------
+ deferred class WNTCollector; --------
+ --------
+ deferred class WNTLinker; --------
+ class DLLinker; --------
+ class EXELinker; --------
+ --------
+ deferred class WNTLibrarian; --------
+ class StaticLibrarian; --------
+ class ImportLibrarian; --------
+ --------
+ ------------------------------------------
+ ------------------------------------------
+ ------------------------------------------
+
+
+ class Command;
+
+ class ToolInShellIterator;
+ class CompilerIterator;
+ class CodeGeneratorIterator;
+
+ --- INSTATIATIONS
+
+ class SequenceOfEntity
+ instantiates Sequence from TCollection ( Entity from WOKBuilder );
+ class HSequenceOfEntity
+ instantiates HSequence from TCollection ( Entity from WOKBuilder,
+ SequenceOfEntity from WOKBuilder );
+
+ class SequenceOfExtension
+ instantiates Sequence from TCollection ( Extension from WOKUtils );
+ class HSequenceOfExtension
+ instantiates HSequence from TCollection ( Extension from WOKUtils,
+ SequenceOfExtension from WOKBuilder );
+
+ class SequenceOfToolInShell
+ instantiates Sequence from TCollection ( ToolInShell from WOKBuilder );
+ class HSequenceOfToolInShell
+ instantiates HSequence from TCollection ( ToolInShell from WOKBuilder,
+ SequenceOfToolInShell from WOKBuilder );
+
+ class SequenceOfObjectFile
+ instantiates Sequence from TCollection ( ObjectFile from WOKBuilder );
+ class HSequenceOfObjectFile
+ instantiates HSequence from TCollection ( ObjectFile from WOKBuilder,
+ SequenceOfObjectFile from WOKBuilder );
+
+ class SequenceOfLibrary
+ instantiates Sequence from TCollection ( Library from WOKBuilder );
+ class HSequenceOfLibrary
+ instantiates HSequence from TCollection ( Library from WOKBuilder,
+ SequenceOfLibrary from WOKBuilder );
+
+ private class QueueOfMSAction
+ instantiates Queue from TCollection ( MSAction from WOKBuilder );
+
+ private class MapOfMSAction
+ instantiates Map from WOKTools ( MSAction from WOKBuilder,
+ MSActionID from WOKBuilder );
+
+ private class DataMapOfMSActionIDOfMSAction
+ instantiates DataMap from WOKTools ( MSActionID from WOKBuilder,
+ MSAction from WOKBuilder,
+ MSActionID from WOKBuilder );
+
+ private class DataMapOfHAsciiStringOfMSEntity
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ MSEntity from WOKBuilder,
+ HAsciiStringHasher from WOKTools);
+
+ private class DataMapOfHAsciiStringOfToolInShell
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ ToolInShell from WOKBuilder,
+ HAsciiStringHasher from WOKTools);
+
+end WOKBuilder;
--- /dev/null
+-- File: WOKBuilder_ArchiveExtract.cdl
+-- Created: Tue Aug 6 11:06:37 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class ArchiveExtract from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Param from WOKUtils,
+ ArchiveLibrary from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+is
+ Create(params : Param from WOKUtils)
+ returns mutable ArchiveExtract from WOKBuilder;
+
+ Load(me:mutable)
+ is redefined;
+
+ SetArchive(me:mutable; anarchive : ArchiveLibrary from WOKBuilder);
+
+ Archive(me)
+ returns ArchiveLibrary from WOKBuilder;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+fields
+
+ mylib : ArchiveLibrary from WOKBuilder;
+
+end ArchiveExtract;
--- /dev/null
+// File: WOKBuilder_ArchiveExtract.cxx
+// Created: Tue Aug 6 11:09:31 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
+#include <EDL_API.hxx>
+
+#include <WOKBuilder_ArchiveLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_HSequenceOfObjectFile.hxx>
+
+#include <WOKBuilder_ArchiveExtract.ixx>
+
+#include <stdio.h>
+
+//=======================================================================
+//function : WOKBuilder_ArchiveExtract
+//purpose :
+//=======================================================================
+WOKBuilder_ArchiveExtract::WOKBuilder_ArchiveExtract(const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShell(new TCollection_HAsciiString("ARX"), params)
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_ArchiveExtract::Load()
+{
+}
+
+//=======================================================================
+//function : SetTargetName
+//purpose :
+//=======================================================================
+void WOKBuilder_ArchiveExtract::SetArchive(const Handle(WOKBuilder_ArchiveLibrary)& anarchive)
+{
+ mylib = anarchive;
+}
+
+//=======================================================================
+//function : Archive
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_ArchiveLibrary) WOKBuilder_ArchiveExtract::Archive() const
+{
+ return mylib;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_ArchiveExtract::Execute()
+{
+ Handle(TCollection_HAsciiString) objlist = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) objtempl, astr, templ;
+ Handle(WOKBuilder_HSequenceOfEntity) result = new WOKBuilder_HSequenceOfEntity;
+ Handle(WOKBuilder_ArchiveLibrary) anent;
+ Handle(WOKUtils_Path) tmppath;
+ Standard_Integer i;
+
+ if(Shell()->IsLaunched() == Standard_False) Shell()->Launch();
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter("Template");
+
+ if(templ.IsNull()) return WOKBuilder_Failed;
+
+ SetTemplate(templ);
+
+ tmppath = new WOKUtils_Path(new TCollection_HAsciiString (tmpnam(NULL)) );
+
+ Params().Set("%Archive", Archive()->Path()->Name()->ToCString());
+ Params().Set("%TmpFile", tmppath->Name()->ToCString());
+ Params().Set("%OutputDir", OutputDir()->Name()->ToCString());
+
+ astr = Params().Eval(Template()->ToCString());
+
+ WOK_TRACE {
+ VerboseMsg("WOK_ARX") << "WOKBuilder_ArchiveExtract::Execute"
+ << "Archive line : " << astr << endm;
+ }
+
+ Shell()->Execute(astr);
+
+ if(Shell()->Status())
+ {
+ ErrorMsg << "WOKBuilder_ArchiveExtract::Execute" << "Errors occured in Shell" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_ArchiveExtract::Execute" << aseq->Value(i) << endm;
+ }
+
+ return WOKBuilder_Failed;
+ }
+
+ WOKUtils_AdmFile afile( new WOKUtils_Path ( Params().Eval("%TmpFile") ) );
+ Handle(TColStd_HSequenceOfHAsciiString) aseq;
+ Standard_Boolean failed = Standard_False;
+
+ aseq = afile.Read();
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+
+ Handle(WOKUtils_Path) apath = new WOKUtils_Path(OutputDir()->Name(), aseq->Value(i));
+
+ if(apath->Exists())
+ {
+ Handle(WOKBuilder_ObjectFile) object = new WOKBuilder_ObjectFile(apath);
+ result->Append(object);
+ }
+ else
+ {
+ ErrorMsg << "WOKBuilder_ArchiveExtract::Execute"
+ << "Object " << aseq->Value(i) << " listed in archive was not extracted" << endm;
+ failed = Standard_True;
+ }
+
+ }
+
+ tmppath->RemoveFile();
+
+ if(failed)
+ {
+ ErrorMsg << "WOKBuilder_ArchiveExtract::Execute"
+ << "Object(s) not found" << endm;
+ return WOKBuilder_Failed;
+ }
+
+
+ Shell()->ClearOutput();
+
+ SetProduction(result);
+
+ return WOKBuilder_Success;
+}
+
--- /dev/null
+-- File: WOKBuilder_ArchiveLibrary.cdl
+-- Created: Mon Oct 16 16:27:11 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class ArchiveLibrary from WOKBuilder
+inherits Library from WOKBuilder
+ ---Purpose:
+
+uses
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+is
+
+ Create(apath : Path from WOKUtils) returns mutable ArchiveLibrary from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder)
+ returns mutable ArchiveLibrary from WOKBuilder;
+
+
+ GetLibFileName(me:mutable; params : Param from WOKUtils)
+ returns HAsciiString from TCollection
+ is redefined;
+
+ GetLibFileName(myclass; params : Param from WOKUtils; aname : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+end ArchiveLibrary;
--- /dev/null
+// File: WOKBuilder_ArchiveLibrary.cxx
+// Created: Mon Oct 16 17:15:03 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_ArchiveLibrary.ixx>
+
+//=======================================================================
+//function : WOKBuilder_ArchiveLibrary
+//purpose :
+//=======================================================================
+WOKBuilder_ArchiveLibrary::WOKBuilder_ArchiveLibrary(const Handle(WOKUtils_Path)& apath)
+: WOKBuilder_Library(apath)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_ArchiveLibrary
+//purpose :
+//=======================================================================
+ WOKBuilder_ArchiveLibrary::WOKBuilder_ArchiveLibrary(const Handle(TCollection_HAsciiString)& aname,
+ const Handle(WOKUtils_Path)& adir,
+ const WOKBuilder_LibReferenceType areftype)
+: WOKBuilder_Library(aname,adir,areftype)
+{
+}
+
+
+//=======================================================================
+//function : GetLibFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ArchiveLibrary::GetLibFileName(const WOKUtils_Param& params)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ params.Set("%LDAR_LibName", Name()->ToCString());
+
+ astr = params.Eval("LDAR_FileName");
+
+ return astr;
+}
+
+//=======================================================================
+//function : GetLibFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ArchiveLibrary::GetLibFileName(const WOKUtils_Param& params,
+ const Handle(TCollection_HAsciiString)& aname)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ params.Set("%LDAR_LibName", aname->ToCString());
+
+ astr = params.Eval("LDAR_FileName");
+
+ return astr;
+}
--- /dev/null
+-- File: WOKBuilder_Archiver.cdl
+-- Created: Tue Oct 24 11:35:07 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Archiver from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Param from WOKUtils,
+ ArchiveLibrary from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ HSequenceOfObjectFile from WOKBuilder,
+ HAsciiString from TCollection
+raises
+ ProgramError from Standard
+is
+
+ Create(params : Param from WOKUtils)
+ returns mutable Archiver from WOKBuilder;
+
+ Load(me:mutable)
+ is redefined;
+
+ SetObjectList(me:mutable; objects : HSequenceOfObjectFile from WOKBuilder);
+ ObjectList(me) returns HSequenceOfObjectFile from WOKBuilder;
+
+ TargetName(me) returns HAsciiString from TCollection;
+ SetTargetName(me:mutable; aname : HAsciiString from TCollection);
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+fields
+ myobjects : HSequenceOfObjectFile from WOKBuilder;
+ mytarget : HAsciiString from TCollection;
+end Archiver;
--- /dev/null
+// File: WOKBuilder_Archiver.cxx
+// Created: Tue Oct 24 13:31:42 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <fstream.h>
+
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_Path.hxx>
+
+#include <EDL_API.hxx>
+
+
+#include <WOKBuilder_ArchiveLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+#include <WOKBuilder_HSequenceOfObjectFile.hxx>
+
+#include <WOKBuilder_Archiver.ixx>
+
+//=======================================================================
+//function : WOKBuilder_Archiver
+//purpose :
+//=======================================================================
+WOKBuilder_Archiver::WOKBuilder_Archiver(const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShell(new TCollection_HAsciiString("LDAR"), params)
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_Archiver::Load()
+{
+}
+
+//=======================================================================
+//function : SetObjectList
+//purpose :
+//=======================================================================
+void WOKBuilder_Archiver::SetObjectList(const Handle(WOKBuilder_HSequenceOfObjectFile)& objects)
+{
+ myobjects = objects;
+}
+
+//=======================================================================
+//function : ObjectList
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfObjectFile) WOKBuilder_Archiver::ObjectList() const
+{
+ return myobjects;
+}
+
+//=======================================================================
+//function : SetTargetName
+//purpose :
+//=======================================================================
+void WOKBuilder_Archiver::SetTargetName(const Handle(TCollection_HAsciiString)& atarget)
+{
+ mytarget = atarget;
+}
+
+//=======================================================================
+//function : TargetName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Archiver::TargetName() const
+{
+ return mytarget;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Archiver::Execute()
+{
+ Handle(TCollection_HAsciiString) objlist = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) objtempl, astr, templ;
+ Handle(WOKBuilder_HSequenceOfObjectFile) aseq = new WOKBuilder_HSequenceOfObjectFile;
+ Handle(WOKBuilder_HSequenceOfEntity) result = new WOKBuilder_HSequenceOfEntity;
+ Handle(WOKBuilder_ArchiveLibrary) anent;
+ Standard_Integer i=0;
+
+ if(Shell()->IsLaunched() == Standard_False) Shell()->Launch();
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter("Template");
+
+ if(templ.IsNull()) return WOKBuilder_Failed;
+
+ SetTemplate(templ);
+
+ objtempl = EvalToolParameter("ObjectRef");
+
+ if(objtempl.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute"
+ << "Could not eval Tool Parameter " << Name() << "_ObjectRef" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ Handle(TCollection_HAsciiString) strlimit = EvalToolParameter("LibLimit");
+ Standard_Integer limit = 0;
+
+ if(!strlimit.IsNull())
+ {
+ if(strlimit->IsIntegerValue())
+ {
+ limit = strlimit->IntegerValue();
+ }
+ }
+
+ if(!limit)
+ {
+ limit = myobjects->Length()+1;
+ }
+
+
+ //
+ //// Calcul de la liste des objets
+ //
+ Handle(TCollection_HAsciiString) filename = new TCollection_HAsciiString(TargetName());
+ filename->AssignCat(".ObjList");
+
+ Handle(WOKUtils_Path) objlistpath = new WOKUtils_Path(OutputDir()->Name(), filename);
+
+ ofstream objstream(objlistpath->Name()->ToCString());
+
+ if(!objstream.good())
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute"
+ << "Could not open " << objlistpath->Name() << " for writing" << endm;
+ return WOKBuilder_Failed;
+ }
+
+
+ for( i=1; i<=myobjects->Length(); i++)
+ {
+ objstream << myobjects->Value(i)->Path()->Name()->ToCString() << endl;
+ }
+
+ objstream.close();
+
+ Params().Set("%LD_ObjList", objlistpath->Name()->ToCString());
+
+
+ // calcul du path de la librairie
+ anent = new WOKBuilder_ArchiveLibrary(TargetName(), OutputDir(), WOKBuilder_FullPath);
+ anent->GetPath(Params());
+
+ Params().Set("%LibName", anent->Path()->Name()->ToCString());
+
+ Handle(TCollection_HAsciiString) begcmd = EvalToolTemplate("Begin");
+
+
+ Shell()->Execute(begcmd);
+
+ if(Shell()->Status())
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << "Errors occured in Shell during begin" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << aseq->Value(i) << endm;
+ }
+
+ return WOKBuilder_Failed;
+ }
+
+ Shell()->ClearOutput();
+
+ i=1;
+ while ( i <= myobjects->Length() )
+ {
+ Standard_Integer nbiniter = 1;
+ objlist = new TCollection_HAsciiString;
+
+ while ( (nbiniter <= limit) && (i<=myobjects->Length()) )
+ {
+ Params().Set("%ObjectPath", myobjects->Value(i)->Path()->Name()->ToCString());
+ astr = Params().Eval(objtempl->ToCString());
+ objlist->AssignCat(astr);
+ nbiniter++;
+ i++;
+ }
+ Params().Set("%ObjectList", objlist->ToCString());
+
+ astr = Params().Eval("LDAR_Iter");
+
+ WOK_TRACE {
+ VerboseMsg("WOK_LDAR") << "WOKBuilder_Archiver::Execute"
+ << "Archive line : " << astr << endm;
+ }
+
+ Shell()->Execute(astr);
+
+ if(Shell()->Status())
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << "Errors occured in Shell during iteration" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << aseq->Value(i) << endm;
+ }
+
+ return WOKBuilder_Failed;
+ }
+ Shell()->ClearOutput();
+ }
+
+ astr = Params().Eval("LDAR_End");
+
+ WOK_TRACE {
+ VerboseMsg("WOK_LDAR") << "WOKBuilder_Archiver::Execute"
+ << "Archive line : " << astr << endm;
+ }
+
+ Shell()->Execute(astr);
+
+ if(Shell()->Status())
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << "Errors occured in Shell during end" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Archiver::Execute" << aseq->Value(i) << endm;
+ }
+
+ return WOKBuilder_Failed;
+ }
+ Shell()->ClearOutput();
+ result->Append(anent);
+ result->Append(new WOKBuilder_Miscellaneous(objlistpath));
+ SetProduction(result);
+
+ return WOKBuilder_Success;
+}
+
--- /dev/null
+-- File: WOKBuilder_CDLFile.cdl
+-- Created: Thu Aug 10 20:49:17 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class CDLFile from WOKBuilder
+inherits Specification from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+
+is
+
+ Create(apath : Path from WOKUtils) returns mutable CDLFile from WOKBuilder;
+
+end CDLFile;
--- /dev/null
+// File: WOKBuilder_CDLFile.cxx
+// Created: Wed Aug 23 20:08:41 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_CDLFile.ixx>
+
+
+WOKBuilder_CDLFile::WOKBuilder_CDLFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Specification(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_CodeGenFile.cdl
+-- Created: Mon Oct 16 16:29:11 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class CodeGenFile from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils);
+
+end CodeGenFile;
--- /dev/null
+// File: WOKBuilder_CodeGenFile.cxx
+// Created: Mon Oct 16 17:15:44 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_CodeGenFile.ixx>
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_CodeGenFile
+//purpose :
+//=======================================================================
+WOKBuilder_CodeGenFile::WOKBuilder_CodeGenFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_CodeGenerator.cdl
+-- Created: Thu Jul 11 15:12:41 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class CodeGenerator from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose:
+
+uses
+ HSequenceOfExtension from WOKBuilder,
+ CodeGenFile from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ Param from WOKUtils,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+is
+
+ Create(aname: HAsciiString from TCollection; params : Param from WOKUtils);
+
+ SetCodeGenFile(me:mutable; afile : CodeGenFile from WOKBuilder);
+ CodeGenFile(me) returns CodeGenFile from WOKBuilder;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+
+fields
+
+ myfile : CodeGenFile from WOKBuilder;
+
+end CodeGenerator;
+
--- /dev/null
+// File: WOKBuilder_CodeGenerator.cxx
+// Created: Wed Aug 23 20:08:57 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Shell.hxx>
+
+#include <WOKBuilder_HSequenceOfExtension.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKBuilder_CodeGenerator.ixx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_CodeGenerator
+//purpose :
+//=======================================================================
+WOKBuilder_CodeGenerator::WOKBuilder_CodeGenerator(const Handle(TCollection_HAsciiString)& aname, const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShell(aname, params)
+{
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetCodeGenFile
+//purpose :
+//=======================================================================
+void WOKBuilder_CodeGenerator::SetCodeGenFile(const Handle(WOKBuilder_CodeGenFile)& afile)
+{
+ myfile = afile;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CodeGenFile
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_CodeGenFile) WOKBuilder_CodeGenerator::CodeGenFile() const
+{
+ return myfile;
+}
+
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_CodeGenerator::Execute()
+{
+ Handle(TCollection_HAsciiString) astr;
+ Handle(WOKBuilder_HSequenceOfEntity) aseq = new WOKBuilder_HSequenceOfEntity;
+
+ if(Shell()->IsLaunched() == Standard_False) Shell()->Launch();
+
+ Load();
+
+ Params().Set("%Source", CodeGenFile()->Path()->Name()->ToCString());
+ Params().Set("%BaseName", CodeGenFile()->Path()->BaseName()->ToCString());
+ Params().Set("%OutputDir", OutputDir()->Name()->ToCString());
+
+ astr = Params().Eval(Template()->ToCString(), Standard_True);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_CODEGEN") << "WOKBuilder_Compiler::Execute" << "Compilation line : " << endm;
+ VerboseMsg("WOK_CODEGEN") << "WOKBuilder_Compiler::Execute" << astr << endm;
+ }
+
+ Shell()->Execute(astr);
+
+
+ Handle(TColStd_HSequenceOfHAsciiString) resseq = Shell()->Errors();
+
+ if(Shell()->Status())
+ {
+ Standard_Boolean ph = ErrorMsg.PrintHeader();
+
+ ErrorMsg << "WOKBuilder_Compiler::Execute" << "Errors occured in Shell" << endm;
+ ErrorMsg.DontPrintHeader();
+ for(Standard_Integer i=1; i<= resseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Compiler::Execute" << resseq->Value(i) << endm;
+ }
+ if(ph) ErrorMsg.DoPrintHeader();
+ return WOKBuilder_Failed;
+ }
+ else
+ {
+ Standard_Boolean ph = InfoMsg.PrintHeader();
+ InfoMsg.DontPrintHeader();
+ for(Standard_Integer i=1; i<= resseq->Length(); i++)
+ {
+ InfoMsg << "WOKBuilder_Compiler::Execute" << resseq->Value(i) << endm;
+ }
+ if(ph) InfoMsg.DoPrintHeader();
+ }
+ Shell()->ClearOutput();
+
+ SetProduction(EvalProduction());
+
+ return WOKBuilder_Success;
+}
+
--- /dev/null
+-- File: WOKBuilder_CodeGeneratorIterator.cdl
+-- Created: Thu Jul 11 19:02:20 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class CodeGeneratorIterator from WOKBuilder
+inherits ToolInShellIterator from WOKBuilder
+
+ ---Purpose:
+
+uses
+
+ HSequenceOfEntity from WOKBuilder,
+ CodeGenFile from WOKBuilder,
+ CodeGenerator from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ ToolInShell from WOKBuilder,
+ HSequenceOfToolInShell from WOKBuilder,
+ Param from WOKUtils,
+ Path from WOKUtils,
+ Shell from WOKUtils,
+ HAsciiString from TCollection
+
+is
+
+ Create(toolgroup : HAsciiString from TCollection;
+ params : Param from WOKUtils)
+ returns CodeGeneratorIterator from WOKBuilder;
+
+ Create(codegens : HSequenceOfToolInShell from WOKBuilder)
+ returns CodeGeneratorIterator from WOKBuilder;
+
+ Create(toolgroup : HAsciiString from TCollection;
+ ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils;
+ params : Param from WOKUtils)
+ returns CodeGeneratorIterator from WOKBuilder;
+
+ Init(me:out; ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils)
+ is redefined;
+
+ GetTool(me;aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns ToolInShell from WOKBuilder
+ is redefined;
+
+ Execute(me:out; acodegenfile : CodeGenFile from WOKBuilder)
+ returns BuildStatus from WOKBuilder;
+
+end CodeGeneratorIterator;
--- /dev/null
+// File: WOKBuilder_CodeGeneratorIterator.cxx
+// Created: Thu Jul 11 19:09:38 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Path.hxx>
+
+#include <WOKBuilder_CodeGenFile.hxx>
+#include <WOKBuilder_CodeGenerator.hxx>
+
+#include <WOKBuilder_CodeGeneratorIterator.ixx>
+//=======================================================================
+//function : WOKBuilder_CodeGeneratorIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CodeGeneratorIterator::WOKBuilder_CodeGeneratorIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShellIterator(agroup,params)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_CodeGeneratorIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CodeGeneratorIterator::WOKBuilder_CodeGeneratorIterator(const Handle(WOKBuilder_HSequenceOfToolInShell)& CodeGenerators)
+ : WOKBuilder_ToolInShellIterator(CodeGenerators)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_CodeGeneratorIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CodeGeneratorIterator::WOKBuilder_CodeGeneratorIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& outdir,
+ const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShellIterator(agroup,ashell,outdir,params)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKBuilder_CodeGeneratorIterator::Init(const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& apath)
+
+{
+ WOKBuilder_ToolInShellIterator::Init(ashell, apath);
+
+ Handle(WOKBuilder_HSequenceOfToolInShell) tools = Tools();
+ Handle(TCollection_HAsciiString) optline;
+
+ if(!tools.IsNull())
+ {
+ for(Standard_Integer i=1; i<=tools->Length(); i++)
+ {
+ Handle(WOKBuilder_CodeGenerator) acodegen = Handle(WOKBuilder_CodeGenerator)::DownCast(tools->Value(i));
+
+ if(!acodegen.IsNull())
+ {
+ optline = acodegen->OptionLine();
+
+ if(optline.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_CodeGeneratorIterator::Init"
+ << "Could not eval code generator " << acodegen->Name() << " options" << endm;
+ return;
+ }
+
+ InfoMsg << "WOKBuilder_CodeGeneratorIterator::Init" << optline << endm;
+ }
+ }
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetTool
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_ToolInShell) WOKBuilder_CodeGeneratorIterator::GetTool(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params) const
+{
+ return new WOKBuilder_CodeGenerator(aname,params);
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_CodeGeneratorIterator::Execute(const Handle(WOKBuilder_CodeGenFile)& aCodeGenFile)
+{
+ Handle(WOKBuilder_CodeGenerator) aCodeGenerator;
+ WOKBuilder_BuildStatus status;
+
+ myproduction.Nullify();
+
+ aCodeGenerator = Handle(WOKBuilder_CodeGenerator)::DownCast(AppropriateTool(aCodeGenFile));
+
+ if(aCodeGenerator.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_CodeGeneratorIterator::Execute"
+ << "Could not find appropriate CodeGenerator for " << aCodeGenFile->Path()->Name() << endm;
+ return WOKBuilder_Failed;
+ }
+
+ // setter le .CodeGenFile
+ aCodeGenerator->SetCodeGenFile(aCodeGenFile);
+
+ status = aCodeGenerator->Execute();
+
+ if(status == WOKBuilder_Success)
+ {
+ myproduction = aCodeGenerator->Produces();
+ }
+ return status;
+}
--- /dev/null
+-- File: WOKBuilder_Command.cdl
+-- Created: Wed Nov 15 10:26:00 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Command from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Param from WOKUtils,
+ Path from WOKUtils,
+ BuildStatus from WOKBuilder,
+ HSequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection,
+ Boolean from Standard
+
+raises
+ ProgramError from Standard
+
+is
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable Command from WOKBuilder;
+
+ Load(me:mutable)
+ is redefined;
+
+ Copy(me:mutable; afrom, ato : Path from WOKUtils)
+ ---Purpose: copies afrom in ato
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ PreserveCopy(me:mutable; afrom, ato : Path from WOKUtils)
+ ---Purpose: copies afrom in ato
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ CopyAndChmod(me:mutable; afrom, ato : Path from WOKUtils)
+ ---Purpose: copies afrom in ato and chmod
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ Move(me:mutable; afrom, ato : Path from WOKUtils)
+ ---Purpose: Moves afrom in ato
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ ReplaceIfChanged(me:mutable; afrom, ato : Path from WOKUtils)
+ ---Purpose: Replaces <ato> with <afrom> if <afrom> differs from <ato>
+ -- NB : Destroys afrom in all cases
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ ReplaceIfChangedWith(me:mutable; afrom, abase, ato : Path from WOKUtils)
+ ---Purpose: Replaces <ato> with <afrom> if <afrom> differs from <abase>
+ -- NB : - Destroys afrom in all cases
+ -- - Status is Success if replacement was done
+ -- Unbuilt if replacement was not done
+ -- Failed if errors occured
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ Compress(me:mutable; afile : Path from WOKUtils)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ CompressTo(me:mutable; afile, adest : Path from WOKUtils)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ UnCompress(me:mutable; afile : Path from WOKUtils)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ UnCompressTo(me:mutable; afile, adest : Path from WOKUtils)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+end Command;
--- /dev/null
+// File: WOKBuilder_Command.cxx
+// Created: Wed Nov 15 11:38:46 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Shell.hxx>
+
+#include <EDL_API.hxx>
+
+#include <WOKBuilder_Command.ixx>
+
+//=======================================================================
+//function : WOKBuilder_Command
+//purpose :
+//=======================================================================
+ WOKBuilder_Command::WOKBuilder_Command(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+: WOKBuilder_ToolInShell(aname, params)
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_Command::Load()
+{
+
+}
+
+//=======================================================================
+//function : Copy
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::Copy(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr, afile;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_Copy"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : PreserveCopy
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::PreserveCopy(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr, afile;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_PreserveCopy"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : Move
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::Move(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_Move"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : ReplaceIfChanged
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::ReplaceIfChanged(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr, afile;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_ReplIfCh"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ astr = Params().Eval(Template()->ToCString());
+
+ Shell()->Execute(astr);
+
+ switch(Shell()->Status())
+ {
+ case 0:
+ Shell()->ClearOutput();
+ return WOKBuilder_Unbuilt;
+ case 1:
+ Shell()->ClearOutput();
+ return WOKBuilder_Success;
+ case 2:
+ ErrorMsg << "WOKBuilder_Command::Execute" << "Errors occured in Shell" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Command::Execute" << aseq->Value(i) << endm;
+ }
+ Shell()->ClearOutput();
+ return WOKBuilder_Failed;
+ }
+ return WOKBuilder_Failed;
+}
+
+//=======================================================================
+//function : ReplaceIfChangedWith
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::ReplaceIfChangedWith(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& abase,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr, afile;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_ReplIfChWith"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Base", abase->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ astr = Params().Eval(Template()->ToCString());
+
+ Shell()->Execute(astr);
+
+ switch(Shell()->Status())
+ {
+ case 0:
+ Shell()->ClearOutput();
+ return WOKBuilder_Unbuilt;
+ case 1:
+ Shell()->ClearOutput();
+ return WOKBuilder_Success;
+ case 2:
+ ErrorMsg << "WOKBuilder_Command::Execute" << "Errors occured in Shell" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Command::Execute" << aseq->Value(i) << endm;
+ }
+ Shell()->ClearOutput();
+ return WOKBuilder_Failed;
+ }
+ return WOKBuilder_Failed;
+}
+
+//=======================================================================
+//function : Compress
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::Compress(const Handle(WOKUtils_Path)& afile)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_Compress"));
+
+ Params().Set("%File", afile->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : CompressTo
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::CompressTo(const Handle(WOKUtils_Path)& afile, const Handle(WOKUtils_Path)& adest)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_CompressTo"));
+
+ Params().Set("%File", afile->Name()->ToCString());
+ Params().Set("%Dest", adest->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : UnCompress
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::UnCompress(const Handle(WOKUtils_Path)& afile)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_UnCompress"));
+
+ Params().Set("%File", afile->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : UnCompressTo
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::UnCompressTo(const Handle(WOKUtils_Path)& afile, const Handle(WOKUtils_Path)& adest)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_UnCompressTo"));
+
+ Params().Set("%File", afile->Name()->ToCString());
+ Params().Set("%Dest", adest->Name()->ToCString());
+
+ return Execute();
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::Execute()
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(Shell()->IsLaunched() == Standard_False) Shell()->Launch();
+
+ astr = Params().Eval(Template()->ToCString());
+
+ Shell()->Execute(astr);
+
+ if(Shell()->Status())
+ {
+ ErrorMsg << "WOKBuilder_Command::Execute" << "Errors occured in Shell" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = Shell()->Errors();
+
+ for(Standard_Integer i=1; i<= aseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Command::Execute" << aseq->Value(i) << endm;
+ }
+ Shell()->ClearOutput();
+ return WOKBuilder_Failed;
+ }
+
+ Shell()->ClearOutput();
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : CopyAndChmod
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Command::CopyAndChmod(const Handle(WOKUtils_Path)& afrom,
+ const Handle(WOKUtils_Path)& ato)
+{
+ Handle(TCollection_HAsciiString) astr, afile;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ Load();
+
+ SetTemplate(new TCollection_HAsciiString("COMMAND_CopyAndChmod"));
+
+ Params().Set("%Source", afrom->Name()->ToCString());
+ Params().Set("%Dest", ato->Name()->ToCString());
+
+ return Execute();
+}
--- /dev/null
+-- File: WOKBuilder_Compilable.cdl
+-- Created: Thu Aug 10 20:52:30 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Compilable from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+
+is
+ Create(apath : Path from WOKUtils);
+
+end Compilable;
--- /dev/null
+// File: WOKBuilder_Compilable.cxx
+// Created: Tue Aug 22 23:29:52 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Compilable.ixx>
+
+WOKBuilder_Compilable::WOKBuilder_Compilable(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_Compiler.cdl
+-- Created: Wed Aug 23 19:47:23 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Compiler from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose: Compilers Management
+uses
+ Entity from WOKBuilder,
+ Compilable from WOKBuilder,
+ ObjectFile from WOKBuilder,
+ MFile from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Param from WOKUtils,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+is
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable Compiler from WOKBuilder;
+
+ IncludeDirectories(me) returns HSequenceOfPath from WOKUtils;
+ SetIncludeDirectories(me:mutable; incdirs : HSequenceOfPath from WOKUtils);
+
+ DatabaseDirectories(me) returns HSequenceOfPath from WOKUtils;
+ SetDatabaseDirectories(me:mutable; incdirs : HSequenceOfPath from WOKUtils);
+
+ Compilable(me) returns mutable Compilable from WOKBuilder;
+ SetCompilable(me:mutable; afile : Compilable from WOKBuilder);
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+fields
+ myname : HAsciiString from TCollection;
+ mysource : Compilable from WOKBuilder;
+ myobject : ObjectFile from WOKBuilder;
+ mymfile : MFile from WOKBuilder;
+ myincdirs : HSequenceOfPath from WOKUtils;
+ mydbdirs : HSequenceOfPath from WOKUtils;
+ myoptions : HAsciiString from TCollection;
+end Compiler;
--- /dev/null
+// File: WOKBuilder_Compiler.cxx
+// Created: Wed Aug 23 20:09:00 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Compiler.ixx>
+
+
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <EDL_API.hxx>
+
+#include <stdio.h>
+
+//=======================================================================
+//function : WOKBuilder_Compiler
+//purpose :
+//=======================================================================
+WOKBuilder_Compiler::WOKBuilder_Compiler(const Handle(TCollection_HAsciiString)& aname, const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShell(aname, params)
+{
+}
+
+//=======================================================================
+//function : IncludeDirectories
+//purpose :
+//=======================================================================
+Handle(WOKUtils_HSequenceOfPath) WOKBuilder_Compiler::IncludeDirectories() const
+{
+ return myincdirs;
+}
+
+//=======================================================================
+//function : SetIncludeDirectories
+//purpose :
+//=======================================================================
+void WOKBuilder_Compiler::SetIncludeDirectories(const Handle(WOKUtils_HSequenceOfPath)& incdirs)
+{
+ Handle(TCollection_HAsciiString) afile;
+ Handle(TCollection_HAsciiString) atempl;
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString;
+
+ Load();
+
+ myincdirs = incdirs;
+
+ atempl = new TCollection_HAsciiString("CMPLRS_IncDirective");
+
+ for(Standard_Integer i=1; i<= IncludeDirectories()->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) directive;
+ Params().Set("%IncDirectory", myincdirs->Value(i)->Name()->ToCString());
+
+ directive = Params().Eval("CMPLRS_IncDirective");
+
+ if(!directive.IsNull())
+ {
+ astr->AssignCat(directive);
+ }
+ else
+ {
+ WarningMsg << "WOKBuilder_Compiler::SetIncludeDirectories"
+ << "Could not eval database directive: CMPLRS_IncDirective" << endm;
+ }
+ }
+ Params().Set("%IncDirectives", astr->ToCString());
+ return;
+}
+
+//=======================================================================
+//function : DatabaseDirectories
+//purpose :
+//=======================================================================
+Handle(WOKUtils_HSequenceOfPath) WOKBuilder_Compiler::DatabaseDirectories() const
+{
+ return mydbdirs;
+}
+
+//=======================================================================
+//function : SetDatabaseDirectories
+//purpose :
+//=======================================================================
+void WOKBuilder_Compiler::SetDatabaseDirectories(const Handle(WOKUtils_HSequenceOfPath)& dbdirs)
+{
+ Handle(TCollection_HAsciiString) afile;
+ Handle(TCollection_HAsciiString) atempl;
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString;
+
+ Load();
+
+ if(!dbdirs.IsNull())
+ {
+ mydbdirs = dbdirs;
+
+ atempl = new TCollection_HAsciiString("CMPLRS_DBDirective");
+
+ for(Standard_Integer i=1; i<= mydbdirs->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) directive;
+
+ Params().Set("%DBDirectory", mydbdirs->Value(i)->Name()->ToCString());
+
+ directive = Params().Eval("CMPLRS_DBDirective");
+
+ if(!directive.IsNull())
+ {
+ astr->AssignCat(directive);
+ }
+ else
+ {
+ WarningMsg << "WOKBuilder_Compiler::SetDatabaseDirectories"
+ << "Could not eval database directive: CMPLRS_DBDirective" << endm;
+ }
+ }
+ Params().Set("%DBDirectives", astr->ToCString());
+ }
+ else
+ {
+ Params().Set("%DBDirectives", " ");
+ }
+ return;
+}
+
+//=======================================================================
+//function : Compilable
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_Compilable) WOKBuilder_Compiler::Compilable() const
+{
+ return mysource;
+}
+
+//=======================================================================
+//function : SetCompilable
+//purpose :
+//=======================================================================
+void WOKBuilder_Compiler::SetCompilable(const Handle(WOKBuilder_Compilable)& afile)
+{
+ mysource = afile;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute()
+{
+ int start;
+
+#ifdef WNT
+ start = 2;
+#else
+ start = 1;
+#endif // WNT
+
+ Handle(TCollection_HAsciiString) astr;
+ Handle(WOKBuilder_HSequenceOfEntity) aseq = new WOKBuilder_HSequenceOfEntity;
+ Handle(WOKBuilder_ObjectFile) object;
+ Handle(WOKBuilder_MFile) mfile;
+
+
+ if(Shell()->IsLaunched() == Standard_False) Shell()->Launch();
+
+ Load();
+
+
+ Params().Set("%Source", Compilable()->Path()->Name()->ToCString());
+ Params().Set("%BaseName", Compilable()->Path()->BaseName()->ToCString());
+ Params().Set("%TmpFile", tmpnam(NULL));
+ Params().Set("%OutputDir", OutputDir()->Name()->ToCString());
+
+ astr = EvalToolTemplate(Template()->ToCString());
+
+ WOK_TRACE {
+ VerboseMsg("WOK_CMPLRS") << "WOKBuilder_Compiler::Execute"
+ << "Compilation line : " << endm;
+ VerboseMsg("WOK_CMPLRS") << "WOKBuilder_Compiler::Execute"
+ << astr << endm;
+ }
+
+ Shell()->ClearOutput();
+ Shell()->Execute(astr);
+
+ Handle(TColStd_HSequenceOfHAsciiString) resseq = Shell()->Errors();
+
+ if(Shell()->Status())
+ {
+ Standard_Boolean ph = ErrorMsg.PrintHeader();
+
+ ErrorMsg << "WOKBuilder_Compiler::Execute" << "Errors occured in Shell" << endm;
+ ErrorMsg.DontPrintHeader();
+ for(Standard_Integer i=start; i<= resseq->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Compiler::Execute" << resseq->Value(i) << endm;
+ }
+ if(ph) ErrorMsg.DoPrintHeader();
+ return WOKBuilder_Failed;
+ }
+ else
+ {
+ Standard_Boolean ph = InfoMsg.PrintHeader();
+ InfoMsg.DontPrintHeader();
+ for(Standard_Integer i=start; i<= resseq->Length(); i++)
+ {
+ InfoMsg << "WOKBuilder_Compiler::Execute" << resseq->Value(i) << endm;
+ }
+ if(ph) InfoMsg.DoPrintHeader();
+ }
+ Shell()->ClearOutput();
+
+ SetProduction(EvalProduction());
+ return WOKBuilder_Success;
+}
+
--- /dev/null
+-- File: WOKBuilder_CompilerIterator.cdl
+-- Created: Fri Oct 13 14:39:55 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class CompilerIterator from WOKBuilder
+inherits ToolInShellIterator from WOKBuilder
+ ---Purpose:
+
+uses
+ HSequenceOfEntity from WOKBuilder,
+ Compilable from WOKBuilder,
+ Compiler from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ ToolInShell from WOKBuilder,
+ HSequenceOfToolInShell from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Param from WOKUtils,
+ Path from WOKUtils,
+ Shell from WOKUtils,
+ HAsciiString from TCollection
+is
+
+ Create(toolgroup : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns CompilerIterator from WOKBuilder;
+
+
+ Create(tools : HSequenceOfToolInShell from WOKBuilder)
+ returns CompilerIterator from WOKBuilder;
+
+ Create(toolgroup : HAsciiString from TCollection;
+ ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils;
+ incdirs : HSequenceOfPath from WOKUtils;
+ dbdirs : HSequenceOfPath from WOKUtils;
+ params : Param from WOKUtils)
+ returns CompilerIterator from WOKBuilder;
+
+ Init(me:out; ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils;
+ incdirs : HSequenceOfPath from WOKUtils;
+ dbdirs : HSequenceOfPath from WOKUtils);
+
+ GetTool(me;aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns ToolInShell from WOKBuilder
+ is redefined;
+
+ Execute(me:out; acompilable : Compilable from WOKBuilder)
+ returns BuildStatus from WOKBuilder;
+
+fields
+
+ myincdirs : HSequenceOfPath from WOKUtils;
+ mydbdirs : HSequenceOfPath from WOKUtils;
+
+end CompilerIterator;
--- /dev/null
+// File: WOKBuilder_CompilerIterator.cxx
+// Created: Fri Oct 13 17:29:00 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_CompilerIterator.ixx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_HSequenceOfPath.hxx>
+
+#include <WOKBuilder_Compilable.hxx>
+#include <WOKBuilder_Compiler.hxx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_CompilerIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CompilerIterator::WOKBuilder_CompilerIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const WOKUtils_Param& params)
+: WOKBuilder_ToolInShellIterator(agroup, params)
+{
+}
+
+
+//=======================================================================
+//function : WOKBuilder_CompilerIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CompilerIterator::WOKBuilder_CompilerIterator(const Handle(WOKBuilder_HSequenceOfToolInShell)& compilers)
+ : WOKBuilder_ToolInShellIterator(compilers)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_CompilerIterator
+//purpose :
+//=======================================================================
+WOKBuilder_CompilerIterator::WOKBuilder_CompilerIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& outdir,
+ const Handle(WOKUtils_HSequenceOfPath)& incdirs,
+ const Handle(WOKUtils_HSequenceOfPath)& dbdirs,
+ const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShellIterator(agroup,ashell,outdir,params), myincdirs(incdirs), mydbdirs(dbdirs)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_CompilerIterator
+//purpose :
+//=======================================================================
+void WOKBuilder_CompilerIterator::Init(const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& outdir,
+ const Handle(WOKUtils_HSequenceOfPath)& incdirs,
+ const Handle(WOKUtils_HSequenceOfPath)& dbdirs)
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) optline;
+
+ WOKBuilder_ToolInShellIterator::Init(ashell,outdir);
+
+ myincdirs = incdirs;
+ mydbdirs = dbdirs;
+
+ Handle(WOKBuilder_HSequenceOfToolInShell) tools = Tools();
+
+ if(!tools.IsNull())
+ {
+ for(i=1; i<=tools->Length(); i++)
+ {
+ Handle(WOKBuilder_Compiler) acompiler = Handle(WOKBuilder_Compiler)::DownCast(tools->Value(i));
+
+ if(!acompiler.IsNull())
+ {
+ acompiler->SetIncludeDirectories(myincdirs);
+ acompiler->SetDatabaseDirectories(mydbdirs);
+ }
+
+ optline = acompiler->OptionLine();
+
+ if(optline.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_CompilerIterator::Init"
+ << "Could not eval compiler " << acompiler->Name() << " options" << endm;
+ return;
+ }
+
+ InfoMsg << "WOKBuilder_CompilerIterator::Init" << optline << endm;
+ }
+ }
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetTool
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_ToolInShell) WOKBuilder_CompilerIterator::GetTool(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params) const
+{
+ return new WOKBuilder_Compiler(aname,params);
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_CompilerIterator::Execute(const Handle(WOKBuilder_Compilable)& acompilable)
+{
+ Handle(WOKBuilder_Compiler) acompiler;
+ WOKBuilder_BuildStatus status;
+
+ myproduction.Nullify();
+
+ acompiler = Handle(WOKBuilder_Compiler)::DownCast(AppropriateTool(acompilable));
+
+ if(acompiler.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_CompilerIterator::Execute"
+ << "Could not find appropriate Compiler for " << acompilable->Path()->Name() << endm;
+ return WOKBuilder_Failed;
+ }
+
+ // setter le .compilable
+ acompiler->SetCompilable(acompilable);
+
+ status = acompiler->Execute();
+
+ if(status == WOKBuilder_Success)
+ {
+ myproduction = acompiler->Produces();
+ }
+ return status;
+}
+
--- /dev/null
+-- File: WOKBuilder_CompressedFile.cdl
+-- Created: Mon Oct 16 16:31:53 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class CompressedFile from WOKBuilder
+inherits Miscellaneous from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable CompressedFile from WOKBuilder;
+
+end CompressedFile;
--- /dev/null
+// File: WOKBuilder_CompressedFile.cxx
+// Created: Mon Oct 16 17:16:19 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_CompressedFile.ixx>
+
+WOKBuilder_CompressedFile::WOKBuilder_CompressedFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Miscellaneous(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_DEFile.cdl
+-- Created: Mon Oct 21 14:10:20 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class DEFile from WOKBuilder inherits Entity from WOKBuilder
+
+ uses
+
+ Path from WOKUtils
+
+ is
+
+ Create ( apath : Path from WOKUtils ) returns mutable DEFile from WOKBuilder;
+
+end DEFile;
--- /dev/null
+#include <WOKBuilder_DEFile.ixx>
+
+WOKBuilder_DEFile :: WOKBuilder_DEFile (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Entity ( apath ) {
+} // end constructor
--- /dev/null
+-- File: WOKBuilder_DLLFile.cdl
+-- Created: Mon Oct 21 14:10:20 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class DLLFile from WOKBuilder inherits Entity from WOKBuilder
+
+ uses
+
+ Path from WOKUtils
+
+ is
+
+ Create ( apath : Path from WOKUtils ) returns mutable DLLFile from WOKBuilder;
+
+end DLLFile;
--- /dev/null
+#include <WOKBuilder_DLLFile.ixx>
+
+WOKBuilder_DLLFile :: WOKBuilder_DLLFile (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Entity ( apath ) {
+} // end constructor
--- /dev/null
+-- File: WOKBuilder_DLLinker.cdl
+-- Created: Mon Oct 21 13:23:51 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class DLLinker from WOKBuilder inherits WNTLinker from WOKBuilder
+
+ ---Purpose: provides tool to build dynamic-link library
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils
+
+ is
+
+ Create (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ ) returns mutable DLLinker from WOKBuilder;
+ ---Purpose: create a class instance
+
+ EvalHeader ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluats tool command line
+
+ EvalCFExt ( me : mutable )
+ returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluates extension for name of the command file
+
+ EvalFooter ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluates additional information for the tool
+
+end DLLinker;
--- /dev/null
+#include <WOKBuilder_DLLinker.ixx>
+
+#include <WOKBuilder_ImportLibrary.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_ExportLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <OSD_Environment.hxx>
+
+WOKBuilder_DLLinker::WOKBuilder_DLLinker(const Handle(TCollection_HAsciiString)& aName,
+ const WOKUtils_Param& aParams)
+: WOKBuilder_WNTLinker(aName,aParams)
+{
+} // end constructor
+
+Handle(TCollection_HAsciiString) WOKBuilder_DLLinker::EvalHeader()
+{
+ OSD_Environment env("WOK_LINKER");
+ Handle(TCollection_HAsciiString) retVal;
+ TCollection_AsciiString val = env.Value();
+
+ if(!env.Failed())
+ {
+ retVal = new TCollection_HAsciiString ( val );
+
+ InfoMsg << "WOKBuilder_DLLinker :: EvalHeader"
+ << '\'' << retVal << "' is using" << endm;
+ }
+ else
+ retVal = EvalToolTemplate ( "LinkerHeaderDLL" );
+ return retVal;
+}
+
+
+Handle(TCollection_HAsciiString) WOKBuilder_DLLinker::EvalCFExt()
+{
+ return EvalToolParameter ( "LinkerCFExtDLL" );
+}
+
+Handle(TCollection_HAsciiString) WOKBuilder_DLLinker::EvalFooter()
+{
+ Handle(WOKBuilder_Entity) outEnt[4];
+ Handle(TCollection_HAsciiString) tmp;
+ Handle(TCollection_HAsciiString) retVal = EvalToolParameter("LinkerOutput");
+ Standard_Boolean fDebug;
+
+ //fDebug = Params().Value("%DebugMode")->IsSameString(new TCollection_HAsciiString("True")) ? Standard_True : Standard_False;
+
+ tmp = EvalToolTemplate("LinkerDLL");
+
+ outEnt[0] = new WOKBuilder_SharedLibrary(new WOKUtils_Path(tmp));
+
+ retVal->AssignCat(tmp );
+ retVal->AssignCat(EvalToolParameter("LinkerImplib"));
+
+ tmp = EvalToolTemplate("LinkerIMP");
+
+ outEnt[1] = new WOKBuilder_ImportLibrary(new WOKUtils_Path(tmp));
+
+ retVal->AssignCat(tmp);
+
+ outEnt[2] = new WOKBuilder_ExportLibrary(new WOKUtils_Path(EvalToolTemplate("LinkerEXP")));
+
+ //if (fDebug) {
+
+ retVal -> AssignCat ( EvalToolParameter ( "LinkerPDBOption" ) );
+ tmp = EvalToolTemplate ( "LinkerPDB" );
+ retVal -> AssignCat ( tmp );
+ outEnt[3] = new WOKBuilder_SharedLibrary(new WOKUtils_Path(tmp));
+ //}
+
+ SetProduction(new WOKBuilder_HSequenceOfEntity());
+
+ Produces()->Append(outEnt[0]);
+ Produces()->Append(outEnt[1]);
+ Produces()->Append(outEnt[2]);
+
+ //if( fDebug )
+ Produces()->Append(outEnt[3]);
+ return retVal;
+}
--- /dev/null
+-- File: WOKBuilder_EXEFile.cdl
+-- Created: Mon Oct 21 14:10:20 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class EXEFile from WOKBuilder inherits Entity from WOKBuilder
+
+ uses
+
+ Path from WOKUtils
+
+ is
+
+ Create ( apath : Path from WOKUtils ) returns mutable EXEFile from WOKBuilder;
+
+end EXEFile;
--- /dev/null
+#include <WOKBuilder_EXEFile.ixx>
+
+WOKBuilder_EXEFile :: WOKBuilder_EXEFile (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Entity ( apath ) {
+} // end constructor
--- /dev/null
+-- File: WOKBuilder_EXELinker.cdl
+-- Created: Mon Oct 21 13:11:23 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class EXELinker from WOKBuilder
+inherits WNTLinker from WOKBuilder
+
+ ---Purpose: provides tool to build an executable file
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils
+
+ is
+
+ Create(aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils)
+ ---Purpose: create a class instance
+ returns mutable EXELinker from WOKBuilder;
+
+
+ EvalHeader( me : mutable )
+ returns HAsciiString from TCollection
+ is redefined static;
+ ---Purpose: evaluats tool command line
+
+ EvalCFExt ( me : mutable )
+ returns HAsciiString from TCollection
+ is redefined static;
+ ---Purpose: evaluates extension for name of the command file
+
+ EvalFooter ( me : mutable )
+ returns HAsciiString from TCollection
+ is redefined static;
+ ---Purpose: evaluates additional information for the tool
+
+end EXELinker;
--- /dev/null
+
+#include <WOKBuilder_EXELinker.ixx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <WOKBuilder_Executable.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <OSD_Environment.hxx>
+
+WOKBuilder_EXELinker::WOKBuilder_EXELinker(const Handle(TCollection_HAsciiString)& aName,
+ const WOKUtils_Param& aParams)
+: WOKBuilder_WNTLinker(aName,aParams)
+{
+}
+
+Handle(TCollection_HAsciiString) WOKBuilder_EXELinker::EvalHeader()
+{
+ OSD_Environment env ( "WOK_LINKER" );
+
+ Handle(TCollection_HAsciiString) retVal;
+
+ TCollection_AsciiString val = env.Value();
+
+ if(!env.Failed())
+ {
+ retVal = new TCollection_HAsciiString(val);
+
+ InfoMsg << "WOKBuilder_EXELinker::EvalHeader"
+ << '\'' << retVal << "' is using" << endm;
+ }
+ else
+ retVal = EvalToolTemplate("LinkerHeaderEXE");
+
+ return retVal;
+}
+
+Handle(TCollection_HAsciiString) WOKBuilder_EXELinker::EvalCFExt()
+{
+ return EvalToolParameter("LinkerCFExtEXE");
+}
+
+Handle(TCollection_HAsciiString) WOKBuilder_EXELinker::EvalFooter()
+{
+ Handle(WOKBuilder_Entity) outEnt[2];
+ Handle(TCollection_HAsciiString) tmp;
+ Handle(TCollection_HAsciiString) retVal = EvalToolParameter("LinkerOutput");
+ //Standard_Boolean fDebug;
+
+ //fDebug = Params().Value("%DebugMode")->IsSameString(new TCollection_HAsciiString("True")) ? Standard_True : Standard_False;
+
+ tmp = EvalToolTemplate("LinkerEXE");
+
+ outEnt[0] = new WOKBuilder_Executable ( new WOKUtils_Path(tmp));
+
+ retVal->AssignCat(tmp);
+ retVal->AssignCat(EvalToolParameter("LinkerPDBOption"));
+
+ //if(fDebug)
+ // {
+ tmp = EvalToolTemplate ( "LinkerPDB" );
+ retVal->AssignCat(tmp);
+ outEnt[1] = new WOKBuilder_SharedLibrary(new WOKUtils_Path(tmp));
+ // }
+
+ SetProduction(new WOKBuilder_HSequenceOfEntity);
+ Produces()->Append(outEnt[0]);
+
+ //if(fDebug)
+ Produces()->Append(outEnt[1]);
+ return retVal;
+}
+
+
--- /dev/null
+-- File: WOKBuilder_Entity.cdl
+-- Created: Thu Aug 10 20:38:52 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class Entity from WOKBuilder
+inherits TShared from MMgt
+ ---Purpose:
+
+uses
+ Path from WOKUtils,
+ HSequenceOfEntity from WOKBuilder
+
+raises
+ ProgramError from Standard
+is
+ Initialize(apath : Path from WOKUtils);
+
+ Path(me)
+ ---C++: inline
+ ---C++: return const &
+ returns Path from WOKUtils;
+ SetPath(me:mutable; apath : Path from WOKUtils);
+
+fields
+ mypath : Path from WOKUtils;
+end Entity;
--- /dev/null
+// File: WOKBuilder_Entity.cxx
+// Created: Tue Aug 22 23:15:37 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Entity.ixx>
+
+#include <TCollection_HAsciiString.hxx>
+
+//=======================================================================
+//function : WOKBuilder_Entity
+//purpose :
+//=======================================================================
+WOKBuilder_Entity::WOKBuilder_Entity(const Handle(WOKUtils_Path)& apath) : mypath(apath)
+{
+}
+
+//=======================================================================
+//function : SetPath
+//purpose :
+//=======================================================================
+void WOKBuilder_Entity::SetPath(const Handle(WOKUtils_Path)& apath)
+{
+ mypath = apath;
+}
+
--- /dev/null
+// File: WOKBuilder_Entity.lxx
+// Created: Mon Aug 5 17:54:22 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+
+//=======================================================================
+//function : Path
+//purpose :
+//=======================================================================
+const Handle(WOKUtils_Path)& WOKBuilder_Entity::Path() const
+{
+ return mypath;
+}
--- /dev/null
+-- File: WOKBuilder_EntityHasher.cdl
+-- Created: Mon Sep 11 17:02:42 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+class EntityHasher from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Entity from WOKBuilder
+is
+
+ --- Methods to be a Map Hasher
+
+ HashCode(myclass; E1 : Entity from WOKBuilder)
+ returns Integer from Standard;
+
+ IsEqual(myclass; E1,E2 : Entity from WOKBuilder)
+ returns Boolean from Standard;
+
+end EntityHasher;
--- /dev/null
+// File: WOKBuilder_EntityHasher.cxx
+// Created: Mon Sep 11 17:03:43 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_EntityHasher.ixx>
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+#include <WOKUtils_Path.hxx>
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+Standard_Integer WOKBuilder_EntityHasher::HashCode(const Handle(WOKBuilder_Entity)& E1)
+{
+ return WOKTools_HAsciiStringHasher::HashCode(E1->Path()->Name());
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_EntityHasher::IsEqual(const Handle(WOKBuilder_Entity)& E1, const Handle(WOKBuilder_Entity)& E2)
+{
+ return E1->Path()->Name()->IsSameString(E2->Path()->Name());
+}
--- /dev/null
+-- File: WOKBuilder_Executable.cdl
+-- Created: Thu Feb 8 10:58:09 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+class Executable from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable Executable from WOKBuilder;
+
+
+end Executable;
--- /dev/null
+// File: WOKBuilder_Executable.cxx
+// Created: Thu Feb 8 10:58:53 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKBuilder_Executable.ixx>
+
+WOKBuilder_Executable::WOKBuilder_Executable(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_ExecutableLinker.cdl
+-- Created: Thu Feb 8 11:43:14 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class ExecutableLinker from WOKBuilder
+inherits Linker from WOKBuilder
+
+ ---Purpose: Links an executable
+ --
+
+uses
+
+ Entity from WOKBuilder,
+ ObjectFile from WOKBuilder,
+ Library from WOKBuilder,
+ HSequenceOfLibrary from WOKBuilder,
+ HSequenceOfObjectFile from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ SharedLibrary from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Param from WOKUtils,
+ HAsciiString from TCollection
+
+
+is
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable ExecutableLinker from WOKBuilder;
+
+ EvalHeader(me:mutable)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ GetLinkerProduction(me:mutable)
+ returns HSequenceOfEntity from WOKBuilder
+ is redefined protected;
+
+
+end ExecutableLinker;
--- /dev/null
+// File: WOKBuilder_ExecutableLinker.cxx<2>
+// Created: Thu Feb 8 12:41:16 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <EDL_API.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_HSequenceOfPath.hxx>
+
+#include <WOKBuilder_Executable.hxx>
+
+#include <WOKBuilder_ExecutableLinker.ixx>
+
+//=======================================================================
+//function : WOKBuilder_ExecutableLinker
+//purpose :
+//=======================================================================
+WOKBuilder_ExecutableLinker::WOKBuilder_ExecutableLinker(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_Linker(aname,params)
+{
+}
+
+//=======================================================================
+//function : EvalHeader
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ExecutableLinker::EvalHeader()
+{
+
+ Handle(TCollection_HAsciiString) line;
+ Handle(TCollection_HAsciiString) templ;
+ Handle(TCollection_HAsciiString) templname = new TCollection_HAsciiString("Header");
+ Handle(TCollection_HAsciiString) target;
+ Handle(WOKUtils_Path) targetpath;
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter(templname);
+
+ if(templ.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ExecutableLinker::EvalHeader" << "Could not eval parameter : " << templname << endm;
+ return line;
+ }
+
+ if( TargetName().IsNull())
+ target = new TCollection_HAsciiString("a.out");
+ else
+ target = TargetName();
+
+ targetpath = new WOKUtils_Path(OutputDir()->Name(), target);
+
+ Params().Set("%Target", targetpath->Name()->ToCString());
+
+ line = Params().Eval(templ->ToCString());
+
+ if(line.IsNull()) return line;
+
+ line->AssignCat(EvalLibSearchDirectives());
+ line->AssignCat(EvalDatabaseDirectives());
+
+ return line;
+}
+
+//=======================================================================
+//function : GetLinkerProduction
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_ExecutableLinker::GetLinkerProduction()
+{
+ Handle(WOKBuilder_Executable) anent;
+ Handle(WOKBuilder_HSequenceOfEntity) result = new WOKBuilder_HSequenceOfEntity;
+ Handle(TCollection_HAsciiString) target;
+ Handle(WOKUtils_Path) targetpath;
+
+ if( TargetName().IsNull())
+ target = new TCollection_HAsciiString("a.out");
+ else
+ target = TargetName();
+
+ targetpath = new WOKUtils_Path(OutputDir()->Name(), target);
+
+ anent = new WOKBuilder_Executable(targetpath);
+
+ result->Append(anent);
+
+ return result;
+}
--- /dev/null
+-- File: WOKBuilder_ExportLibrary.cdl
+-- Created: Wed Oct 23 09:29:38 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class ExportLibrary from WOKBuilder inherits Library from WOKBuilder
+
+ uses
+
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+
+ is
+
+ Create (apth : Path from WOKUtils )
+ returns mutable ExportLibrary from WOKBuilder;
+
+ Create (
+ aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder
+ ) returns mutable ExportLibrary from WOKBuilder;
+
+ GetLibFileName (
+ me : mutable;
+ params : Param from WOKUtils
+ ) returns HAsciiString from TCollection is redefined static;
+
+end ExportLibrary;
--- /dev/null
+#include <WOKBuilder_ExportLibrary.ixx>
+
+WOKBuilder_ExportLibrary :: WOKBuilder_ExportLibrary (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Library ( apath ) {
+} // end constructor ( 1 )
+
+WOKBuilder_ExportLibrary :: WOKBuilder_ExportLibrary (
+ const Handle( TCollection_HAsciiString )& aname,
+ const Handle( WOKUtils_Path )& adir,
+ const WOKBuilder_LibReferenceType areftype
+ ) : WOKBuilder_Library ( aname, adir, areftype ) {
+} // end constructor ( 2 )
+
+Handle( TCollection_HAsciiString ) WOKBuilder_ExportLibrary :: GetLibFileName (
+ const WOKUtils_Param& params
+ ) {
+
+ params.Set ( "%LIB_ExplibName", Name () -> ToCString () );
+
+ return params.Eval ( "LIB_ExplibFileName", Standard_True );
+
+} // end WOKBuilder_ExportLibrary :: GetLibFileName
--- /dev/null
+-- File: WOKBuilder_ImportLibrarian.cdl
+-- Created: Mon Oct 21 13:42:31 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class ImportLibrarian from WOKBuilder inherits WNTLibrarian from WOKBuilder
+
+ ---Purpose: defines tool to build import library
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils
+
+ is
+
+ Create (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ ) returns mutable ImportLibrarian from WOKBuilder;
+ ---Purpose: create a class instance
+
+ EvalHeader ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluats tool command line
+
+ EvalFooter ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluates additional information for the tool
+
+end ImportLibrarian;
--- /dev/null
+#include <WOKBuilder_ImportLibrarian.ixx>
+
+#include <WOKBuilder_Entity.hxx>
+#include <WOKBuilder_ImportLibrary.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+WOKBuilder_ImportLibrarian :: WOKBuilder_ImportLibrarian (
+ const Handle( TCollection_HAsciiString )& aName,
+ const WOKUtils_Param& aParams
+ ) : WOKBuilder_WNTLibrarian ( aName, aParams ) {
+} // end constructor
+
+Handle( TCollection_HAsciiString ) WOKBuilder_ImportLibrarian :: EvalHeader () {
+
+ return EvalToolTemplate ( "LibraryHeaderIMPORT" );
+
+} // end WOKBuilder_ImportLibrarian :: EvalHeader
+
+Handle( TCollection_HAsciiString ) WOKBuilder_ImportLibrarian :: EvalFooter () {
+
+ Handle( WOKBuilder_Entity ) outEnt[ 2 ];
+ Handle( TCollection_HAsciiString ) tmp;
+ Handle( TCollection_HAsciiString ) retVal = EvalToolParameter ( "LibraryOutput" );
+
+ tmp = EvalToolTemplate ( "LibraryIMPLIB" );
+
+ outEnt[ 0 ] = new WOKBuilder_ImportLibrary ( new WOKUtils_Path ( tmp ) );
+
+ retVal -> AssignCat ( tmp );
+
+ outEnt[ 1 ] = new WOKBuilder_SharedLibrary (
+ new WOKUtils_Path ( EvalToolTemplate ( "LibraryEXP" ) )
+ );
+
+ SetProduction ( new WOKBuilder_HSequenceOfEntity () );
+
+ Produces () -> Append ( outEnt[ 0 ] );
+ Produces () -> Append ( outEnt[ 1 ] );
+
+ return retVal;
+
+} // end WOKBuilder_ImportLibrarian :: EvalFooter
--- /dev/null
+-- File: WOKBuilder_ImportLibrary.cdl
+-- Created: Wed Oct 23 09:29:38 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class ImportLibrary from WOKBuilder inherits Library from WOKBuilder
+
+ uses
+
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+
+ is
+
+ Create (apth : Path from WOKUtils )
+ returns mutable ImportLibrary from WOKBuilder;
+
+ Create (
+ aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder
+ ) returns mutable ImportLibrary from WOKBuilder;
+
+ GetLibFileName (
+ me : mutable;
+ params : Param from WOKUtils
+ ) returns HAsciiString from TCollection is redefined static;
+
+ GetLibFileName (
+ myclass;
+ params : Param from WOKUtils;
+ aname : HAsciiString from TCollection
+ ) returns HAsciiString from TCollection;
+
+end ImportLibrary;
--- /dev/null
+#include <WOKBuilder_ImportLibrary.ixx>
+
+WOKBuilder_ImportLibrary :: WOKBuilder_ImportLibrary (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Library ( apath ) {
+} // end constructor ( 1 )
+
+WOKBuilder_ImportLibrary :: WOKBuilder_ImportLibrary (
+ const Handle( TCollection_HAsciiString )& aname,
+ const Handle( WOKUtils_Path )& adir,
+ const WOKBuilder_LibReferenceType areftype
+ ) : WOKBuilder_Library ( aname, adir, areftype ) {
+} // end constructor ( 2 )
+
+Handle( TCollection_HAsciiString ) WOKBuilder_ImportLibrary :: GetLibFileName (
+ const WOKUtils_Param& params
+ ) {
+
+ params.Set ( "%LIB_ImplibName", Name () -> ToCString () );
+
+ return params.Eval ( "LIB_ImplibFileName", Standard_True );
+
+} // end WOKBuilder_ImportLibrary :: GetLibFileName
+
+Handle( TCollection_HAsciiString ) WOKBuilder_ImportLibrary :: GetLibFileName (
+ const WOKUtils_Param& params,
+ const Handle( TCollection_HAsciiString )& aname
+ ) {
+
+ params.Set ( "%LIB_ImplibName", aname -> ToCString () );
+
+ return params.Eval ( "LIB_ImplibFileName", Standard_True );
+
+} // end WOKBuilder_ImportLibrary :: GetLibFileName
--- /dev/null
+-- File: WOKBuilder_Include.cdl
+-- Created: Thu Aug 10 20:50:41 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Include from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable Include from WOKBuilder;
+
+end Include;
--- /dev/null
+// File: WOKBuilder_Include.cxx
+// Created: Tue Aug 22 23:30:38 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Include.ixx>
+
+WOKBuilder_Include::WOKBuilder_Include(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_Library.cdl
+-- Created: Mon Oct 16 16:43:03 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class Library from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+is
+
+ Initialize(apath : Path from WOKUtils);
+
+ Initialize(aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder);
+
+
+ SetReferenceType(me:mutable; atype : LibReferenceType from WOKBuilder);
+ ReferenceType(me) returns LibReferenceType from WOKBuilder;
+
+ SetName(me:mutable; aname : HAsciiString from TCollection);
+ Name(me) returns HAsciiString from TCollection;
+
+ SetDirectory(me:mutable; adir : Path from WOKUtils);
+ Directory(me) returns Path from WOKUtils;
+
+ GetLibFileName(me:mutable; params : Param from WOKUtils)
+ ---Purpose: Gets the file name of Library
+ returns HAsciiString from TCollection
+ is deferred;
+
+ GetPath(me:mutable; params : Param from WOKUtils)
+ ---Purpose: Sets the path of Library
+ is static;
+
+fields
+
+ myreftype : LibReferenceType from WOKBuilder;
+ mydir : Path from WOKUtils;
+ myname : HAsciiString from TCollection;
+
+end Library;
--- /dev/null
+// File: WOKBuilder_Library.cxx
+// Created: Mon Oct 16 17:18:11 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Library.ixx>
+
+
+//=======================================================================
+//function : WOKBuilder_Library
+//purpose :
+//=======================================================================
+WOKBuilder_Library::WOKBuilder_Library(const Handle(WOKUtils_Path)& apath)
+ : WOKBuilder_Entity(apath), myreftype(WOKBuilder_FullPath)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_Library
+//purpose :
+//=======================================================================
+WOKBuilder_Library::WOKBuilder_Library(const Handle(TCollection_HAsciiString)& aname,
+ const Handle(WOKUtils_Path)& adir,
+ const WOKBuilder_LibReferenceType areftype)
+: WOKBuilder_Entity(Handle(WOKUtils_Path)())
+{
+ myname = aname;
+ mydir = adir;
+ myreftype = areftype;
+}
+
+//=======================================================================
+//function : SetReferenceType
+//purpose :
+//=======================================================================
+void WOKBuilder_Library::SetReferenceType(const WOKBuilder_LibReferenceType atype)
+{
+ myreftype = atype;
+}
+
+//=======================================================================
+//function : ReferenceType
+//purpose :
+//=======================================================================
+WOKBuilder_LibReferenceType WOKBuilder_Library::ReferenceType() const
+{
+ return myreftype;
+}
+
+//=======================================================================
+//function : SetName
+//purpose :
+//=======================================================================
+void WOKBuilder_Library::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+ myname = aname;
+}
+
+//=======================================================================
+//function : Name
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Library::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//function : SetDirectory
+//purpose :
+//=======================================================================
+void WOKBuilder_Library::SetDirectory(const Handle(WOKUtils_Path)& adir)
+{
+ mydir = adir;
+}
+
+//=======================================================================
+//function : Directory
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Path) WOKBuilder_Library::Directory() const
+{
+ return mydir;
+}
+
+
+//=======================================================================
+//function : GetPath
+//purpose :
+//=======================================================================
+void WOKBuilder_Library::GetPath(const WOKUtils_Param& params)
+{
+ Handle(TCollection_HAsciiString) name;
+ Handle(WOKUtils_Path) path;
+
+
+ name = GetLibFileName(params);
+
+ path = new WOKUtils_Path(Directory()->Name(), name);
+
+ SetPath(path);
+ return;
+}
--- /dev/null
+-- File: WOKBuilder_Linker.cdl
+-- Created: Tue Oct 24 11:40:38 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class Linker from WOKBuilder
+inherits ToolInShell from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Entity from WOKBuilder,
+ ObjectFile from WOKBuilder,
+ Library from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ HSequenceOfLibrary from WOKBuilder,
+ HSequenceOfObjectFile from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ SharedLibrary from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Param from WOKUtils,
+ HSequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+is
+
+ Initialize(aname : HAsciiString from TCollection; params : Param from WOKUtils);
+
+ Load(me:mutable)
+ is redefined;
+
+ ObjectList(me) returns HSequenceOfObjectFile from WOKBuilder;
+ SetObjectList(me:mutable; objects : HSequenceOfObjectFile from WOKBuilder);
+
+ TargetName(me) returns HAsciiString from TCollection;
+ SetTargetName(me:mutable; aname : HAsciiString from TCollection);
+
+ LibraryRefLine(me:mutable; alib : Library from WOKBuilder)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ SetLibrarySearchPathes(me:mutable; libpathes : HSequenceOfPath from WOKUtils);
+ LibrarySearchPathes(me)
+ returns HSequenceOfPath from WOKUtils;
+
+ SetDatabaseDirectories(me:mutable; libpathes : HSequenceOfPath from WOKUtils);
+ DatabaseDirectories(me)
+ returns HSequenceOfPath from WOKUtils;
+
+ LibraryList(me)
+ returns HSequenceOfLibrary from WOKBuilder;
+ SetLibraryList(me:mutable; asharedlist : HSequenceOfLibrary from WOKBuilder);
+
+ Externals(me)
+ returns HSequenceOfHAsciiString from TColStd;
+ SetExternals(me:mutable; externals : HSequenceOfHAsciiString from TColStd);
+
+ EvalHeader(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ EvalLibSearchDirectives(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ EvalDatabaseDirectives(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ EvalObjectList(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ EvalLibraryList(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ EvalFooter(me:mutable)
+ returns HAsciiString from TCollection
+ is virtual protected;
+
+ GetLinkerProduction(me:mutable)
+ returns HSequenceOfEntity from WOKBuilder
+ is virtual protected;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+fields
+ myname : HAsciiString from TCollection;
+ myobjects : HSequenceOfObjectFile from WOKBuilder;
+ mylibpathes : HSequenceOfPath from WOKUtils;
+ mydbdirs : HSequenceOfPath from WOKUtils;
+ mylibs : HSequenceOfLibrary from WOKBuilder;
+ myexterns : HSequenceOfHAsciiString from TColStd;
+end Linker;
--- /dev/null
+// File: WOKBuilder_Linker.cxx
+// Created: Tue Oct 24 13:37:07 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <fstream.h>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Shell.hxx>
+
+#include <WOKBuilder_HSequenceOfObjectFile.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+
+#include <EDL_API.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKBuilder_Linker.ixx>
+
+//=======================================================================
+//function : WOKBuilder_Linker
+//purpose :
+//=======================================================================
+WOKBuilder_Linker::WOKBuilder_Linker(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_ToolInShell(aname, params)
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::Load()
+{
+ return;
+}
+
+//=======================================================================
+//function : ObjectList
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfObjectFile) WOKBuilder_Linker::ObjectList() const
+{
+ return myobjects;
+}
+
+//=======================================================================
+//function : SetObjectList
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetObjectList(const Handle(WOKBuilder_HSequenceOfObjectFile)& objects)
+{
+ myobjects = objects;
+}
+
+//=======================================================================
+//function : TargetName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::TargetName() const
+{
+ return myname;
+}
+
+//=======================================================================
+//function : SetTargetName
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetTargetName(const Handle(TCollection_HAsciiString)& aname)
+{
+ myname = aname;
+}
+
+//=======================================================================
+//function : LibraryRefLine
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::LibraryRefLine(const Handle(WOKBuilder_Library)& alib)
+{
+ Handle(TCollection_HAsciiString) line;
+ Handle(TCollection_HAsciiString) templ;
+ Standard_CString templname;
+
+ if(alib.IsNull())
+ return line;
+
+ if(!IsLoaded()) Load();
+
+ if(alib->Name().IsNull())
+ {
+ if(alib->Path().IsNull())
+ return line;
+
+ alib->SetDirectory(new WOKUtils_Path(alib->Path()->DirName()));
+
+ Handle(TCollection_HAsciiString) name = alib->Path()->BaseName();
+ name->Remove(1,3);
+
+ alib->SetName(name);
+ }
+
+ switch(alib->ReferenceType())
+ {
+ case WOKBuilder_ShortRef:
+ templname = "ShortRef";
+ break;
+ case WOKBuilder_LongRef:
+ templname = "LongRef";
+ break;
+ case WOKBuilder_FullPath:
+ if(alib->IsKind(STANDARD_TYPE(WOKBuilder_SharedLibrary)))
+ templname = "SharedFullPath";
+ else
+ templname = "ArchiveFullPath";
+ break;
+ default:
+ ErrorMsg << "WOKBuilder_Linker::LibraryRefLine" << "Unknown Library Ref Type" << endm;
+ return line;
+ }
+
+ templ = EvalToolParameter(templname);
+
+ if(templ.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_Linker::LibraryRefLine" << "Could not eval parameter : " << templname << endm;
+ return line;
+ }
+
+ Params().Set("%LibDir", alib->Directory()->Name()->ToCString());
+ Params().Set("%LibName", alib->Name()->ToCString());
+
+ line = Params().Eval(templ->ToCString());
+ return line;
+}
+
+//=======================================================================
+//function : LibrarySearchPathes
+//purpose :
+//=======================================================================
+Handle(WOKUtils_HSequenceOfPath) WOKBuilder_Linker::LibrarySearchPathes() const
+{
+ return mylibpathes;
+}
+
+//=======================================================================
+//function : SetLibrarySearchPathes
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetLibrarySearchPathes(const Handle(WOKUtils_HSequenceOfPath)& libpathes)
+{
+ mylibpathes = libpathes;
+}
+
+//=======================================================================
+//function : DatabaseDirectories
+//purpose :
+//=======================================================================
+Handle(WOKUtils_HSequenceOfPath) WOKBuilder_Linker::DatabaseDirectories() const
+{
+ return mydbdirs;
+}
+
+//=======================================================================
+//function : SetDatabaseDirectories
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetDatabaseDirectories(const Handle(WOKUtils_HSequenceOfPath)& dbdirs)
+{
+ mydbdirs = dbdirs;
+}
+
+//=======================================================================
+//function : LibraryList
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfLibrary) WOKBuilder_Linker::LibraryList() const
+{
+ return mylibs;
+}
+
+//=======================================================================
+//function : SetLibraryList
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetLibraryList(const Handle(WOKBuilder_HSequenceOfLibrary)& asharedlist)
+{
+ mylibs = asharedlist;
+}
+
+//=======================================================================
+//function : Externals
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_Linker::Externals() const
+{
+ return myexterns;
+}
+
+//=======================================================================
+//function : SetExternals
+//purpose :
+//=======================================================================
+void WOKBuilder_Linker::SetExternals(const Handle(TColStd_HSequenceOfHAsciiString)& externals)
+{
+ myexterns = externals;
+}
+
+//=======================================================================
+//function : EvalHeader
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalHeader()
+{
+ Handle(TCollection_HAsciiString) line;
+ Handle(TCollection_HAsciiString) templ;
+ Handle(TColStd_HSequenceOfHAsciiString) varseq = new TColStd_HSequenceOfHAsciiString;
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter("Header");
+
+ if(templ.IsNull()) return line;
+
+
+ Params().Set("%Target", TargetName()->ToCString());
+
+ line = Params().Eval(templ->ToCString());
+
+ if(line.IsNull()) return line;
+
+ line->AssignCat(EvalLibSearchDirectives());
+ line->AssignCat(EvalDatabaseDirectives());
+
+ return line;
+}
+
+//=======================================================================
+//function : EvalLibSearchDirectives
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibSearchDirectives()
+{
+ Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString;
+
+ if(!mylibpathes.IsNull())
+ {
+ Standard_Integer i;
+
+ for(i=1; i<=mylibpathes->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) directive;
+
+ Params().Set("%LibDir", mylibpathes->Value(i)->Name()->ToCString());
+
+ directive = Params().Eval("LD_LibSearchPath");
+
+ if(!directive.IsNull())
+ {
+ res->AssignCat(directive);
+ }
+ else
+ {
+ WarningMsg << "WOKBuilder_Linker::EvalLibSearchDirectives"
+ << "Could not eval lib directive: LD_LibSearchPath" << endm;
+ }
+ }
+ }
+
+ return res;
+}
+
+//=======================================================================
+//function : EvalDatabaseDirectives
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalDatabaseDirectives()
+{
+ Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString;
+
+ if(!mydbdirs.IsNull())
+ {
+ Standard_Integer i;
+
+ for(i=1; i<=mydbdirs->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) directive;
+
+ Params().Set("%DBDir", mydbdirs->Value(i)->Name()->ToCString());
+
+ directive = Params().Eval("LD_DBDirective");
+ if(!directive.IsNull())
+ {
+ res->AssignCat(directive);
+ }
+ else
+ {
+ WarningMsg << "WOKBuilder_Linker::EvalDatabaseDirectives"
+ << "Could not eval database directive: LD_DBDirective" << endm;
+ }
+ }
+ }
+ else
+ {
+ Params().Set("%DBDirectives", " ");
+ }
+
+ return res;
+}
+
+//=======================================================================
+//function : EvalObjectList
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalObjectList()
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) templ;
+ Handle(TCollection_HAsciiString) line;
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter("ObjectRef");
+
+ if(templ.IsNull()) return line;
+
+ line = new TCollection_HAsciiString;
+
+ for(i=1; i<=myobjects->Length(); i++)
+ {
+ Params().Set("%ObjectPath", myobjects->Value(i)->Path()->Name()->ToCString());
+ line->AssignCat(Params().Eval(templ->ToCString()));
+ }
+ return line;
+}
+
+//=======================================================================
+//function : EvalLibraryList
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibraryList()
+{
+ Standard_Integer i;
+ Handle(TCollection_HAsciiString) line;
+
+ line = new TCollection_HAsciiString;
+
+ for(i=1; i<=mylibs->Length(); i++)
+ {
+ line->AssignCat(LibraryRefLine(mylibs->Value(i)));
+ }
+ return line;
+}
+
+
+//=======================================================================
+//function : EvalFooter
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalFooter()
+{
+ Handle(TCollection_HAsciiString) line = new TCollection_HAsciiString;
+ Handle(TCollection_HAsciiString) templ, exttempl, astr;
+ Standard_Integer i;
+
+ if(!IsLoaded()) Load();
+
+ exttempl = EvalToolParameter("ExternRef");
+
+ for(i=1; i<=myexterns->Length(); i++)
+ {
+ astr = Params().Eval(myexterns->Value(i)->ToCString(), Standard_True);
+
+ if(astr.IsNull())
+ {
+ WarningMsg << "WOKBuilder_Linker::EvalFooter"
+ << "Could not eval ExternLib : " << myexterns->Value(i) << endm;
+ }
+ else
+ {
+ Params().Set("%ExternRef", astr->ToCString());
+ line->AssignCat(Params().Eval(exttempl->ToCString()));
+ }
+ }
+
+ templ = EvalToolParameter("Footer");
+
+ if(templ.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_Linker::EvalFooter" << "Could not eval parameter : " << Name() << "_Footer" << endm;
+ return line;
+ }
+
+ Params().Set("%Target", TargetName()->ToCString());
+
+ line->AssignCat(Params().Eval(templ->ToCString()));
+ return line;
+}
+
+
+//=======================================================================
+//function : GetLinkerProduction
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_Linker::GetLinkerProduction()
+{
+ return new WOKBuilder_HSequenceOfEntity;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_Linker::Execute()
+{
+ Standard_Integer i=0;
+ Handle(WOKBuilder_HSequenceOfEntity) aseq = new WOKBuilder_HSequenceOfEntity;
+ Handle(TColStd_HSequenceOfHAsciiString) errmsgs;
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+ if(!IsLoaded()) Load();
+
+ Shell()->ClearOutput();
+
+ //
+ //// Calcul de la liste des objets
+ //
+ Handle(TCollection_HAsciiString) filename = new TCollection_HAsciiString(TargetName());
+ filename->AssignCat(".ObjList");
+
+ Handle(WOKUtils_Path) objlistpath = new WOKUtils_Path(OutputDir()->Name(), filename);
+
+ ofstream objstream(objlistpath->Name()->ToCString());
+
+ if(!objstream.good())
+ {
+ ErrorMsg << "WOKBuilder_Linker::Execute"
+ << "Could not open " << objlistpath->Name() << " for writing" << endm;
+ return WOKBuilder_Failed;
+ }
+
+
+ for(i=1; i<=myobjects->Length(); i++)
+ {
+ objstream << myobjects->Value(i)->Path()->Name()->ToCString() << endl;
+ }
+
+ objstream.close();
+
+ Params().Set("%LD_ObjList", objlistpath->Name()->ToCString());
+
+ Shell()->Send(EvalHeader());
+ Shell()->Send(EvalObjectList());
+ Shell()->Send(EvalLibraryList());
+ Shell()->Execute(EvalFooter());
+
+ if(Shell()->Status())
+ {
+ Standard_Boolean ph = ErrorMsg.PrintHeader();
+
+ ErrorMsg << "WOKBuilder_Linker::Execute" << "Errors Occured :" << endm;
+
+ errmsgs = Shell()->Errors();
+ ErrorMsg.DontPrintHeader();
+ for(Standard_Integer i=1; i<= errmsgs->Length(); i++)
+ {
+ ErrorMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm;
+ }
+ if(ph) ErrorMsg.DoPrintHeader();
+ return WOKBuilder_Failed;
+ }
+ else
+ {
+ Standard_Boolean ph = InfoMsg.PrintHeader();
+ InfoMsg.DontPrintHeader();
+ errmsgs = Shell()->Errors();
+ for(Standard_Integer i=1; i<= errmsgs->Length(); i++)
+ {
+ InfoMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm;
+ }
+ if(ph) InfoMsg.DoPrintHeader();
+ }
+
+ Shell()->ClearOutput();
+
+ SetProduction(GetLinkerProduction());
+ Produces()->Append(new WOKBuilder_Miscellaneous(objlistpath));
+
+ return WOKBuilder_Success;
+}
--- /dev/null
+-- File: WOKBuilder_MFile.cdl
+-- Created: Tue Aug 29 11:13:48 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MFile from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable MFile from WOKBuilder;
+
+
+end MFile;
--- /dev/null
+// File: WOKBuilder_MFile.cxx
+// Created: Tue Aug 29 11:14:30 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_MFile.ixx>
+
+WOKBuilder_MFile::WOKBuilder_MFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_MSTranslatorAction.cdl
+-- Created: Mon Nov 27 11:49:08 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSAction from WOKBuilder
+inherits TShared from MMgt
+
+ ---Purpose:
+
+uses
+ HAsciiString from TCollection,
+ MSActionType from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSEntity from WOKBuilder,
+ TimeStat from WOKUtils
+
+is
+
+ Create returns mutable MSAction from WOKBuilder;
+
+ Create(anaction : MSAction from WOKBuilder; atype : MSActionType from WOKBuilder)
+ returns mutable MSAction from WOKBuilder;
+
+ Create(anentity : MSEntity from WOKBuilder; atype : MSActionType from WOKBuilder)
+ returns mutable MSAction from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection; atype : MSActionType from WOKBuilder)
+ returns mutable MSAction from WOKBuilder;
+
+ SetEntity(me:mutable; anentity : MSEntity from WOKBuilder);
+ Entity(me) returns MSEntity from WOKBuilder;
+ ---C++: return const &
+ ---C++: inline
+
+ SetType(me:mutable; atype : MSActionType from WOKBuilder);
+ Type(me) returns MSActionType from WOKBuilder;
+ ---C++: inline
+
+ Date(me) returns TimeStat from WOKUtils;
+ ---C++: inline
+
+ SetDate(me:mutable; adate : TimeStat from WOKUtils);
+ GetDate(me:mutable);
+
+ Status(me) returns MSActionStatus from WOKBuilder;
+ SetStatus(me:mutable; astatus : MSActionStatus from WOKBuilder);
+
+fields
+
+ myent : MSEntity from WOKBuilder;
+ mytype : MSActionType from WOKBuilder;
+ mystatus : MSActionStatus from WOKBuilder;
+ mydate : TimeStat from WOKUtils;
+
+end MSAction;
--- /dev/null
+// File: WOKBuilder_MSAction.cxx
+// Created: Wed Dec 20 17:59:15 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_MSAction.ixx>
+
+#include <sys/types.h>
+
+#include <time.h>
+
+//=======================================================================
+//function : WOKBuilder_MSAction
+//purpose :
+//=======================================================================
+ WOKBuilder_MSAction::WOKBuilder_MSAction()
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSAction
+//purpose :
+//=======================================================================
+WOKBuilder_MSAction::WOKBuilder_MSAction(const Handle(WOKBuilder_MSAction)& anaction,
+ const WOKBuilder_MSActionType atype)
+: mytype(atype)
+{
+ myent = anaction->Entity();
+ mydate = anaction->Date();
+ mystatus = anaction->Status();
+}
+
+//=======================================================================
+//function : WOKBuilder_MSAction
+//purpose :
+//=======================================================================
+WOKBuilder_MSAction::WOKBuilder_MSAction(const Handle(WOKBuilder_MSEntity)& anentity,
+ const WOKBuilder_MSActionType atype)
+: myent(anentity), mytype(atype), mydate(-1), mystatus(WOKBuilder_NotDefined)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSAction
+//purpose :
+//=======================================================================
+WOKBuilder_MSAction::WOKBuilder_MSAction(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType atype)
+: mytype(atype), mydate(-1), mystatus(WOKBuilder_NotDefined)
+{
+ myent = new WOKBuilder_MSEntity(aname);
+}
+
+//=======================================================================
+//function : SetEntity
+//purpose :
+//=======================================================================
+void WOKBuilder_MSAction::SetEntity(const Handle(WOKBuilder_MSEntity)& anent)
+{
+ myent = anent;
+}
+
+//=======================================================================
+//function : SetType
+//purpose :
+//=======================================================================
+void WOKBuilder_MSAction::SetType(const WOKBuilder_MSActionType atype)
+{
+ mytype = atype;
+}
+
+//=======================================================================
+//function : SetDate
+//purpose :
+//=======================================================================
+void WOKBuilder_MSAction::SetDate(const WOKUtils_TimeStat& adate)
+{
+ mydate = adate;
+}
+
+//=======================================================================
+//function : SetDate
+//purpose :
+//=======================================================================
+void WOKBuilder_MSAction::GetDate()
+{
+ mydate = time(NULL);
+ if(mydate == -1)
+ {
+ ErrorMsg << "WOKBuilder_MSAction::GetDate" << "Could not obtain current date" << endm;
+ Standard_ProgramError::Raise("WOKBuilder_MSAction::GetDate");
+ }
+}
+
+//=======================================================================
+//function : Status
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSAction::Status() const
+{
+ return mystatus;
+}
+
+//=======================================================================
+//function : SetStatus
+//purpose :
+//=======================================================================
+void WOKBuilder_MSAction::SetStatus(const WOKBuilder_MSActionStatus astatus)
+{
+ mystatus = astatus;
+}
--- /dev/null
+// File: WOKBuilder_MSTranslatorAction.lxx
+// Created: Wed Dec 20 15:22:24 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Entity
+//purpose :
+//=======================================================================
+const Handle(WOKBuilder_MSEntity)& WOKBuilder_MSAction::Entity() const
+{
+ return myent;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Type
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSAction::Type() const
+{
+ return mytype;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Date
+//purpose :
+//=======================================================================
+WOKUtils_TimeStat WOKBuilder_MSAction::Date() const
+{
+ return mydate;
+}
--- /dev/null
+-- File: WOKBuilder_MSTranslatorActionID.cdl
+-- Created: Wed Dec 20 16:14:02 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSActionID from WOKBuilder
+
+ ---Purpose:
+
+uses
+ HAsciiString from TCollection,
+ MSActionType from WOKBuilder,
+ MSAction from WOKBuilder
+
+is
+ Create(aname:HAsciiString from TCollection; atype : MSActionType from WOKBuilder)
+ ---C++: inline
+ returns MSActionID from WOKBuilder;
+
+ Name(me) returns mutable HAsciiString from TCollection;
+ ---C++: return const &
+ ---C++: inline
+
+ SetName(me:out; aname : HAsciiString from TCollection);
+
+ Type(me) returns MSActionType from WOKBuilder;
+ ---C++: inline
+
+ SetType(me:out; atype : MSActionType from WOKBuilder);
+
+ IsEqual(myclass; K1, K2 : MSActionID from WOKBuilder)
+ returns Boolean from Standard;
+
+ HashCode(myclass; K : MSActionID from WOKBuilder)
+ returns Integer from Standard;
+
+ IsEqual(myclass; K1, K2 : MSAction from WOKBuilder)
+ returns Boolean from Standard;
+
+ HashCode(myclass; K : MSAction from WOKBuilder)
+ returns Integer from Standard;
+
+
+fields
+
+ myname : HAsciiString from TCollection;
+ mytype : MSActionType from WOKBuilder;
+
+end MSActionID;
--- /dev/null
+// File: WOKBuilder_MSActionID.cxx
+// Created: Wed Dec 20 18:05:40 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+
+#include <WOKBuilder_MSEntity.hxx>
+
+#include <WOKBuilder_MSActionID.ixx>
+
+//=======================================================================
+//function : SetName
+//purpose :
+//=======================================================================
+void WOKBuilder_MSActionID::SetName(const Handle(TCollection_HAsciiString)& aname )
+{
+ myname = aname;
+}
+
+//=======================================================================
+//function : SetType
+//purpose :
+//=======================================================================
+void WOKBuilder_MSActionID::SetType(const WOKBuilder_MSActionType atype)
+{
+ mytype = atype;
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSActionID::IsEqual(const WOKBuilder_MSActionID& K1, const WOKBuilder_MSActionID& K2)
+{
+ if(K1.mytype!=K2.mytype) return Standard_False;
+ if(strcmp(K1.Name()->ToCString(), K2.Name()->ToCString())) return Standard_False;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+Standard_Integer WOKBuilder_MSActionID::HashCode(const WOKBuilder_MSActionID& K)
+{
+ return WOKTools_HAsciiStringHasher::HashCode(K.Name()) + K.mytype;
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSActionID::IsEqual(const Handle(WOKBuilder_MSAction)& K1, const Handle(WOKBuilder_MSAction)& K2)
+{
+ if(K1->Type()!=K2->Type()) return Standard_False;
+ if(strcmp(K1->Entity()->Name()->ToCString(), K2->Entity()->Name()->ToCString())) return Standard_False;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+Standard_Integer WOKBuilder_MSActionID::HashCode(const Handle(WOKBuilder_MSAction)& K)
+{
+ return WOKTools_HAsciiStringHasher::HashCode(K->Entity()->Name()) + K->Type();
+}
+
--- /dev/null
+// File: WOKBuilder_MSActionID.lxx
+// Created: Fri Apr 12 16:08:17 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKBuilder_MSActionType.hxx>
+
+//=======================================================================
+//function : WOKBuilder_MSActionID
+//purpose :
+//=======================================================================
+ WOKBuilder_MSActionID::WOKBuilder_MSActionID(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType atype)
+: myname(aname), mytype(atype)
+{
+}
+
+//=======================================================================
+//function : Name
+//purpose :
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKBuilder_MSActionID::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//function : Type
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSActionID::Type() const
+{
+ return mytype;
+}
--- /dev/null
+-- File: WOKBuilder_MSClientExtractor.cdl
+-- Created: Tue Mar 19 19:32:13 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class MSClientExtractor from WOKBuilder
+inherits MSHeaderExtractor from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSActionType from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSAction from WOKBuilder,
+ Param from WOKUtils,
+ HSequenceOfMemberMet from MS,
+ HSequenceOfExternMet from MS,
+ MapOfHAsciiString from WOKTools,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+is
+
+ Create(ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSClientExtractor from WOKBuilder;
+
+ Create(params : Param from WOKUtils)
+ returns mutable MSClientExtractor from WOKBuilder;
+
+ Init(me:mutable; aname : HAsciiString from TCollection);
+
+ MemberMethods(me)
+ returns HSequenceOfMemberMet from MS;
+
+ ExternMethods(me)
+ returns HSequenceOfExternMet from MS;
+
+ CompleteTypes(me)
+ ---C++: return const &
+ returns MapOfHAsciiString from WOKTools;
+
+ IncompleteTypes(me)
+ ---C++: return const &
+ returns MapOfHAsciiString from WOKTools;
+
+ SemiCompleteTypes(me)
+ ---C++: return const &
+ returns MapOfHAsciiString from WOKTools;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is redefined;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is redefined;
+
+fields
+
+ mycompl : MapOfHAsciiString from WOKTools;
+ myicompl : MapOfHAsciiString from WOKTools;
+ myscompl : MapOfHAsciiString from WOKTools;
+ mymmeth : HSequenceOfMemberMet from MS;
+ myxmeth : HSequenceOfExternMet from MS;
+
+end MSClientExtractor;
--- /dev/null
+// File: WOKBuilder_MSClientExtractor.cxx
+// Created: Tue Mar 19 20:45:22 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKTools_Messages.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Client.hxx>
+#include <MS_Interface.hxx>
+
+#include <WOKBuilder_MSActionID.hxx>
+#include <WOKBuilder_MSEntity.hxx>
+#include <WOKBuilder_MSchema.hxx>
+
+#include <WOKBuilder_MSClientExtractor.ixx>
+
+
+
+extern "C" {
+
+typedef void (*WOKBuilder_MSClientExtractorInitPtr)(const Handle(MS_MetaSchema)& ,
+ const Handle(TCollection_HAsciiString)& ,
+ const Handle(MS_HSequenceOfExternMet)& ,
+ const Handle(MS_HSequenceOfMemberMet)& );
+}
+
+
+//=======================================================================
+//function : WOKBuilder_MSClientExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSClientExtractor::WOKBuilder_MSClientExtractor(const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSHeaderExtractor(ashared, searchlist)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSClientExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSClientExtractor::WOKBuilder_MSClientExtractor(const WOKUtils_Param& params)
+ : WOKBuilder_MSHeaderExtractor(new TCollection_HAsciiString("CPPCLIENT"),params)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKBuilder_MSClientExtractor::Init(const Handle(TCollection_HAsciiString)& aname)
+{
+
+ myxmeth = new MS_HSequenceOfExternMet;
+ mymmeth = new MS_HSequenceOfMemberMet;
+ mycompl.Clear();
+ myicompl.Clear();
+ myscompl.Clear();
+
+ Handle(MS_Client) aclt;
+ Handle(WOKBuilder_MSchema) ams = WOKBuilder_MSTool::GetMSchema();
+
+ if(ams->MetaSchema()->IsClient(aname))
+ {
+ aclt = ams->MetaSchema()->GetClient(aname);
+
+ aclt->ComputeTypes(myxmeth, mymmeth, mycompl, myicompl, myscompl);
+
+ if(myinitfunc != NULL)
+ {
+ ((WOKBuilder_MSClientExtractorInitPtr) myinitfunc) (ams->MetaSchema(),aname, myxmeth,mymmeth);
+ }
+ }
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : MemberMethods
+//purpose :
+//=======================================================================
+Handle(MS_HSequenceOfMemberMet) WOKBuilder_MSClientExtractor::MemberMethods() const
+{
+ return mymmeth;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExternMethods
+//purpose :
+//=======================================================================
+Handle(MS_HSequenceOfExternMet) WOKBuilder_MSClientExtractor::ExternMethods() const
+{
+ return myxmeth;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CompleteTypes
+//purpose :
+//=======================================================================
+const WOKTools_MapOfHAsciiString& WOKBuilder_MSClientExtractor::CompleteTypes() const
+{
+ return mycompl;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CompleteTypes
+//purpose :
+//=======================================================================
+const WOKTools_MapOfHAsciiString& WOKBuilder_MSClientExtractor::IncompleteTypes() const
+{
+ return myicompl;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CompleteTypes
+//purpose :
+//=======================================================================
+const WOKTools_MapOfHAsciiString& WOKBuilder_MSClientExtractor::SemiCompleteTypes() const
+{
+ return myscompl;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExtractorID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSClientExtractor::ExtractorID() const
+{
+ return WOKBuilder_ClientExtract;
+}
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSClientExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& anaction)
+{
+ Handle(TCollection_HAsciiString) astr;
+ Handle(TColStd_HSequenceOfHAsciiString) aList;
+ Handle(MS_MetaSchema) ameta = MSchema()->MetaSchema();
+ Standard_Integer i;
+
+ WOKBuilder_MSActionID anid(anaction->Entity()->Name(), anaction->Type());
+
+ if(!MSchema()->IsActionDefined(anid)) return WOKBuilder_OutOfDate;
+
+ astr = anaction->Entity()->Name();
+
+ aList = GetTypeDepList(anaction->Entity()->Name());
+
+ for(i=1; i<=aList->Length(); i++)
+ {
+ astr = aList->Value(i);
+
+ WOKUtils_TimeStat depdate = GetTypeMDate(astr);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSClientExtractor::ExtractionStatus"
+ << "Comparing extraction date : "
+ << (Standard_Integer) anaction->Date() << " of " << anaction->Entity()->Name() << endm;
+
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSClientExtractor::ExtractionStatus"
+ << "with modification date : "
+ << (Standard_Integer) depdate << " of " << astr << endm;
+ }
+
+ if( GetTypeMDate(astr) > anaction->Date())
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSClientExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is out of date compared to " << astr << endm;
+ }
+ return WOKBuilder_OutOfDate;
+ }
+ else
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSClientExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is up to date compared to : " << astr << endm;
+ }
+ }
+ }
+
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSClientExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is up to date" << endm;
+ }
+
+ return WOKBuilder_UpToDate;
+}
--- /dev/null
+-- File: WOKBuilder_MSEngineExtractor.cdl
+-- Created: Tue Mar 19 19:34:30 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class MSEngineExtractor from WOKBuilder
+inherits MSExtractor from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSActionType from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSAction from WOKBuilder,
+ Param from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+is
+
+ Create(ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSEngineExtractor from WOKBuilder;
+
+ Create(params : Param from WOKUtils)
+ returns mutable MSEngineExtractor from WOKBuilder;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is redefined;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is redefined;
+
+end MSEngineExtractor;
--- /dev/null
+// File: WOKBuilder_MSEngineExtractor.cxx
+// Created: Tue Mar 19 20:47:06 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKBuilder_MSEngineExtractor.ixx>
+
+//=======================================================================
+//function : WOKBuilder_MSEngineExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSEngineExtractor::WOKBuilder_MSEngineExtractor(const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPPENG"), ashared, searchlist)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSEngineExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSEngineExtractor::WOKBuilder_MSEngineExtractor(const WOKUtils_Param& params)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPPENG"), params)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExtractorID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSEngineExtractor::ExtractorID() const
+{
+ return WOKBuilder_EngineExtract;
+}
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSEngineExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& )
+{
+ return WOKBuilder_OutOfDate;
+}
+
--- /dev/null
+-- File: WOKBuilder_MSEntity.cdl
+-- Created: Mon Sep 18 13:57:04 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSEntity from WOKBuilder
+inherits Entity from WOKBuilder
+ ---Purpose:
+
+uses
+
+ Specification from WOKBuilder,
+ Path from WOKUtils,
+ TimeStat from WOKUtils,
+ HAsciiString from TCollection,
+ MetaSchema from MS,
+ Type from MS,
+ GlobalEntity from MS
+
+is
+ Create(aspecfile : Specification from WOKBuilder;
+ aname : HAsciiString from TCollection)
+ returns mutable MSEntity from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection)
+ returns mutable MSEntity from WOKBuilder;
+
+ Name(me) returns HAsciiString from TCollection;
+ ---C++: inline
+ ---C++: return const &
+ SetName(me:mutable; aname : HAsciiString from TCollection);
+
+ File(me) returns Specification from WOKBuilder;
+ ---C++: inline
+ ---C++: return const &
+ SetFile(me:mutable; aspecfile : Specification from WOKBuilder);
+
+ IsType(me; ams : MetaSchema from MS) returns Boolean from Standard;
+ IsEntity(me; ams : MetaSchema from MS) returns Boolean from Standard;
+
+ GetType(me; ams : MetaSchema from MS) returns Type from MS;
+ ---C++: return const &
+ GetGlobalEntity(me; ams : MetaSchema from MS) returns GlobalEntity from MS;
+ ---C++: return const &
+
+ IsComplete(me) returns Boolean from Standard;
+
+fields
+ myfile : Specification from WOKBuilder;
+ myname : HAsciiString from TCollection;
+end MSEntity;
--- /dev/null
+// File: WOKBuilder_MSEntity.cxx
+// Created: Mon Sep 18 15:11:49 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <sys/types.h>
+#include <time.h>
+
+
+#include <WOKBuilder_MSEntity.ixx>
+
+WOKBuilder_MSEntity::WOKBuilder_MSEntity(const Handle(WOKBuilder_Specification)& aspecfile,
+ const Handle(TCollection_HAsciiString)& aname)
+: WOKBuilder_Entity(Handle(WOKUtils_Path)()), myfile(aspecfile), myname(aname)
+{
+}
+
+WOKBuilder_MSEntity::WOKBuilder_MSEntity(const Handle(TCollection_HAsciiString)& aname)
+: WOKBuilder_Entity(Handle(WOKUtils_Path)()), myname(aname)
+{
+}
+
+void WOKBuilder_MSEntity::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+ myname = aname;
+}
+
+void WOKBuilder_MSEntity::SetFile(const Handle(WOKBuilder_Specification)& afile)
+{
+ myfile = afile;
+}
+
+Standard_Boolean WOKBuilder_MSEntity::IsType(const Handle(MS_MetaSchema)& ams) const
+{
+ if(ams.IsNull() == Standard_True) return Standard_False;
+
+ if(ams->IsDefined(myname)) return Standard_True;
+ else return Standard_False;
+}
+
+Standard_Boolean WOKBuilder_MSEntity::IsEntity(const Handle(MS_MetaSchema)& ams) const
+{
+ if(ams.IsNull() == Standard_True) return Standard_False;
+
+ if(ams->IsPackage(myname)) return Standard_True;
+ //if(ams->IsSchema(myname)) return Standard_True;
+ if(ams->IsInterface(myname)) return Standard_True;
+ //if(ams->IsEngine(myname)) return Standard_True;
+ //if(ams->IsExecutable(myname)) return Standard_True;
+ return Standard_False;
+}
+
+const Handle(MS_Type)& WOKBuilder_MSEntity::GetType(const Handle(MS_MetaSchema)& ams) const
+{
+ static Handle(MS_Type) NULLRESULT;
+ if(ams.IsNull() == Standard_True) return NULLRESULT;
+ return ams->GetType(myname);
+}
+
+const Handle(MS_GlobalEntity)& WOKBuilder_MSEntity::GetGlobalEntity(const Handle(MS_MetaSchema)& ams) const
+{
+ static Handle(MS_GlobalEntity) NULLRESULT;
+ if(ams->IsPackage(myname)) return ams->GetPackage(myname);
+ //if(ams->IsSchema(myname)) return ams->GetSchema(myname);
+ if(ams->IsInterface(myname)) return ams->GetInterface(myname);
+ //if(ams->IsEngine(myname)) return ams->GetEngine(myname);
+ //if(ams->IsExecutable(myname)) return ams->GetExecutable(myname);
+ return NULLRESULT;
+}
+
+
--- /dev/null
+// File: WOKBuilder_MSEntity.lxx
+// Created: Mon Aug 5 18:02:13 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+const Handle(TCollection_HAsciiString)& WOKBuilder_MSEntity::Name() const
+{
+ return myname;
+}
+
+const Handle(WOKBuilder_Specification)& WOKBuilder_MSEntity::File() const
+{
+ return myfile;
+}
--- /dev/null
+-- File: WOKBuilder_MSEntityHasher.cdl
+-- Created: Mon Sep 18 14:41:54 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+class MSEntityHasher from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSEntity from WOKBuilder
+is
+
+ --- Methods to be a Map Hasher
+
+ HashCode(myclass; E1 : MSEntity from WOKBuilder)
+ returns Integer from Standard;
+
+ IsEqual(myclass; E1,E2 : MSEntity from WOKBuilder)
+ returns Boolean from Standard;
+
+end MSEntityHasher;
--- /dev/null
+// File: WOKBuilder_MSEntityHasher.cxx
+// Created: Mon Sep 18 15:01:57 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_MSEntityHasher.ixx>
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+#include <WOKUtils_Path.hxx>
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+Standard_Integer WOKBuilder_MSEntityHasher::HashCode(const Handle(WOKBuilder_MSEntity)& E1)
+{
+ return WOKTools_HAsciiStringHasher::HashCode(E1->Name());
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSEntityHasher::IsEqual(const Handle(WOKBuilder_MSEntity)& E1, const Handle(WOKBuilder_MSEntity)& E2)
+{
+ return E1->Name()->IsSameString(E2->Name());
+}
--- /dev/null
+-- File: WOKBuilder_MSExtractor.cdl
+-- Created: Wed Oct 11 11:24:37 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class MSExtractor from WOKBuilder
+inherits MSTool from WOKBuilder
+
+ ---Purpose: Extracts MSEntity from MS
+
+uses
+ MSEntity from WOKBuilder,
+ MSAction from WOKBuilder,
+ MSchema from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSActionType from WOKBuilder,
+ Entity from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ MSExtractorTemplatesPtr from WOKBuilder,
+ MSExtractorExtractPtr from WOKBuilder,
+ Path from WOKUtils,
+ SearchList from WOKUtils,
+ Param from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+raises ProgramError from Standard
+is
+
+ Initialize(aname : HAsciiString from TCollection;
+ ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSExtractor from WOKBuilder;
+
+ Initialize(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable MSExtractor from WOKBuilder;
+
+ Load(me:mutable)
+ is redefined;
+
+ SetEntity(me:mutable; anentity : MSEntity from WOKBuilder);
+ Entity(me) returns MSEntity from WOKBuilder;
+
+ SetTemplateFiles(me:mutable; templates : HSequenceOfHAsciiString from TColStd);
+ TemplateFiles(me) returns HSequenceOfHAsciiString from TColStd;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is virtual;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is deferred;
+
+ Extract(me:mutable; ametaschema : MSchema from WOKBuilder;
+ anentity : MSEntity from WOKBuilder)
+ returns BuildStatus from WOKBuilder;
+
+ Extract(me:mutable; ametaschema : MSchema from WOKBuilder;
+ anentity : MSEntity from WOKBuilder;
+ amode : CString from Standard)
+ returns BuildStatus from WOKBuilder;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard
+ is redefined;
+
+fields
+ myentity : MSEntity from WOKBuilder;
+ mytemplates : HSequenceOfHAsciiString from TColStd;
+ myprefix : HAsciiString from TCollection;
+ myshared : HAsciiString from TCollection;
+ mysearchlist : SearchList from WOKUtils;
+ mytemplfunc : MSExtractorTemplatesPtr from WOKBuilder;
+ myextractfunc : MSExtractorExtractPtr from WOKBuilder;
+ myinitfunc : Address from Standard is protected;
+end MSExtractor;
--- /dev/null
+// File: WOKBuilder_MSExtractor.cxx
+// Created: Wed Aug 23 20:09:45 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_MSExtractor.ixx>
+
+#include <WOKBuilder_Compilable.hxx>
+#include <WOKBuilder_Include.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+#include <OSD_SharedLibrary.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_SearchList.hxx>
+
+//=======================================================================
+//function : WOKBuilder_MSExtractor
+//purpose :
+//=======================================================================
+ WOKBuilder_MSExtractor::WOKBuilder_MSExtractor(const Handle(TCollection_HAsciiString)& aname,
+ const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSTool(aname, WOKUtils_Param())
+{
+ myprefix = aname;
+ myshared = ashared;
+
+
+ if(searchlist.IsNull() == Standard_False)
+ {
+ Standard_Integer i;
+
+ mysearchlist = new WOKUtils_SearchList;
+ for(i=1; i<=searchlist->Length(); i++)
+ {
+ mysearchlist->AddNonPriorPath(new WOKUtils_Path(searchlist->Value(i)));
+ }
+ }
+
+ mytemplfunc = NULL;
+ myextractfunc = NULL;
+}
+
+//=======================================================================
+//function : WOKBuilder_MSExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSExtractor::WOKBuilder_MSExtractor(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_MSTool(aname, params)
+{
+ SetParams(params);
+ mytemplfunc = NULL;
+ myextractfunc = NULL;
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_MSExtractor::Load()
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(myshared.IsNull())
+ {
+ myshared = EvalToolParameter("Shared");
+
+ if(myshared.IsNull() == Standard_True)
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load"
+ << "Parameter " << astr << " could not be evaluated" << endm;
+ return;
+ }
+ }
+
+
+ Handle(WOKUtils_Path) libpath = new WOKUtils_Path(myshared);
+
+ if(!libpath->Exists())
+ {
+ libpath = Params().SearchFile(myshared);
+ if(libpath.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load"
+ << "Could not find file : " << myshared << endm;
+ }
+ }
+
+ if(myprefix.IsNull())
+ {
+ myprefix = EvalToolParameter("Name");
+
+ if(myprefix.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load" << "Parameter " << astr << " could not be evaluated" << endm;
+ return;
+ }
+ }
+
+ OSD_SharedLibrary ashared(libpath->Name()->ToCString());
+
+ if(ashared.DlOpen(OSD_RTLD_NOW) == Standard_False)
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load" << ashared.DlError() << endm;
+ return;
+ }
+
+ astr = new TCollection_HAsciiString(myprefix);
+ astr->AssignCat("_TemplatesUsed");
+
+ mytemplfunc = (WOKBuilder_MSExtractorTemplatesPtr) ashared.DlSymb(astr->ToCString());
+
+ if( mytemplfunc == NULL)
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load" << ashared.DlError() << endm;
+ return;
+ }
+
+ astr = new TCollection_HAsciiString(myprefix);
+ astr->AssignCat("_Extract");
+
+ myextractfunc = (WOKBuilder_MSExtractorExtractPtr) ashared.DlSymb(astr->ToCString());
+
+ if(myextractfunc == NULL)
+ {
+ ErrorMsg << "WOKBuilder_MSExtractor::Load" << ashared.DlError() << endm;
+ return;
+ }
+
+ if(mytemplates.IsNull())
+ {
+ Standard_Integer i;
+ Handle(TColStd_HSequenceOfAsciiString) aseq = Params().SearchDirectories();
+ mytemplates = new TColStd_HSequenceOfHAsciiString;
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ mytemplates->Append(new TCollection_HAsciiString(aseq->Value(i)));
+ }
+ }
+
+ astr = new TCollection_HAsciiString(myprefix);
+ astr->AssignCat("_Init");
+
+ myinitfunc = (Standard_Address) ashared.DlSymb(astr->ToCString());
+
+ return;
+}
+
+//=======================================================================
+//function : SetEntity
+//purpose :
+//=======================================================================
+void WOKBuilder_MSExtractor::SetEntity(const Handle(WOKBuilder_MSEntity)& anentity)
+{
+ myentity = anentity;
+}
+
+//=======================================================================
+//function : Entity
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_MSEntity) WOKBuilder_MSExtractor::Entity() const
+{
+ return myentity;
+}
+
+//=======================================================================
+//function : SetTemplateFiles
+//purpose :
+//=======================================================================
+void WOKBuilder_MSExtractor::SetTemplateFiles(const Handle(TColStd_HSequenceOfHAsciiString)& templates)
+{
+ mytemplates = templates;
+}
+
+//=======================================================================
+//function : TemplateFiles
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSExtractor::TemplateFiles() const
+{
+ return mytemplates;
+}
+
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& )
+{
+ return WOKBuilder_OutOfDate;
+}
+
+//=======================================================================
+//function : Extract
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSExtractor::Extract(const Handle(WOKBuilder_MSchema)& ametaschema,
+ const Handle(WOKBuilder_MSEntity)& anentity)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Handle(TCollection_HAsciiString) adbms;
+ Handle(WOKBuilder_HSequenceOfEntity) entityseq = new WOKBuilder_HSequenceOfEntity;
+ Handle(WOKUtils_Path) apath;
+ Handle(WOKBuilder_Entity) anent;
+
+ adbms = Params().Eval("%DBMS");
+
+ if(adbms.IsNull())
+ {
+ WarningMsg << "WOKBuilder_MSExtractor::Extract"
+ << "No DBMS profile specified : using DFLT" << endm;
+ adbms = new TCollection_HAsciiString("DFLT");
+ }
+
+ // verrue en attendant CLE
+ if(!strcmp(adbms->ToCString(), "DFLT"))
+ {
+ adbms = new TCollection_HAsciiString("CSFDB");
+ }
+
+ (*myextractfunc)(ametaschema->MetaSchema(), anentity->Name(), mytemplates, OutputDir()->Name(), aseq, adbms->ToCString());
+
+ for(Standard_Integer i=1; i<=aseq->Length(); i++)
+ {
+ apath = new WOKUtils_Path(aseq->Value(i));
+ switch(apath->Extension())
+ {
+ case WOKUtils_CXXFile:
+ anent = new WOKBuilder_Compilable(apath);
+ break;
+ case WOKUtils_HXXFile:
+ case WOKUtils_IXXFile:
+ case WOKUtils_JXXFile:
+ case WOKUtils_LXXFile:
+ case WOKUtils_GXXFile:
+ anent = new WOKBuilder_Include(apath);
+ break;
+ case WOKUtils_TemplateFile:
+ anent = new WOKBuilder_Miscellaneous(apath);
+ break;
+ default:
+ anent = new WOKBuilder_Miscellaneous(apath);
+ break;
+ }
+ entityseq->Append(anent);
+ }
+
+ SetProduction(entityseq);
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : Extract
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSExtractor::Extract(const Handle(WOKBuilder_MSchema)& ametaschema,
+ const Handle(WOKBuilder_MSEntity)& anentity,
+ const Standard_CString amode)
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Handle(WOKBuilder_HSequenceOfEntity) entityseq = new WOKBuilder_HSequenceOfEntity;
+ Handle(WOKUtils_Path) apath;
+ Handle(WOKBuilder_Entity) anent;
+
+
+ (*myextractfunc)(ametaschema->MetaSchema(), anentity->Name(), mytemplates, OutputDir()->Name(), aseq, amode);
+
+ for(Standard_Integer i=1; i<=aseq->Length(); i++)
+ {
+ apath = new WOKUtils_Path(aseq->Value(i));
+ switch(apath->Extension())
+ {
+ case WOKUtils_CXXFile:
+ anent = new WOKBuilder_Compilable(apath);
+ break;
+ case WOKUtils_HXXFile:
+ case WOKUtils_IXXFile:
+ case WOKUtils_JXXFile:
+ case WOKUtils_LXXFile:
+ case WOKUtils_GXXFile:
+ anent = new WOKBuilder_Include(apath);
+ break;
+ case WOKUtils_TemplateFile:
+ anent = new WOKBuilder_Miscellaneous(apath);
+ break;
+ default:
+ anent = new WOKBuilder_Miscellaneous(apath);
+ break;
+ }
+ entityseq->Append(anent);
+ }
+
+ SetProduction(entityseq);
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSExtractor::Execute()
+{
+ return WOKBuilder_Success;
+}
+
--- /dev/null
+// File: WOKBuilder_MSExtractorExtractPtr.hxx
+// Created: Wed Oct 11 21:33:44 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#ifndef WOKBuilder_MSExtractorExtractPtr_HeaderFile
+#define WOKBuilder_MSExtractorExtractPtr_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <MS_MetaSchema.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKBuilder_MSExtractorExtractPtr);
+
+extern "C" {
+
+typedef void (*WOKBuilder_MSExtractorExtractPtr)(const Handle(MS_MetaSchema)& ,
+ const Handle(TCollection_HAsciiString)& ,
+ const Handle(TColStd_HSequenceOfHAsciiString)& ,
+ const Handle(TCollection_HAsciiString)& ,
+ const Handle(TColStd_HSequenceOfHAsciiString)& ,
+ const Standard_CString);
+}
+
+#endif
--- /dev/null
+-- File: WOKBuilder_MSExtractorIterator.cdl
+-- Created: Wed Oct 11 11:39:03 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSExtractorIterator from WOKBuilder
+
+ ---Purpose: Manages Extraction of a MSEntity
+
+uses
+ MSchema from WOKBuilder,
+ MSEntity from WOKBuilder,
+ MSExtractor from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ HSequenceOfHAsciiString from TColStd
+is
+ Create(ams : MSchema from WOKBuilder;
+ anext : MSExtractor from WOKBuilder)
+ returns MSExtractorIterator from WOKBuilder;
+
+ Execute(me:out; anentity : MSEntity from WOKBuilder) returns BuildStatus from WOKBuilder;
+
+ Execute(me:out; anentity : MSEntity from WOKBuilder; amode : CString from Standard)
+ returns BuildStatus from WOKBuilder;
+
+ Produces(me)
+ returns HSequenceOfEntity from WOKBuilder;
+
+fields
+ mymeta : MSchema from WOKBuilder;
+ myextractor : MSExtractor from WOKBuilder;
+ myproduction : HSequenceOfEntity from WOKBuilder;
+end MSExtractorIterator;
--- /dev/null
+// File: WOKBuilder_MSExtractorIterator.cxx
+// Created: Wed Oct 11 16:09:50 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_MSExtractorIterator.ixx>
+
+//=======================================================================
+//function : WOKBuilder_MSExtractorIterator
+//purpose :
+//=======================================================================
+ WOKBuilder_MSExtractorIterator::WOKBuilder_MSExtractorIterator(const Handle(WOKBuilder_MSchema)& ams,
+ const Handle(WOKBuilder_MSExtractor)& anext)
+{
+ mymeta = ams;
+ myextractor = anext;
+ myextractor->SetMSchema(ams);
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSExtractorIterator::Execute(const Handle(WOKBuilder_MSEntity)& anentity)
+{
+ WOKBuilder_BuildStatus status;
+
+ myproduction.Nullify();
+
+ myextractor->SetEntity(anentity);
+
+ InfoMsg << "WOKBuilder_MSExtractorIterator::Execute" << "Extracting " << anentity->Name() << endm;
+
+ status = myextractor->Extract(mymeta, anentity);
+ myproduction = myextractor->Produces();
+
+ return status;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSExtractorIterator::Execute(const Handle(WOKBuilder_MSEntity)& anentity,
+ const Standard_CString amode)
+{
+ WOKBuilder_BuildStatus status;
+
+ myproduction.Nullify();
+
+ myextractor->SetEntity(anentity);
+
+ InfoMsg << "WOKBuilder_MSExtractorIterator::Execute" << "Extracting " << anentity->Name() << endm;
+
+ status = myextractor->Extract(mymeta, anentity, amode);
+ myproduction = myextractor->Produces();
+
+ return status;
+}
+
+//=======================================================================
+//function : Produces
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_MSExtractorIterator::Produces() const
+{
+ return myproduction;
+}
+
+
--- /dev/null
+// File: WOKBuilder_MSExtractorTemplatesPtr.hxx
+// Created: Wed Oct 11 21:30:08 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#ifndef WOKBuilder_MSExtractorTemplatesPtr_HeaderFile
+#define WOKBuilder_MSExtractorTemplatesPtr_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKBuilder_MSExtractorTemplatesPtr);
+
+extern "C" {
+
+typedef Handle(TColStd_HSequenceOfHAsciiString) (*WOKBuilder_MSExtractorTemplatesPtr)();
+
+}
+
+#endif
--- /dev/null
+-- File: WOKBuilder_MSHeaderExtractor.cdl
+-- Created: Tue Mar 19 19:26:26 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class MSHeaderExtractor from WOKBuilder
+inherits MSExtractor from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSActionStatus from WOKBuilder,
+ MSActionType from WOKBuilder,
+ MSAction from WOKBuilder,
+ Param from WOKUtils,
+ TimeStat from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+is
+
+ Create(ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSHeaderExtractor from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable MSHeaderExtractor from WOKBuilder;
+
+ Create(params : Param from WOKUtils)
+ returns mutable MSHeaderExtractor from WOKBuilder;
+
+ GetTypeDepList(me; atype : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd
+ is protected;
+
+ GetTypeMDate(me; atype : HAsciiString from TCollection)
+ returns TimeStat from WOKUtils;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is redefined;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is redefined;
+
+end MSHeaderExtractor;
--- /dev/null
+// File: WOKBuilder_MSHeaderExtractor.cxx
+// Created: Tue Mar 19 20:15:33 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Pointer.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Error.hxx>
+#include <MS_Package.hxx>
+#include <MS.hxx>
+
+
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_MapOfHAsciiString.hxx>
+
+#include <WOKBuilder_MSActionID.hxx>
+#include <WOKBuilder_MSAction.hxx>
+#include <WOKBuilder_MSEntity.hxx>
+#include <WOKBuilder_MSchema.hxx>
+
+#include <WOKBuilder_MSHeaderExtractor.ixx>
+
+
+
+//=======================================================================
+//function : WOKBuilder_MSHeaderExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSHeaderExtractor::WOKBuilder_MSHeaderExtractor(const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPP"), ashared, searchlist)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSHeaderExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSHeaderExtractor::WOKBuilder_MSHeaderExtractor(const WOKUtils_Param& params)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPP"), params)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSHeaderExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSHeaderExtractor::WOKBuilder_MSHeaderExtractor(const Handle(TCollection_HAsciiString)& aname, const WOKUtils_Param& params)
+ : WOKBuilder_MSExtractor(aname, params)
+{
+}
+
+//=======================================================================
+//function : GetTypeDepList
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSHeaderExtractor::GetTypeDepList(const Handle(TCollection_HAsciiString)& aname) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) aList = new TColStd_HSequenceOfHAsciiString;
+ Handle(TCollection_HAsciiString) astr;
+ Handle(MS_MetaSchema) ameta = MSchema()->MetaSchema();
+ Handle(MS_Type) atype;
+ Standard_Integer i;
+
+ result->Append(aname);
+
+ if(ameta->IsPackage(aname))
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << "Package not yet Implemented : Out of date" << endm;
+ }
+ return result;
+ }
+
+ atype = ameta->GetType(aname);
+
+ if(atype.IsNull())
+ {
+ Handle(MS_Package) apk = ameta->GetPackage(aname);
+
+ if(apk.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << aname << " is not a known package and not a known type" << endm;
+ return result;
+ }
+ }
+
+ if(atype->IsKind(STANDARD_TYPE(MS_Class)))
+ {
+ Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(atype);
+
+ if(!aclass->IsKind(STANDARD_TYPE(MS_GenClass)))
+ {
+ MS::ClassUsedTypes(ameta, aclass, aList, aList);
+
+ if(atype->IsKind(STANDARD_TYPE(MS_StdClass)))
+ {
+ Handle(MS_StdClass) msclass = Handle(MS_StdClass)::DownCast(atype);
+
+ if(!msclass->GetMyCreator().IsNull())
+ {
+ // instantiation
+ result->Append(MSchema()->AssociatedEntity(aname));
+ }
+ if(atype->IsKind(STANDARD_TYPE(MS_Error)))
+ {
+ // exception
+ result->Append(MSchema()->AssociatedEntity(aname));
+ }
+ }
+
+ WOKTools_MapOfHAsciiString amap;
+
+ for(i=1; i<=aList->Length(); i++)
+ {
+ astr = aList->Value(i);
+ if(!strncmp("Handle_", aList->Value(i)->ToCString(), strlen("Handle_")))
+ {
+ astr = astr->SubString(strlen("Handle_")+1, astr->Length());
+ }
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ result->Append(astr);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(atype->IsKind(STANDARD_TYPE(MS_Pointer)))
+ {
+ Handle(MS_Pointer) apointer = Handle(MS_Pointer)::DownCast(atype);
+
+ result->Append(apointer->Type());
+ }
+ else
+ {
+ if(atype->IsKind(STANDARD_TYPE(MS_Alias)))
+ {
+ Handle(MS_Alias) analias = Handle(MS_Alias)::DownCast(atype);
+
+ result->Append(analias->Type());
+ }
+ }
+ }
+ return result;
+}
+
+//=======================================================================
+//function : GetTypeMDate
+//purpose :
+//=======================================================================
+WOKUtils_TimeStat WOKBuilder_MSHeaderExtractor::GetTypeMDate(const Handle(TCollection_HAsciiString)& aname) const
+{
+
+ if(MSchema()->MetaSchema()->IsPackage(aname))
+ {
+ WOKBuilder_MSActionID anid(aname, WOKBuilder_TypeModified);
+ return MSchema()->GetAction(anid)->Date();
+ }
+
+ Handle(MS_Type) atype = MSchema()->MetaSchema()->GetType(aname);
+
+ if(atype->IsKind(STANDARD_TYPE(MS_NatType)))
+ {
+ Handle(TCollection_HAsciiString) astr = MSchema()->AssociatedEntity(aname);
+
+ WOKBuilder_MSActionID anid(astr, WOKBuilder_TypeModified);
+ return MSchema()->GetAction(anid)->Date();
+ }
+ else
+ {
+
+ if(atype->IsKind(STANDARD_TYPE(MS_Class)))
+ {
+ Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(atype);
+
+ if(aclass->IsNested())
+ {
+ return GetTypeMDate(aclass->GetNestingClass());
+ }
+ else
+ {
+ if(atype->IsKind(STANDARD_TYPE(MS_StdClass)))
+ {
+ Handle(MS_StdClass) msclass = Handle(MS_StdClass)::DownCast(atype);
+
+ if(!msclass->GetMyCreator().IsNull())
+ {
+ // instantiation
+ Handle(MS_InstClass) instclass = msclass->GetMyCreator();
+
+ return GetTypeMDate(instclass->GenClass());
+ }
+ if(atype->IsKind(STANDARD_TYPE(MS_Error)))
+ {
+ // exception
+ Handle(TCollection_HAsciiString) astr = MSchema()->AssociatedEntity(aname);
+
+ WOKBuilder_MSActionID anid(astr, WOKBuilder_TypeModified);
+ return MSchema()->GetAction(anid)->Date();
+ }
+ }
+
+ }
+ }
+ WOKBuilder_MSActionID anid(aname, WOKBuilder_TypeModified);
+ return MSchema()->GetAction(anid)->Date();
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExtractorID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSHeaderExtractor::ExtractorID() const
+{
+ return WOKBuilder_HeaderExtract;
+}
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSHeaderExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& anaction)
+{
+ Handle(TCollection_HAsciiString) astr;
+ Handle(TColStd_HSequenceOfHAsciiString) aList;
+ Standard_Integer i;
+
+ WOKBuilder_MSActionID anid(anaction->Entity()->Name(), anaction->Type());
+
+ if(!MSchema()->IsActionDefined(anid)) return WOKBuilder_OutOfDate;
+
+ aList = GetTypeDepList(anaction->Entity()->Name());
+
+ for(i=1; i<=aList->Length(); i++)
+ {
+ astr = aList->Value(i);
+
+ WOKUtils_TimeStat depdate = GetTypeMDate(astr);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << "Comparing extraction date : " << (Standard_Integer) anaction->Date() << " of " << anaction->Entity()->Name() << endm;
+
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << "with modification date : " << (Standard_Integer) depdate << " of " << astr << endm;
+ }
+
+ if( GetTypeMDate(astr) > anaction->Date())
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is out of date compared to " << astr << endm;
+ }
+ return WOKBuilder_OutOfDate;
+ }
+ else
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is up to date compared to : " << astr << endm;
+ }
+ }
+ }
+
+ WOK_TRACE {
+ VerboseMsg("WOK_EXTRACT") << "WOKBuilder_MSHeaderExtractor::ExtractionStatus"
+ << anaction->Entity()->Name() << " is up to date" << endm;
+ }
+
+ return WOKBuilder_UpToDate;
+}
+
--- /dev/null
+-- File: WOKBuilder_MSServerExtractor.cdl
+-- Created: Tue Mar 19 19:33:36 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class MSServerExtractor from WOKBuilder
+inherits MSExtractor from WOKBuilder
+ ---Purpose:
+
+uses
+ MSActionStatus from WOKBuilder,
+ MSActionType from WOKBuilder,
+ MSAction from WOKBuilder,
+ Param from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+is
+
+ Create(ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSServerExtractor from WOKBuilder;
+
+ Create(params : Param from WOKUtils)
+ returns mutable MSServerExtractor from WOKBuilder;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is redefined;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is redefined;
+
+end MSServerExtractor;
--- /dev/null
+// File: WOKBuilder_MSServerExtractor.cxx
+// Created: Tue Mar 19 20:49:35 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKBuilder_MSServerExtractor.ixx>
+
+//=======================================================================
+//function : WOKBuilder_MSServerExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSServerExtractor::WOKBuilder_MSServerExtractor(const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPPINT"), ashared, searchlist)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSServerExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSServerExtractor::WOKBuilder_MSServerExtractor(const WOKUtils_Param& params)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("CPPINT"), params)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExtractorID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSServerExtractor::ExtractorID() const
+{
+ return WOKBuilder_ServerExtract;
+}
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSServerExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& )
+{
+ return WOKBuilder_OutOfDate;
+}
+
--- /dev/null
+-- File: WOKBuilder_MSTemplateExtractor.cdl
+-- Created: Tue Mar 19 20:10:51 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class MSTemplateExtractor from WOKBuilder
+inherits MSExtractor from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSActionType from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSAction from WOKBuilder,
+ Param from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+is
+
+ Create(ashared : HAsciiString from TCollection;
+ searchlist : HSequenceOfHAsciiString from TColStd)
+ returns mutable MSTemplateExtractor from WOKBuilder;
+
+ Create(params : Param from WOKUtils)
+ returns mutable MSTemplateExtractor from WOKBuilder;
+
+ ExtractorID(me)
+ returns MSActionType from WOKBuilder
+ is redefined;
+
+ ExtractionStatus(me:mutable; anaction : MSAction from WOKBuilder)
+ returns MSActionStatus from WOKBuilder
+ is redefined;
+
+
+end MSTemplateExtractor;
--- /dev/null
+// File: WOKBuilder_MSTemplateExtractor.cxx
+// Created: Tue Mar 19 20:48:23 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKBuilder_MSTemplateExtractor.ixx>
+
+//=======================================================================
+//function : WOKBuilder_MSTemplateExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSTemplateExtractor::WOKBuilder_MSTemplateExtractor(const Handle(TCollection_HAsciiString)& ashared,
+ const Handle(TColStd_HSequenceOfHAsciiString)& searchlist)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("TCPP"), ashared, searchlist)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_MSTemplateExtractor
+//purpose :
+//=======================================================================
+WOKBuilder_MSTemplateExtractor::WOKBuilder_MSTemplateExtractor(const WOKUtils_Param& params)
+ : WOKBuilder_MSExtractor(new TCollection_HAsciiString("TCPP"), params)
+{
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ExtractorID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionType WOKBuilder_MSTemplateExtractor::ExtractorID() const
+{
+ return WOKBuilder_TemplateExtract;
+}
+
+//=======================================================================
+//function : ExtractionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSTemplateExtractor::ExtractionStatus(const Handle(WOKBuilder_MSAction)& )
+{
+ return WOKBuilder_OutOfDate;
+}
+
--- /dev/null
+-- File: WOKBuilder_MSTool.cdl
+-- Created: Mon Sep 11 10:52:23 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class MSTool from WOKBuilder
+inherits ToolInProcess from WOKBuilder
+
+ ---Purpose:
+
+uses
+ MSchema from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ Param from WOKUtils,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+
+is
+ Initialize(aname : HAsciiString from TCollection; params : Param from WOKUtils);
+
+ GetMSchema(myclass) returns mutable MSchema from WOKBuilder;
+
+ SetMSchema(me:mutable; aschema : MSchema from WOKBuilder);
+ MSchema(me) returns MSchema from WOKBuilder;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard
+ is redefined;
+
+
+fields
+ myschema : MSchema from WOKBuilder;
+end MSTool;
--- /dev/null
+// File: WOKBuilder_MSTool.cxx
+// Created: Mon Sep 11 13:29:29 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_MSTool.ixx>
+
+
+//=======================================================================
+//function : WOKBuilder_MSTool
+//purpose :
+//=======================================================================
+WOKBuilder_MSTool::WOKBuilder_MSTool(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_ToolInProcess(aname,params)
+{
+}
+
+//=======================================================================
+//function : MetaSchema
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_MSchema) WOKBuilder_MSTool::GetMSchema()
+{
+ static Handle(WOKBuilder_MSchema) thems = new WOKBuilder_MSchema;
+
+ return thems;
+}
+
+//=======================================================================
+//function : SetMSchema
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTool::SetMSchema(const Handle(WOKBuilder_MSchema)& ams)
+{
+ myschema = ams;
+}
+
+
+
+//=======================================================================
+//function : MetaSchema
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_MSchema) WOKBuilder_MSTool::MSchema() const
+{
+ return myschema;
+}
+
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTool::Execute()
+{
+ return WOKBuilder_Success;
+}
--- /dev/null
+-- File: WOKBuilder_MSTranslator.cdl
+-- Created: Mon Sep 11 10:55:53 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSTranslator from WOKBuilder
+inherits MSTool from WOKBuilder
+ ---Purpose: Translates a file to fill MetaSchema
+
+uses
+ Entity from WOKBuilder,
+ MSEntity from WOKBuilder,
+ MSchema from WOKBuilder,
+ Specification from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ MSTranslatorPtr from WOKBuilder,
+ MSAction from WOKBuilder,
+ MSActionType from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ MSTranslatorIterator from WOKBuilder,
+ MetaSchema from MS,
+ HSequenceOfGlobalEntity from MS,
+ HSequenceOfType from MS,
+ HSequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection,
+ Path from WOKUtils,
+ Param from WOKUtils
+raises ProgramError from Standard
+is
+ Create(aname, ashared : HAsciiString from TCollection) returns mutable MSTranslator from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable MSTranslator from WOKBuilder;
+
+ Load(me:mutable)
+ is redefined;
+
+ MSActionStatus(me; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder)
+ returns MSActionStatus from WOKBuilder;
+
+ Translate(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ globlist : out HSequenceOfHAsciiString from TColStd;
+ inctypes : out HSequenceOfHAsciiString from TColStd;
+ insttypes : out HSequenceOfHAsciiString from TColStd;
+ gentypes : out HSequenceOfHAsciiString from TColStd
+ ) returns BuildStatus from WOKBuilder is private;
+
+ AddAction(me:mutable; anit : out MSTranslatorIterator from WOKBuilder;
+ aname : HAsciiString from TCollection;
+ anaction : MSActionType from WOKBuilder);
+
+ BuildPackage(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildSchema(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildInterface(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildClient(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildEngine(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildExecutable(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildComponent(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildDirectUses(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildSchUses(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildUses(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildGlobEnt(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildInstantiate(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildInterfaceTypes(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildSchemaTypes(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildPackageMethods(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildInstToStd(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildCompleteType(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildSchemaType(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildTypeUsed(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildInherits(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ BuildGenClass(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ returns BuildStatus from WOKBuilder is private;
+
+ Execute(me:mutable; anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder;
+ anit : out MSTranslatorIterator from WOKBuilder)
+ ---Purpose: Executes an action
+ -- and updates Iterator and MSchema
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard;
+
+fields
+ mytranslator : MSTranslatorPtr from WOKBuilder;
+ myspecfile : Specification from WOKBuilder;
+end MSTranslator;
--- /dev/null
+// File: WOKBuilder_MSTranslator.cxx
+// Created: Mon Sep 11 13:45:33 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <Standard_ProgramError.hxx>
+
+#include <OSD_SharedLibrary.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <MS.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_HSequenceOfInstClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_Error.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Pointer.hxx>
+#include <MS_Package.hxx>
+#include <MS_Interface.hxx>
+#include <MS_Client.hxx>
+#include <MS_Schema.hxx>
+#include <MS_Engine.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_Param.hxx>
+#include <MS_HArray1OfParam.hxx>
+
+#include <WOKBuilder_MSEntity.hxx>
+#include <WOKBuilder_MSTool.hxx>
+#include <WOKBuilder_MSchema.hxx>
+#include <WOKBuilder_MSActionID.hxx>
+
+#include <WOKBuilder_MSTranslator.ixx>
+
+#include <sys/types.h>
+#include <time.h>
+
+
+//=======================================================================
+//function : WOKBuilder_MSTranslator
+//purpose :
+//=======================================================================
+ WOKBuilder_MSTranslator::WOKBuilder_MSTranslator(const Handle(TCollection_HAsciiString)& aname,
+ const Handle(TCollection_HAsciiString)& ashared)
+ : WOKBuilder_MSTool(aname, WOKUtils_Param())
+{
+ SetShared(ashared);
+ mytranslator = NULL;
+}
+
+//=======================================================================
+//function : WOKBuilder_MSTranslator
+//purpose :
+//=======================================================================
+WOKBuilder_MSTranslator::WOKBuilder_MSTranslator(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_MSTool(aname, params)
+{
+ mytranslator = NULL;
+}
+
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTranslator::Load()
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(Shared().IsNull())
+ {
+ SetShared(EvalToolParameter("SHARED"));
+
+ if(Shared().IsNull() == Standard_True)
+ {
+ return;
+ }
+ }
+
+ Handle(WOKUtils_Path) libpath = new WOKUtils_Path(Shared());
+
+ if(!libpath->Exists())
+ {
+ libpath = Params().SearchFile(Shared());
+
+ if(libpath.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::Load"
+ << "Could not find file : " << Shared() << endm;
+ return;
+ }
+ }
+
+ OSD_SharedLibrary ashared(libpath->Name()->ToCString());
+
+ if(ashared.DlOpen(OSD_RTLD_NOW) == Standard_False)
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::Load" << ashared.DlError() << endm;
+ return;
+ }
+
+ mytranslator = (WOKBuilder_MSTranslatorPtr) ashared.DlSymb(Name()->ToCString());
+
+ if( mytranslator == NULL)
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::Load" << ashared.DlError() << endm;
+ return;
+ }
+
+}
+
+//=======================================================================
+//function : MSActionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSTranslator::MSActionStatus(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& anewcdl) const
+{
+ WOKBuilder_MSActionID anid(anaction->Entity()->Name(), anaction->Type());
+
+ switch(MSchema()->GetActionStatus(anid))
+ {
+ case WOKBuilder_HasFailed:
+ return WOKBuilder_OutOfDate;
+
+ case WOKBuilder_NotDefined:
+ case WOKBuilder_OutOfDate:
+ case WOKBuilder_UpToDate:
+ if(!MSchema()->IsDefined(anid.Name()))
+ {
+ return WOKBuilder_NotDefined;
+ }
+ else
+ {
+ Handle(WOKBuilder_MSAction) oldaction = MSchema()->GetAction(anid);
+
+ switch(anid.Type())
+ {
+ case WOKBuilder_CompleteType:
+ case WOKBuilder_SchemaType:
+ case WOKBuilder_GenType:
+ case WOKBuilder_TypeUses:
+ case WOKBuilder_Inherits:
+ {
+ const Handle(MS_Type)& atype = MSchema()->MetaSchema()->GetType(anid.Name());
+ Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(atype);
+
+ if(!aclass.IsNull())
+ {
+ if(aclass->IsNested() ||atype->IsKind(STANDARD_TYPE(MS_Error))) return WOKBuilder_UpToDate;
+ }
+ else
+ {
+ if(atype->IsKind(STANDARD_TYPE(MS_NatType))) return WOKBuilder_UpToDate;
+ }
+ }
+
+ case WOKBuilder_Package:
+ case WOKBuilder_Schema:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Engine:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_DirectUses:
+ case WOKBuilder_Uses:
+ case WOKBuilder_SchUses :
+ case WOKBuilder_GlobEnt:
+ {
+ Handle(WOKBuilder_Specification) oldspec = oldaction->Entity()->File();
+
+ if(!oldspec.IsNull())
+ {
+ if(!oldspec->Path()->Name()->IsSameString(anewcdl->Path()->Name()))
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus"
+ << anaction->Entity()->Name() << " is OutofDate because files are not the same" << endm;
+ }
+ return WOKBuilder_OutOfDate;
+ }
+ else
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus"
+ << "NewFile : " << anewcdl->Path()->Name() << " is same than old : "
+ << oldspec->Path()->Name() << endm;
+ }
+ }
+ }
+
+ if(anewcdl->Path()->MDate() > oldaction->Date())
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus"
+ << anaction->Entity()->Name() << "is OutOfDate because of dates : "
+ << "stored(" << (Standard_Integer) oldaction->Date() << ") file(" << (Standard_Integer) anewcdl->Path()->MDate() << ")" << endm;
+ }
+ return WOKBuilder_OutOfDate;
+ }
+ else
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus"
+ << anaction->Entity()->Name() << " is up to date : "
+ << "stored(" << (Standard_Integer) oldaction->Date() << ") file(" << (Standard_Integer) anewcdl->Path()->MDate() << ")" << endm;
+ }
+ }
+ }
+ break;
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_InstToStd:
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_PackageMethods:
+ break;
+ default:
+ ErrorMsg << "WOKBuilder_MSTranslator::MSActionStatus"
+ << "Unknown action type : " << anid.Type() << endm;
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslator::MSActionStatus : Unknown action type");
+ break;
+ }
+ }
+ }
+ return WOKBuilder_UpToDate;
+}
+
+//=======================================================================
+//function : Translate
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::Translate(const Handle(WOKBuilder_MSAction)& ,
+ const Handle(WOKBuilder_Specification)& afile,
+ Handle(TColStd_HSequenceOfHAsciiString)& globlist,
+ Handle(TColStd_HSequenceOfHAsciiString)& unkowntypelist,
+ Handle(TColStd_HSequenceOfHAsciiString)& instlist,
+ Handle(TColStd_HSequenceOfHAsciiString)& genlist)
+{
+ if(mytranslator == NULL)
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::Translate" << "Null Translator : Cannot Perform" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ globlist = new TColStd_HSequenceOfHAsciiString;
+ unkowntypelist = new TColStd_HSequenceOfHAsciiString;
+ instlist = new TColStd_HSequenceOfHAsciiString;
+ genlist = new TColStd_HSequenceOfHAsciiString;
+
+ if((*mytranslator)(MSchema()->MetaSchema(),afile->Path()->Name(),globlist,unkowntypelist,instlist,genlist))
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::Translate" << "Errors occured" << endm;
+ return WOKBuilder_Failed;
+ }
+ return WOKBuilder_Success;
+}
+
+
+void WOKBuilder_MSTranslator::AddAction(WOKBuilder_MSTranslatorIterator& anit,
+ const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType action)
+{
+ if(action != WOKBuilder_InstToStd)
+ {
+ anit.AddInStack(aname,action);
+ }
+ else
+ {
+ anit.AddInStack(aname,action);
+
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(MSchema()->MetaSchema()->GetType(aname));
+
+ if(!instclass.IsNull())
+ {
+ // les ajouts ne sont necessaires que si la class est a insttostd
+ // : Traduire la generique si l'instclass doir etre InstToStd
+ anit.AddInStack(instclass->GenClass(), WOKBuilder_GenType);
+ }
+ }
+}
+
+
+//=======================================================================
+//function : BuildPackage
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildPackage(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ Standard_Integer i;
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSTranslator::BuildPackage"
+ << "Package : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_DirectUses);
+
+ for(i=1; i<=gentypes->Length(); i++)
+ {
+ AddAction(anit,gentypes->Value(i), WOKBuilder_GenType);
+ AddAction(anit,gentypes->Value(i), WOKBuilder_CompleteType);
+ }
+ for(i=1; i<=insttypes->Length(); i++)
+ {
+ AddAction(anit,insttypes->Value(i), WOKBuilder_Instantiate);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_InstToStd);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_CompleteType);
+ }
+ for(i=1; i<=inctypes->Length(); i++)
+ {
+ AddAction(anit,inctypes->Value(i), WOKBuilder_CompleteType);
+ }
+
+ Handle(MS_Package) thepk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+ Handle(TColStd_HSequenceOfHAsciiString) expects = thepk->Excepts();
+ Handle(TCollection_HAsciiString) fullname;
+
+ for(i=1; i<=expects->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), expects->Value(i));
+ AddAction(anit,fullname, WOKBuilder_CompleteType);
+ }
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_PackageMethods);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ Handle(MS_Package) thepk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+
+ Handle(TColStd_HSequenceOfHAsciiString) uses = thepk->Uses();
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_DirectUses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = thepk->Classes();
+ Handle(TCollection_HAsciiString) fullname;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ Handle(MS_StdClass) stdclass;
+
+ // les classes
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), classes->Value(i));
+
+ if(ameta->IsDefined(fullname))
+ {
+ Handle(MS_Type) atype = ameta->GetType(fullname);
+
+ if(atype->IsKind(STANDARD_TYPE(MS_InstClass)))
+ {
+ if(!Handle(MS_Class)::DownCast(atype)->IsNested())
+ {
+ AddAction(anit,fullname, WOKBuilder_Instantiate);
+ AddAction(anit,fullname, WOKBuilder_InstToStd);
+ AddAction(anit,fullname, WOKBuilder_CompleteType);
+ }
+ }
+ else if(atype->IsKind(STANDARD_TYPE(MS_GenClass)))
+ {
+ if(!Handle(MS_Class)::DownCast(atype)->IsNested())
+ {
+ AddAction(anit,fullname, WOKBuilder_GenType);
+ AddAction(anit,fullname, WOKBuilder_CompleteType);
+ }
+ }
+ else
+ {
+ stdclass = Handle(MS_StdClass)::DownCast(atype);
+ if(!stdclass.IsNull())
+ if(!stdclass->IsNested())
+ AddAction(anit,fullname, WOKBuilder_CompleteType);
+ }
+ }
+ else
+ {
+ WarningMsg << "WOKBuilder_MSTranslator::BuildPackage"
+ << "Type " << fullname << " is not defined" << endm;
+ //MSchema()->ChangeActionToFailed(theid);
+ //return WOKBuilder_Failed;
+ }
+ }
+
+ // les alias
+
+ Handle(TColStd_HSequenceOfHAsciiString) aliases = thepk->Aliases();
+ Handle(MS_Alias) analias;
+
+ for(i=1; i <= aliases->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), aliases->Value(i));
+ analias = Handle(MS_Alias)::DownCast(ameta->GetType(fullname));
+ AddAction(anit,analias->Type(), WOKBuilder_Inherits);
+ }
+
+ // les pointeurs
+
+
+ Handle(TColStd_HSequenceOfHAsciiString) pointers = thepk->Pointers();
+ Handle(MS_Pointer) apointer;
+
+ for(i=1; i <= pointers->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), pointers->Value(i));
+ apointer = Handle(MS_Pointer)::DownCast(ameta->GetType(fullname));
+ AddAction(anit,apointer->Type(), WOKBuilder_Inherits);
+ }
+
+ // les exceptions
+
+ Handle(TColStd_HSequenceOfHAsciiString) expects = thepk->Excepts();
+
+ for(i=1; i<=expects->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), expects->Value(i));
+ AddAction(anit,fullname, WOKBuilder_CompleteType);
+ }
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_PackageMethods);
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildSchema
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildSchema(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Schema : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_SchUses);
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_SchemaTypes);
+
+ const Handle(MS_Schema)& aschema = MSchema()->MetaSchema()->GetSchema(anaction->Entity()->Name());
+ Handle(TColStd_HSequenceOfHAsciiString) packages = aschema->GetPackages();
+
+ for(i=1; i<=packages->Length(); i++)
+ AddAction(anit,packages->Value(i), WOKBuilder_SchUses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = aschema->GetClasses();
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ AddAction(anit,MSchema()->AssociatedEntity(classes->Value(i)), WOKBuilder_SchUses);
+ AddAction(anit,classes->Value(i), WOKBuilder_SchemaType);
+ }
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Schema)& aschema = MSchema()->MetaSchema()->GetSchema(anaction->Entity()->Name());
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_SchemaTypes);
+
+ Handle(TColStd_HSequenceOfHAsciiString) packages = aschema->GetPackages();
+ for(i=1; i<=packages->Length(); i++)
+ AddAction(anit,packages->Value(i), WOKBuilder_SchUses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = aschema->GetClasses();
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ AddAction(anit,MSchema()->AssociatedEntity(classes->Value(i)), WOKBuilder_SchUses);
+ AddAction(anit,classes->Value(i), WOKBuilder_SchemaType);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return WOKBuilder_Success;
+}
+
+
+//=======================================================================
+//function : BuildInterface
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildInterface(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Interface : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_Package);
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_InterfaceTypes);
+
+ const Handle(MS_Interface)& aninter = MSchema()->MetaSchema()->GetInterface(anaction->Entity()->Name());
+ Handle(TColStd_HSequenceOfHAsciiString) packages = aninter->Packages();
+ for(i=1; i<=packages->Length(); i++)
+ AddAction(anit,packages->Value(i), WOKBuilder_Package);
+
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Interface)& aninter = MSchema()->MetaSchema()->GetInterface(anaction->Entity()->Name());
+
+ for(i=1; i<=aninter->Uses()->Length(); i++)
+ AddAction(anit,aninter->Uses()->Value(i), WOKBuilder_Package);
+
+ AddAction(anit,anaction->Entity()->Name(), WOKBuilder_InterfaceTypes);
+
+ Handle(TColStd_HSequenceOfHAsciiString) packages = aninter->Packages();
+ for(i=1; i<=packages->Length(); i++)
+ AddAction(anit,packages->Value(i), WOKBuilder_Package);
+ }
+ break;
+ default:
+ break;
+ }
+ return WOKBuilder_Success;
+}
+
+
+//=======================================================================
+//function : BuildClient
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildClient(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Client : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ const Handle(MS_Client)& aclient = MSchema()->MetaSchema()->GetClient(anaction->Entity()->Name());
+ Handle(TColStd_HSequenceOfHAsciiString) interfaces = aclient->Interfaces();
+ for(i=1; i<=interfaces->Length(); i++)
+ AddAction(anit,interfaces->Value(i), WOKBuilder_Interface);
+
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Client)& aclient = MSchema()->MetaSchema()->GetClient(anaction->Entity()->Name());
+
+ Handle(TColStd_HSequenceOfHAsciiString) interfaces = aclient->Interfaces();
+ for(i=1; i<=interfaces->Length(); i++)
+ AddAction(anit,interfaces->Value(i), WOKBuilder_Interface);
+ }
+ break;
+ default:
+ break;
+ }
+ return WOKBuilder_Success;
+}
+
+
+//=======================================================================
+//function : BuildEngine
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildEngine(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSTranslator::BuildEngine"
+ << "Engine : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ {
+ if(strcmp("Standard", uses->Value(i)->ToCString()))
+ AddAction(anit,uses->Value(i), WOKBuilder_Interface);
+ }
+
+ AddAction(anit,new TCollection_HAsciiString("EngineInterface"), WOKBuilder_Interface);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Engine)& aneng = MSchema()->MetaSchema()->GetEngine(anaction->Entity()->Name());
+
+ for(i=1; i<=aneng->Interfaces()->Length(); i++)
+ {
+ AddAction(anit,aneng->Interfaces()->Value(i), WOKBuilder_Interface);
+ }
+
+ AddAction(anit,new TCollection_HAsciiString("EngineInterface"), WOKBuilder_Interface);
+ }
+ break;
+ default:
+ break;
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildDirectUses
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildSchUses(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSTranslator::BuildDirectUses"
+ << "Sch Uses : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid,afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_SchUses);
+
+ for(i=1; i<=insttypes->Length(); i++)
+ {
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(MSchema()->MetaSchema()->GetType(insttypes->Value(i)));
+ if(!instclass.IsNull())
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_Instantiate);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_InstToStd);
+ }
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Package)& thepk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+
+ Handle(TColStd_HSequenceOfHAsciiString) uses = thepk->Uses();
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_SchUses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = thepk->Classes();
+ Handle(TCollection_HAsciiString) fullname;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ Handle(MS_Type) atype;
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), classes->Value(i));
+
+ atype = ameta->GetType(fullname);
+
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(atype);
+ if(!instclass.IsNull())
+ {
+ if(!instclass->IsNested())
+ {
+ AddAction(anit,fullname, WOKBuilder_Instantiate);
+ AddAction(anit,fullname, WOKBuilder_InstToStd);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+
+//=======================================================================
+//function : BuildDirectUses
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildDirectUses(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSTranslator::BuildDirectUses"
+ << "Direct use : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid,afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_Uses);
+
+ for(i=1; i<=insttypes->Length(); i++)
+ {
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(MSchema()->MetaSchema()->GetType(insttypes->Value(i)));
+ if(!instclass.IsNull())
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_Instantiate);
+ AddAction(anit,insttypes->Value(i), WOKBuilder_InstToStd);
+ }
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Package)& thepk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+
+ Handle(TColStd_HSequenceOfHAsciiString) uses = thepk->Uses();
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_Uses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = thepk->Classes();
+ Handle(TCollection_HAsciiString) fullname;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ Handle(MS_Type) atype;
+ Handle(MS_InstClass) instclass;
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), classes->Value(i));
+
+ atype = ameta->GetType(fullname);
+ if(atype->IsKind(STANDARD_TYPE(MS_InstClass)))
+ {
+ instclass = Handle(MS_InstClass)::DownCast(atype);
+
+ if(!instclass->IsNested())
+ {
+ AddAction(anit,fullname, WOKBuilder_Instantiate);
+ AddAction(anit,fullname, WOKBuilder_InstToStd);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+
+
+
+//=======================================================================
+//function : BuildUses
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildUses(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Used : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_Uses);
+ for(i=1; i<=insttypes->Length(); i++)
+ AddAction(anit,insttypes->Value(i), WOKBuilder_Instantiate);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Package)& thepk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+
+ Handle(TColStd_HSequenceOfHAsciiString) uses = thepk->Uses();
+ for(i=1; i<=uses->Length(); i++)
+ AddAction(anit,uses->Value(i), WOKBuilder_Uses);
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = thepk->Classes();
+ Handle(TCollection_HAsciiString) fullname;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ Handle(MS_Type) atype;
+ Handle(MS_InstClass) instclass;
+
+ for(i=1; i<=classes->Length(); i++)
+ {
+ fullname = MS::BuildFullName(anaction->Entity()->Name(), classes->Value(i));
+ atype = ameta->GetType(fullname);
+ instclass = Handle(MS_InstClass)::DownCast(atype);
+ if(!instclass.IsNull())
+ {
+ if(!instclass->IsNested())
+ AddAction(anit,fullname, WOKBuilder_Instantiate);
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildGlobEnt
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildGlobEnt(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& )
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Used : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildExecutable
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildExecutable(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& )
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Executable : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildComponent
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildComponent(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& )
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::Execute"
+ << "Component : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ break;
+ default:
+ return WOKBuilder_Failed;
+
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildInstantiate
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildInstantiate(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(MSchema()->MetaSchema()->GetType(anaction->Entity()->Name()));
+
+ if(!instclass.IsNull())
+ {
+ // InstClass
+ if(! instclass->IsAlreadyDone())
+ {
+ instclass->Instantiates();
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ MSchema()->ChangeAddAction(theid, afile);
+ }
+
+ if(anit.IsInStack(instclass->FullName(), WOKBuilder_InstToStd))
+ {
+ // les ajouts ne sont necessaires que si la class est a insttostd
+ // : Traduire la generique si l'instclass doir etre InstToStd
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ anaction->Entity()->SetFile(afile);
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ }
+ }
+ return WOKBuilder_Success;
+}
+
+
+//=======================================================================
+//function : BuildPackageMethods
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildPackageMethods(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i, j;
+ const Handle(MS_Package)& apk = MSchema()->MetaSchema()->GetPackage(anaction->Entity()->Name());
+ Handle(MS_ExternMet) method;
+
+ if(apk.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSTranslatorIterator::BuildPackageMethods"
+ << anaction->Entity()->Name() << " was not found or not an interface\n" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ for(i=1; i<=apk->Methods()->Length(); i++)
+ {
+ method = apk->Methods()->Value(i);
+ Handle(MS_HArray1OfParam) params = method->Params();
+ if(!params.IsNull()) {
+ for(j=1; j<=params->Length(); j++)
+ {
+ const Handle(MS_Param)& param = params->Value(j);
+ AddAction(anit,param->TypeName(), WOKBuilder_TypeUses);
+ }
+ }
+ Handle(MS_Param) param = method->Returns();
+ if(!param.IsNull())
+ AddAction(anit,param->TypeName(), WOKBuilder_TypeUses);
+ }
+ anaction->Entity()->SetFile(afile);
+ //MSchema()->ChangeAddAction(anaction);
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : InterfaceTypes
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildInterfaceTypes(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ Standard_Integer i, j;
+ Handle(TColStd_HSequenceOfHAsciiString) asequses;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ const Handle(MS_Interface)& aninter = ameta->GetInterface(anaction->Entity()->Name());
+
+ if(aninter.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSTranslatorIterator::BuildInterface"
+ << anaction->Entity()->Name() << " was not found or not an interface\n" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ for(i=1; i<=aninter->Uses()->Length(); i++)
+ {
+ const Handle(MS_Package)& apack = ameta->GetPackage(aninter->Uses()->Value(i));
+ asequses = apack->Uses();
+
+ for(j=1; j<=asequses->Length(); j++)
+ {
+ AddAction(anit,asequses->Value(j), WOKBuilder_DirectUses);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = aninter->Classes();
+ for(i=1; i<=classes->Length(); i++)
+ AddAction(anit,classes->Value(i), WOKBuilder_CompleteType);
+
+ Handle(TColStd_HSequenceOfHAsciiString) methods = aninter->Methods();
+ Handle(TCollection_HAsciiString) name;
+
+ anaction->Entity()->SetFile(afile);
+ //MSchema()->ChangeAddAction(anaction);
+
+ for(i=1; i<=methods->Length(); i++)
+ {
+ name = MS::GetEntityNameFromMethodName( methods->Value(i));
+
+ if(ameta->IsPackage(name))
+ {
+ AddAction(anit,name, WOKBuilder_PackageMethods);
+ }
+ else if(ameta->IsDefined(name))
+ {
+ AddAction(anit,name, WOKBuilder_CompleteType);
+ }
+ else
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::BuildInterfaceTypes"
+ << "Name " << name << " is not a package name or a type name and is exported in " << anaction->Entity()->Name() << endm;
+ return WOKBuilder_Failed;
+ }
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : SchemaTypes
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildSchemaTypes(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& ,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ Standard_Integer i, j;
+
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ const Handle(MS_Schema)& aschema = ameta->GetSchema(anaction->Entity()->Name());
+
+ if(aschema.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSTranslatorIterator::BuildSchema"
+ << anaction->Entity()->Name() << " was not found or not an Schema\n" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) packages = aschema->GetPackages();
+
+ for(i=1; i<=packages->Length(); i++)
+ {
+ const Handle(MS_Package)& apack = ameta->GetPackage(packages->Value(i));
+
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = apack->Classes();
+
+ for(j=1; j<=aseq->Length(); j++)
+ {
+ Handle(TCollection_HAsciiString) astr = MS::BuildFullName(apack->Name(), aseq->Value(j));
+ AddAction(anit,astr, WOKBuilder_SchemaType);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) classes = aschema->GetClasses();
+ for(i=1; i<=classes->Length(); i++)
+ AddAction(anit,classes->Value(i), WOKBuilder_SchemaType);
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildInstToStd
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildInstToStd(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+ Handle(MS_StdClass) stdclass;
+
+ if(!instclass.IsNull())
+ {
+ // InstClass
+ instclass->InstToStd();
+ MSchema()->ChangeAddAction(theid, afile);
+ }
+
+ Handle(MS_GenClass) genClass = Handle(MS_GenClass)::DownCast(ameta->GetType(instclass->GenClass()));
+ Handle(TColStd_HSequenceOfHAsciiString) theGenTypes = instclass->GenTypes();
+ Standard_Integer i;
+
+ if(theGenTypes->Length() > instclass->InstTypes()->Length())
+ {
+ ErrorMsg << "WOKBuilder_MSTranslator::BuildInstToStd"
+ << "Wrong instantiation types number in " << instclass->FullName() << ": please remedy" << endm;
+ return WOKBuilder_Failed;
+ }
+
+ for(i=1; i<=theGenTypes->Length(); i++)
+ {
+ AddAction(anit,instclass->InstTypes()->Value(i), WOKBuilder_TypeUses);
+ }
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildGenClass
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildGenClass(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i,j;
+
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::BuildGenClass"
+ << "Generic : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ // CLE
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+ aseq = theclass->GetUsesNames();
+ for(i=1; i<=aseq->Length(); i++) {
+ if (MSchema()->MetaSchema()->IsDefined(aseq->Value(i))) {
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(ameta->GetType(aseq->Value(i)));
+ if(!instclass.IsNull()) {
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ AddAction(anit,aseq->Value(i), WOKBuilder_Instantiate);
+ AddAction(anit,aseq->Value(i), WOKBuilder_InstToStd);
+ }
+ else {
+ AddAction(anit,aseq->Value(i), WOKBuilder_TypeUses);
+ }
+ }
+ }
+ }
+ // END CLE
+
+ // JGA
+ Handle(MS_GenClass) genclass = Handle(MS_GenClass)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!genclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) neststds = genclass->GetNestedStdClassesName();
+
+ for(i=1; i<=neststds->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(genclass->Package()->Name(),
+ neststds->Value(i));
+ Handle(MS_Class) netclass =
+ Handle(MS_Class)::DownCast(ameta->GetType(fullname));
+
+ // Add nested inheritance
+ Handle(TColStd_HSequenceOfHAsciiString) inhseq = netclass->GetInheritsNames();
+ for(j=1; j<=inhseq->Length(); j++)
+ AddAction(anit,inhseq->Value(j), WOKBuilder_TypeUses);
+ // Add nested uses
+ Handle(TColStd_HSequenceOfHAsciiString) usesseq = netclass->GetUsesNames();
+ for(j=1; j<=usesseq->Length(); j++)
+ AddAction(anit,usesseq->Value(j), WOKBuilder_TypeUses);
+ }
+ }
+ // END JGA
+
+ for(i=1; i<=gentypes->Length(); i++)
+ AddAction(anit,gentypes->Value(i), WOKBuilder_GenType);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ // CLE
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+ aseq = theclass->GetUsesNames();
+ for(i=1; i<=aseq->Length(); i++) {
+ if (MSchema()->MetaSchema()->IsDefined(aseq->Value(i))) {
+ Handle(MS_InstClass) instclass = Handle(MS_InstClass)::DownCast(ameta->GetType(aseq->Value(i)));
+ if(!instclass.IsNull()) {
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ AddAction(anit,aseq->Value(i), WOKBuilder_Instantiate);
+ AddAction(anit,aseq->Value(i), WOKBuilder_InstToStd);
+ }
+ else {
+ AddAction(anit,aseq->Value(i), WOKBuilder_TypeUses);
+ }
+ }
+ }
+ }
+ // END CLE
+
+ // JGA
+ Handle(MS_GenClass) genclass = Handle(MS_GenClass)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!genclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) neststds = genclass->GetNestedStdClassesName();
+
+ for(i=1; i<=neststds->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(genclass->Package()->Name(),
+ neststds->Value(i));
+ Handle(MS_Class) netclass =
+ Handle(MS_Class)::DownCast(MSchema()->MetaSchema()->GetType(fullname));
+
+ // Add nested inheritance
+ Handle(TColStd_HSequenceOfHAsciiString) inhseq = netclass->GetInheritsNames();
+ for(j=1; j<=inhseq->Length(); j++)
+ AddAction(anit,inhseq->Value(j), WOKBuilder_TypeUses);
+ // Add nested uses
+ Handle(TColStd_HSequenceOfHAsciiString) usesseq = netclass->GetUsesNames();
+ for(j=1; j<=usesseq->Length(); j++)
+ AddAction(anit,usesseq->Value(j), WOKBuilder_TypeUses);
+ }
+ }
+ // END JGA
+
+ Handle(MS_GenClass) agenclass = Handle(MS_GenClass)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+ Handle(MS_InstClass) instclass;
+ Handle(TColStd_HSequenceOfHAsciiString) nestedinst = agenclass->GetNestedInsClassesName();
+ for(i=1; i<=nestedinst->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) fullname = MS::BuildFullName(agenclass->Package()->Name(), nestedinst->Value(i));
+
+ instclass = Handle(MS_InstClass)::DownCast(MSchema()->MetaSchema()->GetType(fullname));
+
+ if(! instclass.IsNull())
+ AddAction(anit,instclass->GenClass(), WOKBuilder_GenType);
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+ }
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildCompleteType
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildCompleteType(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::BuildCompleteType"
+ << "Complete : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+ }
+
+ for(i=1; i<=inctypes->Length(); i++)
+ AddAction(anit,inctypes->Value(i), WOKBuilder_TypeUses);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ Handle(MS_Type) thetype = ameta->GetType(anaction->Entity()->Name());
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(thetype);
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+
+ aseq = theclass->GetUsesNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_TypeUses);
+ }
+ else
+ {
+ Handle(MS_Alias) thealias = Handle(MS_Alias)::DownCast(thetype);
+ if(!thealias.IsNull())
+ {
+ AddAction(anit,thealias->Type(), WOKBuilder_Inherits);
+ }
+ else
+ {
+ Handle(MS_Pointer) thepointer = Handle(MS_Pointer)::DownCast(thetype);
+ if(!thepointer.IsNull())
+ {
+ AddAction(anit,thepointer->Type(), WOKBuilder_Inherits);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+ }
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildSchemaType
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildSchemaType(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::BuildSchemaType"
+ << "Schema Type : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_SchemaType);
+ }
+
+ for(i=1; i<=inctypes->Length(); i++)
+ AddAction(anit,inctypes->Value(i), WOKBuilder_SchemaType);
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ const Handle(MS_Type)& thetype = ameta->GetType(anaction->Entity()->Name());
+
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(thetype);
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_SchemaType);
+
+ aseq = theclass->GetUsesNames();
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_SchemaType);
+ }
+ else
+ {
+ Handle(MS_Alias) thealias = Handle(MS_Alias)::DownCast(thetype);
+ if(!thealias.IsNull())
+ {
+ AddAction(anit,thealias->Type(), WOKBuilder_SchemaType);
+ }
+ else
+ {
+ Handle(MS_Pointer) thepointer = Handle(MS_Pointer)::DownCast(thetype);
+ if(!thepointer.IsNull())
+ {
+ AddAction(anit,thepointer->Type(), WOKBuilder_SchemaType);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+ }
+
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildTypeUsed
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildTypeUsed(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ const Handle(MS_MetaSchema)& ameta = MSchema()->MetaSchema();
+ WOKBuilder_MSActionID theid(anaction->Entity()->Name(), anaction->Type());
+ Standard_Integer i;
+
+ switch(MSActionStatus(anaction, afile))
+ {
+ case WOKBuilder_OutOfDate:
+ {
+ MSchema()->RemoveAction(theid);
+ }
+ case WOKBuilder_NotDefined:
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) uses, inctypes, insttypes, gentypes;
+
+ InfoMsg << "WOKBuilder_MSEntityTranslatorIterator::BuildTypeUsed"
+ << "Type used : " << afile->Path()->Name() << endm;
+
+ switch(Translate(anaction, afile, uses, inctypes, insttypes, gentypes))
+ {
+ case WOKBuilder_Success:
+ {
+ anaction->Entity()->SetFile(afile);
+ MSchema()->ChangeAddAction(theid, afile);
+
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(ameta->GetType(anaction->Entity()->Name()));
+
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+ }
+ }
+ break;
+ case WOKBuilder_Failed:
+ MSchema()->ChangeActionToFailed(theid);
+ default:
+ return WOKBuilder_Failed;
+ }
+ }
+ break;
+ case WOKBuilder_UpToDate:
+ {
+ Handle(MS_Type) thetype = ameta->GetType(anaction->Entity()->Name());
+
+ Handle(MS_Class) theclass = Handle(MS_Class)::DownCast(thetype);
+ if(!theclass.IsNull())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = theclass->GetInheritsNames();
+
+ for(i=1; i<=aseq->Length(); i++)
+ AddAction(anit, aseq->Value(i), WOKBuilder_Inherits);
+ }
+ else
+ {
+ Handle(MS_Alias) thealias = Handle(MS_Alias)::DownCast(thetype);
+ if(!thealias.IsNull())
+ {
+ AddAction(anit,thealias->Type(), WOKBuilder_Inherits);
+ }
+ else
+ {
+ Handle(MS_Pointer) thepointer = Handle(MS_Pointer)::DownCast(thetype);
+ if(!thepointer.IsNull())
+ {
+ AddAction(anit,thepointer->Type(), WOKBuilder_Inherits);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ return WOKBuilder_Failed;
+ }
+ return WOKBuilder_Success;
+}
+
+//=======================================================================
+//function : BuildInherits
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::BuildInherits(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+ return BuildTypeUsed(anaction, afile, anit);
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslator::Execute(const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile,
+ WOKBuilder_MSTranslatorIterator& anit)
+{
+
+ switch(anaction->Type())
+ {
+ case WOKBuilder_Package:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Package : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildPackage(anaction, afile, anit);
+
+ case WOKBuilder_Schema:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Schema : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildSchema(anaction, afile, anit);
+
+ case WOKBuilder_Interface:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Interface : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildInterface(anaction, afile, anit);
+
+ case WOKBuilder_Client:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Client : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildClient(anaction, afile, anit);
+
+ case WOKBuilder_Engine:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Engine : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildEngine(anaction, afile, anit);
+
+ case WOKBuilder_Executable:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Executable : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildExecutable(anaction, afile, anit);
+
+ case WOKBuilder_Component:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Component : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildComponent(anaction, afile, anit);
+
+ case WOKBuilder_DirectUses:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "DirectUses : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildDirectUses(anaction, afile, anit);
+
+ case WOKBuilder_SchUses:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "SchUses : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildSchUses(anaction, afile, anit);
+
+ case WOKBuilder_Uses:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Uses : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildUses(anaction, afile, anit);
+
+ case WOKBuilder_GlobEnt:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Uses : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildGlobEnt(anaction, afile, anit);
+
+ case WOKBuilder_Instantiate:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Instantiate : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildInstantiate(anaction, afile, anit);
+
+ case WOKBuilder_GenType:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "GenType : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildGenClass(anaction, afile, anit);
+
+ case WOKBuilder_InterfaceTypes:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Interface types : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildInterfaceTypes(anaction, afile, anit);
+
+ case WOKBuilder_SchemaTypes:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Schema types : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildSchemaTypes(anaction, afile, anit);
+
+ case WOKBuilder_PackageMethods:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Package methods : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildPackageMethods(anaction, afile, anit);
+
+ case WOKBuilder_InstToStd:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "InstToStd : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildInstToStd(anaction, afile, anit);
+
+ case WOKBuilder_CompleteType:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "CompleteType : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildCompleteType(anaction, afile, anit);
+
+ case WOKBuilder_SchemaType:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "SchemaType : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildSchemaType(anaction, afile, anit);
+
+ case WOKBuilder_Inherits:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "Inherits : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildInherits(anaction, afile, anit);
+
+ case WOKBuilder_TypeUses:
+ WOK_TRACE {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::Execute"
+ << "TypeUses : " << anaction->Entity()->Name() <<endm;
+ }
+ return BuildTypeUsed(anaction, afile, anit);
+
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslator::Execute : Unknown action type");
+ return WOKBuilder_Failed;
+
+ }
+}
+
+
--- /dev/null
+-- File: WOKBuilder_MSTranslatorIterator.cdl
+-- Created: Mon Sep 18 18:40:46 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+
+
+class MSTranslatorIterator from WOKBuilder
+
+ ---Purpose: Iterates on CDL files To Complete definition of a specification
+
+uses
+ MSchema from WOKBuilder,
+ MSEntity from WOKBuilder,
+ Specification from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ MSTranslator from WOKBuilder,
+ MSAction from WOKBuilder,
+ MSActionID from WOKBuilder,
+ DataMapOfMSActionIDOfMSAction from WOKBuilder,
+ MSActionType from WOKBuilder,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd,
+ QueueOfMSAction from WOKBuilder
+is
+
+ Create(ams : MSchema from WOKBuilder; anaction : MSActionID from WOKBuilder)
+ returns MSTranslatorIterator from WOKBuilder;
+ ---Purpose: instantiates Iterator
+
+ Create(ams : MSchema from WOKBuilder)
+ returns MSTranslatorIterator from WOKBuilder;
+ ---Purpose: instantiates Iterator
+
+ Reset(me:out);
+
+ Value(me:out) returns MSAction from WOKBuilder;
+ ---C++: return const &
+ --
+ --
+ --
+ --
+ ---Purpose: returns the current MSEntity to complete
+ -- even if it is already in MS (to check its validity
+ -- outside of Iterator
+
+ GetMSAction(me:out; aname : HAsciiString from TCollection; action : MSActionType from WOKBuilder)
+ ---C++: return const &
+ returns MSAction from WOKBuilder;
+
+ EquivActionStacked(me:out; aname : HAsciiString from TCollection; action : MSActionType from WOKBuilder);
+
+ AddInStack(me:out; aname : HAsciiString from TCollection; action : MSActionType from WOKBuilder);
+
+ IsInStack(me; aname : HAsciiString from TCollection; action : MSActionType from WOKBuilder)
+ returns Boolean from Standard;
+
+ Execute(me:out; atranslator : MSTranslator from WOKBuilder;
+ anaction : MSAction from WOKBuilder;
+ afile : Specification from WOKBuilder)
+ returns BuildStatus from WOKBuilder;
+
+ Next(me : out);
+
+ More(me) returns Boolean from Standard;
+
+fields
+
+ myms : MSchema from WOKBuilder;
+
+ mytarget : HAsciiString from TCollection;
+
+ myglobal : QueueOfMSAction from WOKBuilder;
+ myinsttypes : QueueOfMSAction from WOKBuilder;
+ mygentypes : QueueOfMSAction from WOKBuilder;
+ mygetypes : QueueOfMSAction from WOKBuilder;
+ mytypes : QueueOfMSAction from WOKBuilder;
+
+ mycurrent : MSAction from WOKBuilder;
+
+ mystack : DataMapOfMSActionIDOfMSAction from WOKBuilder;
+
+end MSTranslatorIterator;
--- /dev/null
+// File: WOKBuilder_MSTranslatorIterator.cxx
+// Created: Mon Sep 18 18:46:08 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <Standard_ProgramError.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <MS.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_Package.hxx>
+#include <MS_Interface.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_Param.hxx>
+#include <MS_HSequenceOfParam.hxx>
+
+#include <WOKBuilder_Specification.hxx>
+#include <WOKBuilder_MSEntity.hxx>
+#include <WOKBuilder_MSTool.hxx>
+
+#include <WOKBuilder_MSTranslatorIterator.ixx>
+
+
+//=======================================================================
+//function : WOKBuilder_MSTranslatorIterator
+//purpose :
+//=======================================================================
+WOKBuilder_MSTranslatorIterator::WOKBuilder_MSTranslatorIterator(const Handle(WOKBuilder_MSchema)& ams,
+ const WOKBuilder_MSActionID& anaction)
+: myms(ams)
+{
+ AddInStack(new TCollection_HAsciiString("Standard"), WOKBuilder_DirectUses);
+ AddInStack(anaction.Name(), anaction.Type());
+ myms->RemoveAutoTypes();
+}
+
+
+//=======================================================================
+//function : WOKBuilder_MSTranslatorIterator
+//purpose :
+//=======================================================================
+WOKBuilder_MSTranslatorIterator::WOKBuilder_MSTranslatorIterator(const Handle(WOKBuilder_MSchema)& ams)
+: myms(ams)
+{
+ AddInStack(new TCollection_HAsciiString("Standard"), WOKBuilder_DirectUses);
+ myms->RemoveAutoTypes();
+}
+
+
+//=======================================================================
+//function : Reset
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTranslatorIterator::Reset()
+{
+
+ myglobal.Clear();
+ myinsttypes.Clear();
+ mygentypes.Clear();
+ mygetypes.Clear();
+ mytypes.Clear();
+
+ mystack.Clear();
+
+ mytarget.Nullify();
+ AddInStack(new TCollection_HAsciiString("Standard"), WOKBuilder_DirectUses);
+ myms->RemoveAutoTypes();
+}
+
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+const Handle(WOKBuilder_MSAction)& WOKBuilder_MSTranslatorIterator::Value()
+{
+ if(!myglobal.IsEmpty()) {
+ mycurrent = myglobal.Front();
+ return mycurrent;
+ }
+ if(!mygetypes.IsEmpty()) {
+ mycurrent = mygetypes.Front();
+ return mycurrent;
+ }
+ if(!mygentypes.IsEmpty()) {
+ mycurrent = mygentypes.Front();
+ return mycurrent;
+ }
+ if(!myinsttypes.IsEmpty()) {
+ mycurrent = myinsttypes.Front();
+ return mycurrent;
+ }
+ mycurrent = mytypes.Front();
+ return mycurrent;
+}
+
+//=======================================================================
+//function : GetMSAction
+//purpose :
+//=======================================================================
+const Handle(WOKBuilder_MSAction)& WOKBuilder_MSTranslatorIterator::GetMSAction(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType action)
+{
+ WOKBuilder_MSActionID anid(aname, action);
+
+ static Handle(WOKBuilder_MSAction) theaction;
+
+ if(!mystack.IsBound(anid))
+ {
+ theaction = myms->GetAction(anid);
+ }
+ else
+ {
+ return mystack.Find(anid);
+ }
+ return theaction;
+}
+
+//=======================================================================
+//function : EquivActionStacked
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTranslatorIterator::EquivActionStacked(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType action)
+{
+ WOKBuilder_MSActionID anid(aname, action);
+
+ if(!mystack.IsBound(anid))
+ {
+ Handle(WOKBuilder_MSAction) theaction;
+
+ theaction = GetMSAction(aname, action);
+ mystack.Bind(anid, theaction);
+ }
+ return;
+}
+
+//=======================================================================
+//function : AddInStack
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTranslatorIterator::AddInStack(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType action)
+{
+ WOKBuilder_MSActionID anid(aname, action);
+ Handle(WOKBuilder_MSAction) anact;
+ Standard_Boolean added = Standard_False;
+
+ if(!mystack.IsBound(anid))
+ {
+ anact = myms->GetAction(anid);
+
+ switch(action)
+ {
+ case WOKBuilder_Package:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Schema:
+ case WOKBuilder_Engine:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_DirectUses:
+ case WOKBuilder_SchUses:
+ case WOKBuilder_Uses:
+ case WOKBuilder_GlobEnt:
+ myglobal.Push(anact);
+ break;
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_InstToStd:
+ myinsttypes.Push(anact);
+ break;
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_PackageMethods:
+ mygetypes.Push(anact);
+ break;
+ case WOKBuilder_GenType:
+ mygentypes.Push(anact);
+ break;
+ case WOKBuilder_CompleteType:
+ case WOKBuilder_SchemaType:
+ case WOKBuilder_Inherits:
+ case WOKBuilder_TypeUses:
+ mytypes.Push(anact);
+ break;
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslatorIterator::AddInStack : Unknown action type");
+ break;
+ }
+
+
+ mystack.Bind(anid, anact);
+
+ Handle(TCollection_HAsciiString) astr = anact->Entity()->Name();
+
+ switch(action)
+ {
+ case WOKBuilder_Package:
+ case WOKBuilder_Schema:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_Engine:
+ EquivActionStacked(astr, WOKBuilder_DirectUses);
+ EquivActionStacked(astr, WOKBuilder_Uses);
+ EquivActionStacked(astr, WOKBuilder_GlobEnt);
+ break;
+ case WOKBuilder_DirectUses:
+ EquivActionStacked(astr, WOKBuilder_Uses);
+ EquivActionStacked(astr, WOKBuilder_GlobEnt);
+ break;
+ case WOKBuilder_SchUses:
+ EquivActionStacked(astr, WOKBuilder_Uses);
+ EquivActionStacked(astr, WOKBuilder_GlobEnt);
+ break;
+ case WOKBuilder_Uses:
+ EquivActionStacked(astr, WOKBuilder_GlobEnt);
+ break;
+ case WOKBuilder_GlobEnt:
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_PackageMethods:
+ case WOKBuilder_InstToStd:
+ case WOKBuilder_GenType:
+ break;
+ case WOKBuilder_SchemaType:
+ EquivActionStacked(astr, WOKBuilder_CompleteType);
+ EquivActionStacked(astr, WOKBuilder_Inherits);
+ EquivActionStacked(astr, WOKBuilder_TypeUses);
+ break;
+ case WOKBuilder_CompleteType:
+ EquivActionStacked(astr, WOKBuilder_Inherits);
+ EquivActionStacked(astr, WOKBuilder_TypeUses);
+ break;
+ case WOKBuilder_Inherits:
+ break;
+ case WOKBuilder_TypeUses:
+ EquivActionStacked(astr, WOKBuilder_Inherits);
+ break;
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslatorIterator::AddInStack : Unknown action type");
+ break;
+ }
+ added = Standard_True;
+ }
+
+ WOK_TRACE {
+ if(VerboseMsg("WOK_TRANSIT").IsSet())
+ {
+ Standard_CString actionstr;
+ switch(action)
+ {
+ case WOKBuilder_Package:
+ actionstr = "Package";
+ break;
+ case WOKBuilder_Schema:
+ actionstr = "Schema";
+ break;
+ case WOKBuilder_Interface:
+ actionstr = "Interface";
+ break;
+ case WOKBuilder_Client:
+ actionstr = "Client";
+ break;
+ case WOKBuilder_Engine:
+ actionstr = "Engine";
+ break;
+ case WOKBuilder_Executable:
+ actionstr = "Executable";
+ break;
+ case WOKBuilder_Component:
+ actionstr = "Component";
+ break;
+ case WOKBuilder_DirectUses:
+ actionstr = "DirectUses";
+ break;
+ case WOKBuilder_SchUses:
+ actionstr = "SchUses";
+ break;
+ case WOKBuilder_Uses:
+ actionstr = "Uses";
+ break;
+ case WOKBuilder_GlobEnt:
+ actionstr = "GlobalEntity";
+ break;
+ case WOKBuilder_Instantiate:
+ actionstr = "Instantiate";
+ break;
+ case WOKBuilder_InterfaceTypes:
+ actionstr = "Inter Types";
+ break;
+ case WOKBuilder_SchemaTypes:
+ actionstr = "Schema Types";
+ break;
+ case WOKBuilder_PackageMethods:
+ actionstr = "Pk Methods";
+ break;
+ case WOKBuilder_GenType:
+ actionstr = "GenType";
+ break;
+ case WOKBuilder_InstToStd:
+ actionstr = "InstToStd";
+ break;
+ case WOKBuilder_SchemaType:
+ actionstr = "SchemaType";
+ break;
+ case WOKBuilder_CompleteType:
+ actionstr = "CompleteType";
+ break;
+ case WOKBuilder_Inherits:
+ actionstr = "Inherits";
+ break;
+ case WOKBuilder_TypeUses:
+ actionstr = "TypeUses";
+ break;
+ default:
+ actionstr = "unknown";
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslatorIterator::AddInStack : Unknown action type");
+ break;
+
+ }
+ if(!added)
+ {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::AddInStack"
+ << "Adding : " << aname << " as " << actionstr << " not added : Already in stack" << endm;
+ }
+ else
+ {
+ VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslatorIterator::AddInStack"
+ << "Adding : " << aname << " as " << actionstr << endm;
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : IsInStack
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSTranslatorIterator::IsInStack(const Handle(TCollection_HAsciiString)& aname,
+ const WOKBuilder_MSActionType action) const
+{
+ WOKBuilder_MSActionID anid(aname, action);
+
+ return mystack.IsBound(anid);
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+WOKBuilder_BuildStatus WOKBuilder_MSTranslatorIterator::Execute(const Handle(WOKBuilder_MSTranslator)& atranslator,
+ const Handle(WOKBuilder_MSAction)& anaction,
+ const Handle(WOKBuilder_Specification)& afile)
+{
+ return atranslator->Execute(anaction, afile, *this);
+}
+
+//=======================================================================
+//function : Next
+//purpose :
+//=======================================================================
+void WOKBuilder_MSTranslatorIterator::Next()
+{
+ switch(mycurrent->Type())
+ {
+ case WOKBuilder_Package:
+ case WOKBuilder_Schema:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_Engine:
+ case WOKBuilder_DirectUses:
+ case WOKBuilder_SchUses:
+ case WOKBuilder_Uses:
+ case WOKBuilder_GlobEnt:
+ myglobal.Pop();
+ break;
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_PackageMethods:
+ mygetypes.Pop();
+ break;
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_InstToStd:
+ myinsttypes.Pop();
+ break;
+ case WOKBuilder_GenType:
+ mygentypes.Pop();
+ break;
+ case WOKBuilder_SchemaType:
+ case WOKBuilder_CompleteType:
+ case WOKBuilder_Inherits:
+ case WOKBuilder_TypeUses:
+ mytypes.Pop();
+ break;
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSTranslatorIterator::Next : Unknown action type");
+ break;
+ }
+
+ return;
+}
+
+
+//=======================================================================
+//function : More
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSTranslatorIterator::More() const
+{
+ if(!myglobal.IsEmpty()) return Standard_True;
+ if(!mygetypes.IsEmpty()) return Standard_True;
+ if(!mygentypes.IsEmpty()) return Standard_True;
+ if(!myinsttypes.IsEmpty()) return Standard_True;
+ if(!mytypes.IsEmpty()) return Standard_True;
+ return Standard_False;
+}
+
+
+
+
--- /dev/null
+// File: WOKBuilder_MSTranslatorPtr.hxx
+// Created: Wed Oct 11 21:24:05 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#ifndef WOKBuilder_MSTranslatorPtr_HeaderFile
+#define WOKBuilder_MSTranslatorPtr_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKBuilder_MSTranslatorPtr);
+
+extern "C" {
+
+typedef Standard_Integer (*WOKBuilder_MSTranslatorPtr)(const Handle(MS_MetaSchema)&,
+ const Handle(TCollection_HAsciiString)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&,
+ const Handle(TColStd_HSequenceOfHAsciiString)&);
+}
+
+#endif
--- /dev/null
+-- File: WOKBuilder_MSchema.cdl
+-- Created: Tue Sep 19 12:05:56 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class MSchema from WOKBuilder
+inherits TShared from MMgt
+
+ ---Purpose: Encapsulates MS_MetaSchema
+ -- Provides WOK interface with WOK and MetaSchema
+ -- Handles the WOK file nominating conventions (PK_Class.cdl ...)
+ --
+
+uses
+ MetaSchema from MS,
+ GlobalEntity from MS,
+ Type from MS,
+ ExecFile from MS,
+ Specification from WOKBuilder,
+ MSEntity from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ MSActionType from WOKBuilder,
+ MSAction from WOKBuilder,
+ MSActionID from WOKBuilder,
+ MSActionStatus from WOKBuilder,
+ DataMapOfMSActionIDOfMSAction from WOKBuilder,
+ DataMapOfHAsciiStringOfMSEntity from WOKBuilder,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+is
+
+ Create returns mutable MSchema from WOKBuilder;
+
+ MetaSchema(me)
+ ---C++: return const &
+ ---C++: inline
+ returns MetaSchema from MS;
+ ---Purpose: Returns the MS Handle of MetaSchema
+ -- WOKBuilder private purpose
+
+ ----
+ -- Type And Global Entities Management
+
+ IsDefined(me; anentity : HAsciiString from TCollection) returns Boolean from Standard;
+ ---Purpose: Tests if a global entity or a type is defined and complete in MSchema
+
+ RemoveEntity(me:mutable; anentity : HAsciiString from TCollection);
+ ---Purpose: Removes a global entity from MS_MetaSchema
+
+ RemoveType(me:mutable; atype : HAsciiString from TCollection);
+ ---Purpose: Removes a type from MS_MetaSchema
+
+ GetEntityTypes(me; anentity : HAsciiString from TCollection)
+ ---Purpose: Returns the type
+ returns HSequenceOfHAsciiString from TColStd;
+
+ RemoveAutoTypes(me);
+ ---Purpose: Removes all Automatically generated Types
+ -- (instanciations)
+
+
+ ----
+ -- WOK and MetaSchema Conventions
+
+
+ AssociatedFile(me; anentity : HAsciiString from TCollection)
+ ---Purpose: Returns the file defining entity
+ returns HAsciiString from TCollection;
+
+ AssociatedEntity(me; atype : HAsciiString from TCollection)
+ ---Purpose: Returns the GlobalEntity defining type
+ returns HAsciiString from TCollection;
+
+ TypeSourceFiles(me; atype : HAsciiString from TCollection)
+ ---Purpose: Returns source Files Issued From CDL
+ returns HSequenceOfHAsciiString from TColStd;
+
+
+ -- Executable Units MetaSchema access
+
+ ExecFileName(me; anexecfile : ExecFile from MS)
+ returns HAsciiString from TCollection
+ is private;
+
+ ExecutableParts(me; anexecutable : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of parts of a Executable GlobalEntity
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableFiles(me; anexecutable : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of all source files of an executable
+ --
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableFiles(me; anexecutable : HAsciiString from TCollection;
+ anexecpart : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of source files of a part
+ --
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableModules(me; anexecutable : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of all modules (basenames) of an executable
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableModules(me; anexecutable : HAsciiString from TCollection;
+ anexecpart : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of modules (basenames) of a part
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableLibraries(me; anexecutable : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableLibraries(me; anexecutable : HAsciiString from TCollection;
+ anexecpart : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableExternals(me; anexecutable : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ExecutableExternals(me; anexecutable : HAsciiString from TCollection;
+ anexecpart : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+
+ --- Compenents Interfaces Access
+ ComponentParts(me; anexecutable : HAsciiString from TCollection)
+ ---Purpose: Returns the sequence of parts of a Executable GlobalEntity
+ returns HSequenceOfHAsciiString from TColStd;
+
+
+ --- Schema Units MetaSchema Access
+ --
+
+ SchemaClasses(me; aschema : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ SortedSchemaClasses(me; aschema : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ SchemaDescrMissingClasses(me; aschema : HAsciiString from TCollection)
+ returns HSequenceOfHAsciiString from TColStd;
+
+ ----
+ -- Actions Management (Translation, Extraction)
+
+ IsActionDefined(me; anid : MSActionID from WOKBuilder)
+ returns Boolean from Standard;
+
+ AddAction(me; anid : MSActionID from WOKBuilder);
+
+ GetStoredActionID(me; anid : MSActionID from WOKBuilder)
+ returns MSActionID from WOKBuilder;
+
+ GetAction(me:mutable; anid : MSActionID from WOKBuilder)
+ ---Purpose: Gets an action or creates it
+ returns MSAction from WOKBuilder;
+
+ ChangeActionToFailed(me:mutable; anid : MSActionID from WOKBuilder);
+
+ ChangeAddAction(me:mutable; anid : MSActionID from WOKBuilder; thefile : Specification from WOKBuilder);
+ ---Purpose: Adds Action to the map if it does not exists
+ -- Updates Date if it exists
+
+ GetActionStatus(me:mutable; anaction : MSActionID from WOKBuilder)
+ ---Purpose: Get the status of an action on the MetaSchema
+ returns MSActionStatus from WOKBuilder;
+
+
+ RemoveAction(me:mutable; anaction : MSActionID from WOKBuilder);
+ ---Purpose: Removes an action from the map/
+
+ Clear(me:mutable);
+ ---Purpose: Empties MetaSchema and Action Map
+
+
+fields
+ myschema : MetaSchema from MS;
+ myactions : DataMapOfMSActionIDOfMSAction from WOKBuilder;
+ myentities : DataMapOfHAsciiStringOfMSEntity from WOKBuilder;
+end MSchema;
--- /dev/null
+
+
+#include <Standard_ProgramError.hxx>
+
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <MS_Package.hxx>
+#include <MS_Schema.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_Error.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_InstMet.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_Param.hxx>
+#include <MS_NatType.hxx>
+#include <MS.hxx>
+#include <MS_Component.hxx>
+#include <MS_Executable.hxx>
+#include <MS_ExecPart.hxx>
+#include <MS_HSequenceOfExecPart.hxx>
+#include <MS_ExecFile.hxx>
+#include <MS_HSequenceOfExecFile.hxx>
+#include <MS_DataMapIteratorOfMapOfType.hxx>
+
+#include <WOKBuilder_CDLFile.hxx>
+#include <WOKBuilder_MSEntity.hxx>
+#include <WOKBuilder_SequenceOfEntity.hxx>
+
+#include <WOKBuilder_MSchema.ixx>
+
+Standard_IMPORT void MS_ClearMapOfName();
+Standard_IMPORT const Handle(TCollection_HAsciiString)& MS_GetName(const Handle(TCollection_HAsciiString)&);
+
+//=======================================================================
+//function : WOKBuilder_MSchema
+//purpose :
+//=======================================================================
+WOKBuilder_MSchema::WOKBuilder_MSchema()
+{
+ myschema = new MS_MetaSchema;
+}
+
+
+// Type And Global Entities Management
+
+//=======================================================================
+//function : IsDefined
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSchema::IsDefined(const Handle(TCollection_HAsciiString)& anentity) const
+{
+ if(myschema->IsDefined(anentity))
+ {
+ Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(myschema->GetType(anentity));
+
+ if(aclass.IsNull() == Standard_True) return Standard_True;
+
+ return !aclass->Incomplete();
+ }
+ if(myschema->IsPackage(anentity)) return Standard_True;
+ if(myschema->IsInterface(anentity)) return Standard_True;
+ if(myschema->IsClient(anentity)) return Standard_True;
+ if(myschema->IsSchema(anentity)) return Standard_True;
+ if(myschema->IsEngine(anentity)) return Standard_True;
+ if(myschema->IsExecutable(anentity)) return Standard_True;
+ if(myschema->IsComponent(anentity)) return Standard_True;
+ return Standard_False;
+}
+
+//=======================================================================
+//function : RemoveEntity
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::RemoveEntity(const Handle(TCollection_HAsciiString)& anentity)
+{
+ Handle(TCollection_HAsciiString) astr;
+ if(myschema->IsPackage(anentity)) myschema->RemovePackage(anentity);
+ else if(myschema->IsInterface(anentity)) myschema->RemoveInterface(anentity);
+ else if(myschema->IsClient(anentity)) myschema->RemoveClient(anentity);
+ else if(myschema->IsEngine(anentity)) myschema->RemoveEngine(anentity);
+ else if(myschema->IsExecutable(anentity)) myschema->RemoveExecutable(anentity);
+ else if(myschema->IsSchema(anentity)) myschema->RemoveSchema(anentity);
+ else if(myschema->IsComponent(anentity)) myschema->RemoveComponent(anentity);
+ return;
+}
+
+//=======================================================================
+//function : RemoveType
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::RemoveType(const Handle(TCollection_HAsciiString)& anentity)
+{
+ myschema->RemoveType(anentity,Standard_False);
+}
+
+//=======================================================================
+//function : GetEntityTypes
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::GetEntityTypes(const Handle(TCollection_HAsciiString)& anentity) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Handle(TCollection_HAsciiString) fullname;
+ Standard_Integer j;
+
+ if(IsDefined(anentity))
+ {
+
+ if(myschema->IsPackage(anentity))
+ {
+ const Handle(MS_Package)& apk = myschema->GetPackage(anentity);
+
+ if(!apk.IsNull())
+ {
+ aseq->Append(anentity);
+
+ for(j=1; j<=apk->Classes()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Classes()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Excepts()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Excepts()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Enums()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Enums()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Aliases()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Aliases()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Pointers()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Pointers()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Importeds()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Importeds()->Value(j));
+ aseq->Append(fullname);
+ }
+ for(j=1; j<=apk->Primitives()->Length(); j++)
+ {
+ fullname = MS::BuildFullName(anentity, apk->Primitives()->Value(j));
+ aseq->Append(fullname);
+ }
+ return aseq;
+ }
+ }
+ else
+ {
+ if(myschema->IsInterface(anentity) ||
+ myschema->IsClient(anentity) ||
+ myschema->IsEngine(anentity) ||
+ myschema->IsSchema(anentity) ||
+ myschema->IsExecutable(anentity)||
+ myschema->IsComponent(anentity))
+ {
+ aseq->Append(anentity);
+ }
+ }
+ }
+ return aseq;
+}
+
+//=======================================================================
+//function : RemoveAutoTypes
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::RemoveAutoTypes() const
+{
+ MS_DataMapIteratorOfMapOfType anit = myschema->Types();
+ Handle(TColStd_HSequenceOfHAsciiString) toshoot = new TColStd_HSequenceOfHAsciiString;
+ Handle(MS_Class) aclass;
+ Handle(MS_InstClass) instclass;
+ Handle(MS_StdClass) stdclass;
+ Handle(MS_Error) except;
+ Standard_Integer i;
+
+
+ while(anit.More())
+ {
+ aclass = Handle(MS_Class)::DownCast(anit.Value());
+
+ if(!aclass.IsNull())
+ {
+ if(!aclass->IsNested())
+ {
+ if(!aclass->IsKind(STANDARD_TYPE(MS_Error)))
+ {
+ stdclass = Handle(MS_StdClass)::DownCast(aclass);
+ if(!stdclass.IsNull())
+ {
+ if(!stdclass->IsGeneric())
+ {
+ instclass = stdclass->GetMyCreator();
+ if(!instclass.IsNull())
+ {
+ toshoot->Append(stdclass->FullName());
+ }
+ }
+ }
+ }
+ }
+ }
+ anit.Next();
+ }
+ for(i=1; i<=toshoot->Length(); i++)
+ {
+ stdclass = Handle(MS_StdClass)::DownCast(myschema->GetType(toshoot->Value(i)));
+ if(!stdclass.IsNull())
+ {
+ instclass = stdclass->GetMyCreator();
+ if(!instclass.IsNull())
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::RemoveAutoTypes"
+ << "Shooting Auto type : " << toshoot->Value(i) << endm;
+ }
+ myschema->RemoveType(toshoot->Value(i), Standard_False);
+ instclass->Initialize();
+ myschema->AddType(instclass);
+ }
+ }
+ }
+}
+
+
+// WOK and MetaSchema Conventions
+
+
+
+//=======================================================================
+//function : AssociatedFile
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_MSchema::AssociatedFile(const Handle(TCollection_HAsciiString)& anentity) const
+{
+ Handle(TCollection_HAsciiString) filename;
+ Handle(MS_InstClass) instclass;
+ Handle(MS_GenClass) genclass;
+ Handle(MS_StdClass) stdclass;
+ Handle(MS_Class) aclass;
+
+ if(myschema->IsPackage(anentity))
+ {
+ filename = new TCollection_HAsciiString(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ if(myschema->IsDefined(anentity))
+ {
+ const Handle(MS_Type)& atype = myschema->GetType(anentity);
+
+ if(atype->IsKind(STANDARD_TYPE(MS_NatType)))
+ {
+ // Nat Type : PK.cdl
+ filename = AssociatedEntity(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ if(atype->IsKind(STANDARD_TYPE(MS_GenClass)))
+ {
+ // GenClass : PK_GenClass.cdl
+ filename = new TCollection_HAsciiString(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ if(atype->IsKind(STANDARD_TYPE(MS_Error)))
+ {
+ // Execption : PK.cdl
+ filename = AssociatedEntity(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+
+
+ aclass = Handle(MS_Class)::DownCast(atype);
+
+ if(!aclass.IsNull())
+ {
+ if(aclass->IsNested())
+ {
+ // Nested Class : PK_NestingGenClass.cdl
+ return AssociatedFile(aclass->GetNestingClass());
+ }
+
+
+ stdclass = Handle(MS_StdClass)::DownCast(atype);
+ if(!stdclass.IsNull())
+ {
+ if(stdclass->GetMyCreator().IsNull())
+ {
+ // StdClasss
+ filename = new TCollection_HAsciiString(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ else
+ {
+ // Instantiation : PK.cdl
+ filename = AssociatedEntity(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ }
+
+ instclass = Handle(MS_InstClass)::DownCast(atype);
+
+ if(!instclass.IsNull())
+ {
+ // Root Instantiation : PK.cdl
+ filename = AssociatedEntity(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+ }
+ }
+ }
+ filename = new TCollection_HAsciiString(anentity);
+ filename->AssignCat(".cdl");
+ return filename;
+}
+
+
+//=======================================================================
+//function : AssociatedEntity
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_MSchema::AssociatedEntity(const Handle(TCollection_HAsciiString)& atype) const
+{
+ Handle(TCollection_HAsciiString) entityname;
+ Standard_Integer apos;
+
+ if((apos = atype->Location(1, '_', 1, atype->Length())) == 0)
+ {
+ entityname = new TCollection_HAsciiString(atype);
+ }
+ else
+ {
+ entityname = atype->SubString(1, apos-1);
+ }
+ return entityname;
+}
+
+//=======================================================================
+//function : TypeSourceFiles
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::TypeSourceFiles(const Handle(TCollection_HAsciiString)& type) const
+{
+ Handle(TCollection_HAsciiString) astr;
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+ if(myschema->IsDefined(type))
+ {
+ const Handle(MS_Type)& mstype = myschema->GetType(type);
+
+ Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(mstype);
+ if(!aclass.IsNull())
+ {
+ if(aclass->IsNested())
+ {
+ if(aclass->IsKind(STANDARD_TYPE(MS_StdClass)))
+ {
+ if(myschema->GetType(aclass->GetNestingClass())->IsKind(STANDARD_TYPE(MS_GenClass)))
+ {
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".gxx");
+ aseq->Append(astr);
+ }
+ else return aseq;
+ }
+ else return aseq;
+ }
+ else
+ {
+ Handle(MS_StdClass) msstdclass = Handle(MS_StdClass)::DownCast(mstype);
+ if(!msstdclass.IsNull())
+ {
+ if(!msstdclass->GetMyCreator().IsNull())
+ {
+ return aseq;
+ }
+ if(!msstdclass->IsKind(STANDARD_TYPE(MS_Error)))
+ {
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".cxx");
+ aseq->Append(astr);
+ }
+ }
+
+ Handle(MS_Class) msclass = Handle(MS_Class)::DownCast(mstype);
+ if(!msclass.IsNull())
+ {
+ if(msclass->IsKind(STANDARD_TYPE(MS_GenClass)))
+ {
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".gxx");
+ aseq->Append(astr);
+ }
+ }
+ }
+
+ Handle(MS_HSequenceOfMemberMet) methseq = Handle(MS_Class)::DownCast(mstype)->GetMethods();
+
+ for(Standard_Integer i=1; i<=methseq->Length(); i++)
+ {
+ if(methseq->Value(i)->IsInline())
+ {
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".lxx");
+ aseq->Append(astr);
+ break;
+ }
+ }
+ }
+ }
+ else if(myschema->IsPackage(type))
+ {
+ Handle(MS_Package) apk = myschema->GetPackage(type);
+
+ if(apk->Methods()->Length() != 0)
+ {
+ Handle(MS_Method) ameth;
+
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".cxx");
+ aseq->Append(astr);
+
+ for(Standard_Integer i=1 ; i<=apk->Methods()->Length(); i++)
+ {
+
+ if(apk->Methods()->Value(i)->IsInline())
+ {
+ astr = new TCollection_HAsciiString(type);
+ astr->AssignCat(".lxx");
+ aseq->Append(astr);
+ break;
+ }
+ }
+ }
+ }
+ return aseq;
+}
+
+
+//=======================================================================
+//function : ExecFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_MSchema::ExecFileName(const Handle(MS_ExecFile)& afile) const
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ astr = new TCollection_HAsciiString(afile->Name());
+
+ switch(afile->Language())
+ {
+ case MS_FORTRAN:
+ astr->AssignCat(".f");
+ break;
+ case MS_CPP:
+ astr->AssignCat(".cxx");
+ break;
+ case MS_C:
+ astr->AssignCat(".c");
+ break;
+ case MS_OBJECT:
+ astr->AssignCat(".o");
+ break;
+ }
+ return astr;
+}
+
+//=======================================================================
+//function : ExecutableParts
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableParts(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Integer i;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ astr = parts->Value(i)->Name();
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableFiles
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableFiles(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(MS_HSequenceOfExecFile) files;
+ Handle(TCollection_HAsciiString) astr;
+ WOKTools_MapOfHAsciiString amap;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ files = parts->Value(i)->Files();
+
+ for(j=1; j<=files->Length(); j++)
+ {
+ astr = ExecFileName(files->Value(j));
+
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableFiles
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableFiles(const Handle(TCollection_HAsciiString)& anexec,
+ const Handle(TCollection_HAsciiString)& apart) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(MS_HSequenceOfExecFile) files;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ if(parts->Value(i)->Name()->IsSameString(apart))
+ {
+ files = parts->Value(i)->Files();
+ for(j=1; j<=files->Length(); j++)
+ {
+ astr = ExecFileName(files->Value(j));
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ return aseq;
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableModules
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableModules(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(MS_HSequenceOfExecFile) files;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ files = parts->Value(i)->Files();
+
+ for(j=1; j<=files->Length(); j++)
+ {
+ astr = files->Value(i)->Name();
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableModules
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableModules(const Handle(TCollection_HAsciiString)& anexec,
+ const Handle(TCollection_HAsciiString)& apart) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(MS_HSequenceOfExecFile) files;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ if(parts->Value(i)->Name()->IsSameString(apart))
+ {
+ files = parts->Value(i)->Files();
+ for(j=1; j<=files->Length(); j++)
+ {
+ astr = files->Value(j)->Name();
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ return aseq;
+ }
+ }
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableLibraries
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableLibraries(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(TColStd_HSequenceOfHAsciiString) libs;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ libs = parts->Value(i)->Libraries();
+
+ for(j=1; j<=libs->Length(); j++)
+ {
+ astr = libs->Value(i);
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableLibraries
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableLibraries(const Handle(TCollection_HAsciiString)& anexec,
+ const Handle(TCollection_HAsciiString)& apart) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(TColStd_HSequenceOfHAsciiString) libs;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ if(parts->Value(i)->Name()->IsSameString(apart))
+ {
+ libs = parts->Value(i)->Libraries();
+ for(j=1; j<=libs->Length(); j++)
+ {
+ astr = libs->Value(j);
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ return aseq;
+ }
+ }
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableExternals
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableExternals(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(TColStd_HSequenceOfHAsciiString) externals;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ externals = parts->Value(i)->Externals();
+
+ for(j=1; j<=externals->Length(); j++)
+ {
+ astr = externals->Value(i);
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : ExecutableExternals
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ExecutableExternals(const Handle(TCollection_HAsciiString)& anexec,
+ const Handle(TCollection_HAsciiString)& apart) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i,j;
+ Handle(MS_Executable) anexe;
+ Handle(MS_HSequenceOfExecPart) parts;
+ Handle(TColStd_HSequenceOfHAsciiString) externals;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ anexe = MetaSchema()->GetExecutable(anexec);
+
+ parts = anexe->Parts();
+
+ for(i=1; i<=parts->Length(); i++)
+ {
+ if(parts->Value(i)->Name()->IsSameString(apart))
+ {
+ externals = parts->Value(i)->Externals();
+ for(j=1; j<=externals->Length(); j++)
+ {
+ astr = externals->Value(j);
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+ return aseq;
+ }
+ }
+ return aseq;
+}
+
+//=======================================================================
+//function : ComponentParts
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::ComponentParts(const Handle(TCollection_HAsciiString)& anexec) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Integer i;
+ Handle(MS_Component) acomp;
+ Handle(TColStd_HSequenceOfHAsciiString) ints;
+ WOKTools_MapOfHAsciiString amap;
+ Handle(TCollection_HAsciiString) astr;
+
+ acomp = MetaSchema()->GetComponent(anexec);
+
+ ints = acomp->Interfaces();
+
+ for(i=1; i<=ints->Length(); i++)
+ {
+ astr = ints->Value(i);
+ if(!amap.Contains(astr))
+ {
+ amap.Add(astr);
+ aseq->Append(astr);
+ }
+ }
+
+ return aseq;
+}
+
+//=======================================================================
+//function : SchemaClasses
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::SchemaClasses(const Handle(TCollection_HAsciiString)& aschema) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i;
+
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = MetaSchema()->GetPersistentClassesFromSchema(aschema);
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ result->Append(aseq->Value(i));
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) aseq2 = MetaSchema()->GetPersistentClassesFromClasses(aseq, Standard_False);
+
+ for(i=1; i<=aseq2->Length(); i++)
+ {
+ result->Append(aseq2->Value(i));
+ }
+
+ return result;
+}
+
+//=======================================================================
+//function : SortedSchemaClasses
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::SortedSchemaClasses(const Handle(TCollection_HAsciiString)& aschema) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+ Handle(MS_Class) aclass;
+ Standard_Integer i,j;
+
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = SchemaClasses(aschema);
+ Handle(TColStd_HSequenceOfHAsciiString) inherits;
+ WOKTools_MapOfHAsciiString amap;
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ aclass = Handle(MS_Class)::DownCast(MetaSchema()->GetType(aseq->Value(i)));
+
+ if(aclass.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_MSchema::SortedSchemaClasses"
+ << "Name " << aseq->Value(i) << " is not a known class name" << endm;
+ Handle(TColStd_HSequenceOfHAsciiString) result;
+ return result;
+ }
+
+ inherits = aclass->GetFullInheritsNames();
+
+ for(j=1; j<=inherits->Length(); j++)
+ {
+ if(!MS::GetStorableRootName()->IsSameString(inherits->Value(j)))
+ {
+ if(!amap.Contains(inherits->Value(j)))
+ {
+ result->Append(inherits->Value(j));
+ amap.Add(inherits->Value(j));
+ }
+ }
+ else
+ break;
+ }
+
+ if(!MS::GetStorableRootName()->IsSameString(aseq->Value(i)))
+ {
+ if(!amap.Contains(aseq->Value(i)))
+ {
+ result->Append(aseq->Value(i));
+ amap.Add(aseq->Value(i));
+ }
+ }
+ }
+
+ return result;
+}
+
+//=======================================================================
+//function : SchemaDescrMissingClasses
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_MSchema::SchemaDescrMissingClasses(const Handle(TCollection_HAsciiString)& aschema) const
+{
+ Handle(TColStd_HSequenceOfHAsciiString) result;
+
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = MetaSchema()->GetPersistentClassesFromSchema(aschema);
+ result = MetaSchema()->GetPersistentClassesFromClasses(aseq, Standard_False);
+
+ return result;
+}
+
+
+//=======================================================================
+//function : IsActionDefined
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_MSchema::IsActionDefined(const WOKBuilder_MSActionID& anid) const
+{
+ WOKBuilder_MSActionID theid = GetStoredActionID(anid);
+
+ return myactions.IsBound(theid);
+}
+
+//=======================================================================
+//function : GetStoredActionID
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionID WOKBuilder_MSchema::GetStoredActionID(const WOKBuilder_MSActionID& anid) const
+{
+ WOKBuilder_MSActionID theid = anid;
+
+ switch(theid.Type())
+ {
+ case WOKBuilder_TypeModified:
+ case WOKBuilder_Package:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Engine:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_Schema:
+ case WOKBuilder_SchUses:
+ case WOKBuilder_DirectUses:
+ case WOKBuilder_Uses:
+ case WOKBuilder_GlobEnt:
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_InstToStd:
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_PackageMethods:
+ case WOKBuilder_GenType:
+ case WOKBuilder_CompleteType:
+ case WOKBuilder_SchemaType:
+ case WOKBuilder_Inherits:
+ case WOKBuilder_TypeUses:
+ theid.SetType(WOKBuilder_TypeModified);
+ break;
+ case WOKBuilder_TypeExtracted:
+ case WOKBuilder_ClientExtract:
+ case WOKBuilder_HeaderExtract:
+ case WOKBuilder_SchemaExtract:
+ case WOKBuilder_ServerExtract:
+ case WOKBuilder_EngineExtract:
+ case WOKBuilder_TemplateExtract:
+ break;
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSchema::GetStoredActionID : Unknown action type");
+ break;
+ }
+ return theid;
+}
+
+//=======================================================================
+//function : GetAction
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_MSAction) WOKBuilder_MSchema::GetAction(const WOKBuilder_MSActionID& anid)
+{
+ if(myactions.IsBound(anid)) return myactions.Find(anid);
+ else
+ {
+ Handle(WOKBuilder_MSEntity) anent;
+ Handle(WOKBuilder_MSAction) result, theresult;
+ WOKBuilder_MSActionID theid = GetStoredActionID(anid);
+
+
+ if(!myactions.IsBound(theid))
+ {
+ if(myentities.IsBound(theid.Name()))
+ {
+ anent = myentities.Find(theid.Name());
+ }
+ else
+ {
+ const Handle(TCollection_HAsciiString)& thename = MS_GetName(anid.Name());
+ anent = new WOKBuilder_MSEntity(thename);
+ myentities.Bind(thename, anent);
+ }
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::GetAction"
+ << "Created Action " << theid.Name() << endm;
+ }
+
+ result = new WOKBuilder_MSAction(anent, anid.Type());
+ }
+ else
+ {
+ theresult = myactions.Find(theid);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::GetAction"
+ << "Found Action " << theid.Name() << " with date : " << (Standard_Integer) theresult->Date()<< endm;
+ }
+
+ if(theresult->Type() == anid.Type())
+ result = theresult;
+ else
+ result = new WOKBuilder_MSAction(theresult, anid.Type());
+ }
+ return result;
+ }
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::ChangeActionToFailed(const WOKBuilder_MSActionID& anid)
+{
+ WOKBuilder_MSActionID theid = GetStoredActionID(anid);
+ Handle(WOKBuilder_MSAction) theaction;
+
+ if(!myactions.IsBound(theid))
+ {
+ theaction = GetAction(anid);
+ myactions.Bind(theid, theaction);
+ }
+ else
+ {
+ theaction = myactions.Find(theid);
+ }
+
+ theaction->SetDate(-1);
+ theaction->SetStatus(WOKBuilder_HasFailed);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::"
+ << "Failed Action " << theid.Name() << endm;
+ }
+ return;
+}
+
+//=======================================================================
+//function : AddAction
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::ChangeAddAction(const WOKBuilder_MSActionID& anid, const Handle(WOKBuilder_Specification)& afile)
+{
+ WOKBuilder_MSActionID theid = GetStoredActionID(anid);
+ Handle(WOKBuilder_MSAction) theaction;
+
+ if(!myactions.IsBound(theid))
+ {
+ theaction = GetAction(theid);
+ myactions.Bind(theid, theaction);
+ }
+ else
+ {
+ theaction = myactions.Find(theid);
+ }
+
+ theaction->Entity()->SetFile(afile);
+ theaction->GetDate();
+ theaction->SetStatus(WOKBuilder_UpToDate);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::ChangeAddAction"
+ << "Added Action " << theid.Name() << " with date " << (Standard_Integer) theaction->Date() << endm;
+ }
+ return;
+}
+
+//=======================================================================
+//function : GetActionStatus
+//purpose :
+//=======================================================================
+WOKBuilder_MSActionStatus WOKBuilder_MSchema::GetActionStatus(const WOKBuilder_MSActionID& anactionid)
+{
+ WOKBuilder_MSActionID theid = GetStoredActionID(anactionid);
+ Handle(WOKBuilder_MSAction) theaction;
+
+ if(!myactions.IsBound(theid))
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::GetActionStatus"
+ << "Could not get Action " << theid.Name() << endm;
+ }
+
+ return WOKBuilder_NotDefined;
+ }
+ WOK_TRACE {
+ VerboseMsg("WOK_MSCHEMA") << "WOKBuilder_MSchema::GetActionStatus"
+ << "Got Action " << theid.Name() << endm;
+ }
+
+ return GetAction(theid)->Status();
+}
+
+//=======================================================================
+//function : RemoveAction
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::RemoveAction(const WOKBuilder_MSActionID& anid)
+{
+ WOKBuilder_MSActionID theid = GetStoredActionID(anid);
+ Handle(WOKBuilder_MSAction) theaction;
+ Handle(WOKBuilder_MSEntity) theent;
+
+ switch(anid.Type())
+ {
+ case WOKBuilder_Package:
+ case WOKBuilder_Interface:
+ case WOKBuilder_Client:
+ case WOKBuilder_Engine:
+ case WOKBuilder_Executable:
+ case WOKBuilder_Component:
+ case WOKBuilder_Schema:
+ case WOKBuilder_SchUses:
+ case WOKBuilder_DirectUses:
+ case WOKBuilder_Uses:
+ case WOKBuilder_GlobEnt:
+ RemoveEntity(anid.Name());
+ break;
+ case WOKBuilder_InterfaceTypes:
+ case WOKBuilder_SchemaTypes:
+ case WOKBuilder_PackageMethods:
+ break;
+ case WOKBuilder_TypeModified:
+ case WOKBuilder_Instantiate:
+ case WOKBuilder_InstToStd:
+ case WOKBuilder_GenType:
+ case WOKBuilder_SchemaType:
+ case WOKBuilder_CompleteType:
+ case WOKBuilder_Inherits:
+ case WOKBuilder_TypeUses:
+ RemoveType(anid.Name());
+ break;
+ case WOKBuilder_TypeExtracted:
+ case WOKBuilder_ClientExtract:
+ case WOKBuilder_HeaderExtract:
+ case WOKBuilder_SchemaExtract:
+ case WOKBuilder_ServerExtract:
+ case WOKBuilder_EngineExtract:
+ case WOKBuilder_TemplateExtract:
+ //theid.SetType(WOKBuilder_TypeExtracted);
+ break;
+ default:
+ Standard_ProgramError::Raise("WOKBuilder_MSchema::RemoveAction : Unknown action type");
+ break;
+ }
+
+ if(myactions.IsBound(theid))
+ {
+ myactions.UnBind(theid);
+ }
+
+ WOKBuilder_MSActionID thependantid = theid;
+
+ switch(theid.Type())
+ {
+ case WOKBuilder_TypeModified:
+ thependantid.SetType(WOKBuilder_TypeExtracted);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ thependantid.SetType(WOKBuilder_ClientExtract);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ thependantid.SetType(WOKBuilder_HeaderExtract);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ thependantid.SetType(WOKBuilder_SchemaExtract);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ thependantid.SetType(WOKBuilder_ServerExtract);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ thependantid.SetType(WOKBuilder_EngineExtract);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ break;
+ default:
+ thependantid.SetType(WOKBuilder_TypeModified);
+ if(myactions.IsBound(thependantid)) myactions.UnBind(thependantid);
+ break;
+ }
+
+ if(myentities.IsBound(theid.Name()))
+ {
+ myentities.UnBind(theid.Name());
+ }
+
+ return;
+}
+
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void WOKBuilder_MSchema::Clear()
+{
+ myschema = new MS_MetaSchema();
+ //MS_ClearMapOfName();
+
+ myentities.Statistics(cout);
+ cout << endl;
+
+ myentities.Clear();
+ myactions.Statistics(cout);
+ cout << endl;
+ myactions.Clear();
+}
+
+
+
+
+
+
--- /dev/null
+// File: WOKBuilder_MSchema.lxx
+// Created: Mon Aug 5 17:56:03 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+//=======================================================================
+//function : MetaSchema
+//purpose :
+//=======================================================================
+const Handle(MS_MetaSchema)& WOKBuilder_MSchema::MetaSchema() const
+{
+ return myschema;
+}
--- /dev/null
+-- File: WOKBuilder_Miscellaneous.cdl
+-- Created: Mon Oct 16 16:30:45 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class Miscellaneous from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable Miscellaneous from WOKBuilder;
+
+end Miscellaneous;
--- /dev/null
+// File: WOKBuilder_Miscellaneous.cxx
+// Created: Mon Oct 16 17:18:50 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Miscellaneous.ixx>
+
+WOKBuilder_Miscellaneous::WOKBuilder_Miscellaneous(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_ObjectFile.cdl
+-- Created: Tue Aug 29 11:26:32 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class ObjectFile from WOKBuilder
+inherits Entity from WOKBuilder
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+is
+
+ Create(apath : Path from WOKUtils) returns mutable ObjectFile from WOKBuilder;
+
+
+end ObjectFile;
--- /dev/null
+// File: WOKBuilder_ObjectFile.cxx
+// Created: Tue Aug 29 11:27:13 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_ObjectFile.ixx>
+
+
+WOKBuilder_ObjectFile::WOKBuilder_ObjectFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_PDBFile.cdl
+-- Created: Mon Oct 21 14:10:20 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class PDBFile from WOKBuilder inherits Entity from WOKBuilder
+
+ uses
+
+ Path from WOKUtils
+
+ is
+
+ Create ( apath : Path from WOKUtils ) returns mutable PDBFile from WOKBuilder;
+
+end PDBFile;
--- /dev/null
+#include <WOKBuilder_PDBFile.ixx>
+
+WOKBuilder_PDBFile :: WOKBuilder_PDBFile (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Entity ( apath ) {
+} // end constructor
--- /dev/null
+-- File: WOKBuilder_SharedLibrary.cdl
+-- Created: Mon Oct 16 16:48:23 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class SharedLibrary from WOKBuilder
+inherits Library from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+
+is
+
+ Create(apth : Path from WOKUtils)
+ returns mutable SharedLibrary from WOKBuilder;
+
+ Create(aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder)
+ returns mutable SharedLibrary from WOKBuilder;
+
+ GetLibFileName(me:mutable; params : Param from WOKUtils)
+ returns HAsciiString from TCollection
+ is redefined;
+
+ GetLibFileName(myclass; params : Param from WOKUtils; aname : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+end SharedLibrary;
--- /dev/null
+// File: WOKBuilder_SharedLibrary.cxx
+// Created: Mon Oct 16 17:21:13 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_SharedLibrary.ixx>
+
+
+#include <Standard_ProgramError.hxx>
+
+//=======================================================================
+//function : WOKBuilder_SharedLibrary
+//purpose :
+//=======================================================================
+WOKBuilder_SharedLibrary::WOKBuilder_SharedLibrary(const Handle(WOKUtils_Path)& apath)
+: WOKBuilder_Library(apath)
+{
+}
+
+//=======================================================================
+//function : WOKBuilder_SharedLibrary
+//purpose :
+//=======================================================================
+WOKBuilder_SharedLibrary::WOKBuilder_SharedLibrary(const Handle(TCollection_HAsciiString)& aname,
+ const Handle(WOKUtils_Path)& adir,
+ const WOKBuilder_LibReferenceType areftype)
+: WOKBuilder_Library(aname,adir,areftype)
+{
+}
+
+//=======================================================================
+//function : GetLibFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_SharedLibrary::GetLibFileName(const WOKUtils_Param& params)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ params.Set("%LDSHR_LibName", Name()->ToCString());
+
+ astr = params.Eval("LDSHR_FileName", Standard_True);
+
+ return astr;
+}
+
+
+//=======================================================================
+//function : GetLibFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_SharedLibrary::GetLibFileName(const WOKUtils_Param& params,
+ const Handle(TCollection_HAsciiString)& aname)
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ params.Set("%LDSHR_LibName", aname->ToCString());
+
+ astr = params.Eval("LDSHR_FileName", Standard_True);
+
+ return astr;
+}
--- /dev/null
+-- File: WOKBuilder_SharedLinker.cdl
+-- Created: Tue Oct 24 10:13:46 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class SharedLinker from WOKBuilder
+inherits Linker from WOKBuilder
+
+ ---Purpose:
+
+uses
+ ObjectFile from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ SharedLibrary from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Param from WOKUtils,
+ HAsciiString from TCollection,
+ HSequenceOfHAsciiString from TColStd
+
+raises
+ ProgramError from Standard
+is
+
+ Create(aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns mutable SharedLinker from WOKBuilder;
+
+ ExportList(me) returns HSequenceOfHAsciiString from TColStd;
+
+ SetExportList(me:mutable; alist : HSequenceOfHAsciiString from TColStd);
+ SetExportList(me:mutable; anobject : ObjectFile from WOKBuilder);
+
+ LogicalName(me)
+ returns HAsciiString from TCollection;
+
+ SetLogicalName(me:mutable; aname : HAsciiString from TCollection);
+
+ EvalHeader(me:mutable)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ GetLinkerProduction(me:mutable)
+ returns HSequenceOfEntity from WOKBuilder
+ is redefined protected;
+
+
+fields
+ myexports : HSequenceOfHAsciiString from TColStd;
+ mylogicname : HAsciiString from TCollection;
+end SharedLinker;
--- /dev/null
+// File: WOKBuilder_SharedLinker.cxx
+// Created: Tue Oct 24 13:34:12 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <EDL_API.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_HSequenceOfPath.hxx>
+#include <WOKUtils_Shell.hxx>
+
+#include <WOKBuilder_Entity.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+
+#include <WOKBuilder_SharedLinker.ixx>
+
+//=======================================================================
+//function : WOKBuilder_SharedLinker
+//purpose :
+//=======================================================================
+ WOKBuilder_SharedLinker::WOKBuilder_SharedLinker(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+: WOKBuilder_Linker(aname, params)
+{
+}
+
+//=======================================================================
+//function : ExportList
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_SharedLinker::ExportList() const
+{
+ return myexports;
+}
+
+//=======================================================================
+//function : SetExportList
+//purpose :
+//=======================================================================
+void WOKBuilder_SharedLinker::SetExportList(const Handle(TColStd_HSequenceOfHAsciiString)& asymblist)
+{
+ myexports = asymblist;
+}
+
+//=======================================================================
+//function : SetExportList
+//purpose :
+//=======================================================================
+void WOKBuilder_SharedLinker::SetExportList(const Handle(WOKBuilder_ObjectFile)& )
+{
+ myexports = new TColStd_HSequenceOfHAsciiString;
+}
+
+//=======================================================================
+//function : LogicalName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_SharedLinker::LogicalName() const
+{
+ return mylogicname;
+}
+
+//=======================================================================
+//function : SetLogicalName
+//purpose :
+//=======================================================================
+void WOKBuilder_SharedLinker::SetLogicalName(const Handle(TCollection_HAsciiString)& aname)
+{
+ mylogicname = aname;
+}
+
+//=======================================================================
+//function : EvalHeader
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_SharedLinker::EvalHeader()
+{
+ Handle(TCollection_HAsciiString) line;
+ Handle(TCollection_HAsciiString) templ;
+ Handle(WOKBuilder_SharedLibrary) anent;
+
+ if(!IsLoaded()) Load();
+
+ templ = EvalToolParameter("Header");
+
+ if(templ.IsNull()) {return templ;}
+
+ // Target
+ anent = new WOKBuilder_SharedLibrary(TargetName(), OutputDir(), WOKBuilder_FullPath);
+ anent->GetPath(Params());
+
+ Params().Set("%Target", anent->Path()->Name()->ToCString());
+
+ // LogicalName
+ if(LogicalName().IsNull())
+ Params().Set("%LogicalName", anent->Path()->Name()->ToCString());
+ else
+ Params().Set("%LogicalName", LogicalName()->ToCString());
+
+ // Apply Template
+ line = Params().Eval(templ->ToCString());
+
+ if(line.IsNull()) return line;
+
+ line->AssignCat(EvalLibSearchDirectives());
+ line->AssignCat(EvalDatabaseDirectives());
+ return line;
+}
+
+//=======================================================================
+//function : GetLinkerProduction
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_SharedLinker::GetLinkerProduction()
+{
+ Handle(WOKBuilder_SharedLibrary) anent;
+ Handle(WOKBuilder_HSequenceOfEntity) result = new WOKBuilder_HSequenceOfEntity;
+
+ anent = new WOKBuilder_SharedLibrary(TargetName(), OutputDir(), WOKBuilder_FullPath);
+ anent->GetPath(Params());
+
+ result->Append(anent);
+
+ return result;
+}
--- /dev/null
+-- File: WOKBuilder_Specification.cdl
+-- Created: Thu Aug 10 20:47:10 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class Specification from WOKBuilder
+inherits Entity from WOKBuilder
+
+ ---Purpose: Base Class for spec definition files
+
+uses
+ Path from WOKUtils
+
+
+is
+ Initialize(apath : Path from WOKUtils);
+
+end Specification;
--- /dev/null
+// File: WOKBuilder_Specification.cxx
+// Created: Wed Aug 23 20:10:18 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_Specification.ixx>
+
+WOKBuilder_Specification::WOKBuilder_Specification(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Entity(apath)
+{
+}
--- /dev/null
+-- File: WOKBuilder_StaticLibrary.cdl
+-- Created: Mon Oct 21 13:36:54 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class StaticLibrarian from WOKBuilder inherits WNTLibrarian from WOKBuilder
+
+ ---Purpose: defines tool to build static library
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils
+
+ is
+
+ Create (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ ) returns mutable StaticLibrarian from WOKBuilder;
+ ---Purpose: create a class instance
+
+ EvalHeader ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluats tool command line
+
+ EvalFooter ( me : mutable ) returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluates additional information for the tool
+
+end StaticLibrarian;
--- /dev/null
+#include <WOKBuilder_StaticLibrarian.ixx>
+
+#include <WOKBuilder_Entity.hxx>
+#include <WOKBuilder_StaticLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+WOKBuilder_StaticLibrarian :: WOKBuilder_StaticLibrarian (
+ const Handle( TCollection_HAsciiString )& aName,
+ const WOKUtils_Param& aParams
+ ) : WOKBuilder_WNTLibrarian ( aName, aParams ) {
+} // end constructor
+
+Handle( TCollection_HAsciiString ) WOKBuilder_StaticLibrarian :: EvalHeader () {
+
+ return EvalToolTemplate ( "LibraryHeaderSTATIC" );
+
+} // end WOKBuilder_StaticLibrarian :: EvalHeader
+
+Handle( TCollection_HAsciiString ) WOKBuilder_StaticLibrarian :: EvalFooter () {
+
+ Handle( WOKBuilder_Entity ) outEnt;
+ Handle( TCollection_HAsciiString ) tmp;
+ Handle( TCollection_HAsciiString ) retVal = EvalToolParameter ( "LibraryOutput" );
+
+ tmp = EvalToolTemplate ( "LibrarySTATLIB" );
+
+ outEnt = new WOKBuilder_StaticLibrary ( new WOKUtils_Path ( tmp ) );
+
+ retVal -> AssignCat ( tmp );
+
+ SetProduction ( new WOKBuilder_HSequenceOfEntity () );
+
+ Produces () -> Append ( outEnt );
+
+ return retVal;
+
+} // end WOKBuilder_StaticLibrarian :: EvalFooter
--- /dev/null
+-- File: WOKBuilder_StaticLibrary.cdl
+-- Created: Wed Oct 23 09:26:56 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+class StaticLibrary from WOKBuilder inherits Library from WOKBuilder
+
+ uses
+
+ Path from WOKUtils,
+ Param from WOKUtils,
+ LibReferenceType from WOKBuilder,
+ HAsciiString from TCollection
+
+ is
+
+ Create (apth : Path from WOKUtils )
+ returns mutable StaticLibrary from WOKBuilder;
+
+ Create (
+ aname : HAsciiString from TCollection;
+ adir : Path from WOKUtils;
+ areftype : LibReferenceType from WOKBuilder
+ ) returns mutable StaticLibrary from WOKBuilder;
+
+ GetLibFileName (
+ me : mutable;
+ params : Param from WOKUtils
+ ) returns HAsciiString from TCollection is redefined static;
+
+end StaticLibrary;
--- /dev/null
+#include <WOKBuilder_StaticLibrary.ixx>
+
+WOKBuilder_StaticLibrary :: WOKBuilder_StaticLibrary (
+ const Handle( WOKUtils_Path )& apath
+ ) : WOKBuilder_Library ( apath ) {
+} // end constructor ( 1 )
+
+WOKBuilder_StaticLibrary :: WOKBuilder_StaticLibrary (
+ const Handle( TCollection_HAsciiString )& aname,
+ const Handle( WOKUtils_Path )& adir,
+ const WOKBuilder_LibReferenceType areftype
+ ) : WOKBuilder_Library ( aname, adir, areftype ) {
+} // end constructor ( 2 )
+
+Handle( TCollection_HAsciiString ) WOKBuilder_StaticLibrary :: GetLibFileName (
+ const WOKUtils_Param& params
+ ) {
+
+ params.Set ( "%LIB_LibName", Name () -> ToCString () );
+
+ return params.Eval ( "LIB_FileName", Standard_True );
+
+} // end WOKBuilder_StaticLibrary
--- /dev/null
+-- File: WOKBuilder_TarFile.cdl
+-- Created: Mon Oct 16 16:49:21 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class TarFile from WOKBuilder
+inherits Miscellaneous from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Path from WOKUtils
+
+is
+
+
+ Create(apath : Path from WOKUtils) returns mutable TarFile from WOKBuilder;
+
+end TarFile;
--- /dev/null
+// File: WOKBuilder_TarFile.cxx
+// Created: Mon Oct 16 17:21:52 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_TarFile.ixx>
+
+
+WOKBuilder_TarFile::WOKBuilder_TarFile(const Handle(WOKUtils_Path)& apath) : WOKBuilder_Miscellaneous(apath)
+{
+}
+
--- /dev/null
+-- File: WOKBuilder_Tool.cdl
+-- Created: Thu Aug 10 21:03:18 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class Tool from WOKBuilder
+inherits TShared from MMgt
+
+ ---Purpose:
+
+uses
+
+ Entity from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ Param from WOKUtils,
+ Path from WOKUtils,
+ HAsciiString from TCollection
+
+raises ProgramError from Standard
+is
+
+ Initialize(aname: HAsciiString from TCollection; params : Param from WOKUtils);
+
+ SetOutputDir(me:mutable; apath : Path from WOKUtils);
+ OutputDir(me) returns Path from WOKUtils;
+
+ SetName(me:mutable; aname : HAsciiString from TCollection );
+ Name(me)
+ returns HAsciiString from TCollection;
+
+ Execute(me:mutable)
+ returns BuildStatus from WOKBuilder
+ raises ProgramError from Standard
+ is deferred;
+
+ Produces(me:mutable)
+ returns HSequenceOfEntity from WOKBuilder;
+ SetProduction(me:mutable; aproduction : HSequenceOfEntity from WOKBuilder);
+
+ Params(me) returns Param from WOKUtils
+ ---C++: inline
+ ---C++: return const &
+ is static protected;
+ SetParams(me:mutable; params : Param from WOKUtils)
+ is static protected;
+
+ EvalToolParameter(me; aparamname : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+ EvalToolParameter(me; aparamname : CString from Standard)
+ returns HAsciiString from TCollection;
+
+ EvalToolTemplate(me; aparamname : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+ EvalToolTemplate(me; aparamname : CString from Standard)
+ returns HAsciiString from TCollection;
+
+
+ Load(me:mutable)
+ is deferred;
+
+ IsLoaded(me) returns Boolean from Standard;
+ SetLoaded(me:mutable);
+ UnsetLoaded(me:mutable);
+
+fields
+ myname : HAsciiString from TCollection;
+ myparams : Param from WOKUtils;
+ myproduction : HSequenceOfEntity from WOKBuilder;
+ outputdir : Path from WOKUtils;
+ myisloaded : Boolean from Standard;
+end Tool;
+
--- /dev/null
+// File: WOKBuilder_Tool.cxx
+// Created: Wed Aug 23 20:10:26 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_Tool.ixx>
+
+//=======================================================================
+//function : WOKBuilder_Tool
+//purpose :
+//=======================================================================
+ WOKBuilder_Tool::WOKBuilder_Tool(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : myname(aname), myparams(params), myisloaded(Standard_False)
+{
+}
+
+//=======================================================================
+//function : SetOutputDir
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::SetOutputDir(const Handle(WOKUtils_Path)& apath)
+{
+ outputdir = apath;
+}
+
+//=======================================================================
+//function : OutputDir
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Path) WOKBuilder_Tool::OutputDir() const
+{
+ return outputdir;
+}
+
+
+//=======================================================================
+//function : SetName
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+ myname = aname;
+}
+
+//=======================================================================
+//function : Name
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Tool::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//function : Produces
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_Tool::Produces()
+{
+ return myproduction;
+}
+
+//=======================================================================
+//function : SetProduction
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::SetProduction(const Handle(WOKBuilder_HSequenceOfEntity)& alist)
+{
+ myproduction = alist;
+}
+
+//=======================================================================
+//function : SetParams
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::SetParams(const WOKUtils_Param& params)
+{
+ myparams = params;
+}
+
+//=======================================================================
+//function : EvalToolParameter
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Tool::EvalToolParameter(const Handle(TCollection_HAsciiString)& aparam) const
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(aparam.IsNull()) return astr;
+
+ astr = EvalToolParameter(aparam->ToCString());
+ return astr;
+}
+
+
+//=======================================================================
+//function : EvalToolParameter
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Tool::EvalToolParameter(const Standard_CString aparam) const
+{
+ Handle(TCollection_HAsciiString) astr;
+ TCollection_AsciiString name;
+
+ name.AssignCat("%");
+ name.AssignCat(Name()->ToCString());
+ name.AssignCat("_");
+ name.AssignCat(aparam);
+
+ astr = myparams.Eval(name.ToCString(), Standard_True);
+
+ return astr;
+}
+
+//=======================================================================
+//function : EvalToolParameter
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Tool::EvalToolTemplate(const Handle(TCollection_HAsciiString)& aparam) const
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(aparam.IsNull()) return astr;
+
+ astr = EvalToolTemplate(aparam->ToCString());
+ return astr;
+}
+
+
+//=======================================================================
+//function : EvalToolParameter
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_Tool::EvalToolTemplate(const Standard_CString aparam) const
+{
+ Handle(TCollection_HAsciiString) astr;
+ TCollection_AsciiString name;
+
+ name.AssignCat(Name()->ToCString());
+ name.AssignCat("_");
+ name.AssignCat(aparam);
+
+ astr = myparams.Eval(name.ToCString(), Standard_True);
+
+ return astr;
+}
+
+//=======================================================================
+//function : IsLoaded
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_Tool::IsLoaded() const {return myisloaded;}
+
+//=======================================================================
+//function : SetLoaded
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::SetLoaded() { myisloaded = Standard_True;}
+
+//=======================================================================
+//function : UnsetLoaded
+//purpose :
+//=======================================================================
+void WOKBuilder_Tool::UnsetLoaded() { myisloaded = Standard_False;}
+
+
+
+
+
+
+
--- /dev/null
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Params
+//purpose :
+//=======================================================================
+const WOKUtils_Param& WOKBuilder_Tool::Params() const
+{
+ return myparams;
+}
--- /dev/null
+-- File: WOKBuilder_ToolInProcess.cdl
+-- Created: Mon Sep 11 10:46:08 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class ToolInProcess from WOKBuilder
+inherits Tool from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Param from WOKUtils,
+ Path from WOKUtils,
+ HAsciiString from TCollection,
+ Function from OSD,
+ SharedLibrary from OSD
+raises
+ ProgramError from Standard
+is
+ Initialize(aname: HAsciiString from TCollection; params : Param from WOKUtils);
+
+ Load(me:mutable; alibrary: Path from WOKUtils; afunc : HAsciiString from TCollection);
+
+ Shared(me) returns HAsciiString from TCollection;
+ SetShared(me:mutable; ashared : HAsciiString from TCollection);
+
+ Function(me) returns Function from OSD;
+
+ UnLoad(me:mutable);
+
+fields
+ mylib : SharedLibrary from OSD;
+ myshared : HAsciiString from TCollection;
+ myfunc : Function from OSD;
+end ToolInProcess;
--- /dev/null
+// File: WOKBuilder_ToolInProcess.cxx
+// Created: Wed Aug 23 20:10:28 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#include <WOKBuilder_ToolInProcess.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+//=======================================================================
+//function : WOKBuilder_ToolInProcess
+//purpose :
+//=======================================================================
+WOKBuilder_ToolInProcess::WOKBuilder_ToolInProcess(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_Tool(aname,params), myfunc(NULL)
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInProcess::Load(const Handle(WOKUtils_Path)& alibrary,
+ const Handle(TCollection_HAsciiString)& afunc)
+{
+ Handle(WOKUtils_Path) libpath;
+
+ if(!alibrary->Exists())
+ {
+ libpath = Params().SearchFile(alibrary->Name());
+ if(libpath.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInProcess::Load"
+ << "Could not find file : " << alibrary->Name() << endm;
+ return;
+ }
+ }
+ else
+ {
+ libpath = alibrary;
+ }
+
+ // DlOpen of library
+ mylib.SetName(alibrary->Name()->ToCString());
+
+ if(mylib.DlOpen(OSD_RTLD_LAZY) == Standard_False)
+ {
+ ErrorMsg << "WOKBuilder_ToolInProcess" << mylib.DlError() << endm;
+ Standard_ProgramError::Raise("WOKBuilder_ToolInProcess");
+ }
+
+ myfunc = mylib.DlSymb(afunc->ToCString());
+
+ if(myfunc == NULL)
+ {
+ ErrorMsg << "WOKBuilder_ToolInProcess" << mylib.DlError() << endm;
+ ErrorMsg << "WOKBuilder_ToolInProcess" << "Error in DlSymb of : " << afunc << endm;
+ Standard_ProgramError::Raise("WOKBuilder_ToolInProcess");
+ }
+ SetLoaded();
+}
+
+//=======================================================================
+//function : Shared
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ToolInProcess::Shared() const
+{
+ return myshared;
+}
+
+//=======================================================================
+//function : SetShared
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInProcess::SetShared(const Handle(TCollection_HAsciiString)& ashared)
+{
+ myshared = ashared;
+}
+
+//=======================================================================
+//function : Function
+//purpose :
+//=======================================================================
+OSD_Function WOKBuilder_ToolInProcess::Function() const
+{
+ return myfunc;
+}
+
+//=======================================================================
+//function : UnLoad
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInProcess::UnLoad()
+{
+ mylib.DlClose();
+}
+
--- /dev/null
+-- File: WOKBuilder_ToolInShell.cdl
+-- Created: Wed Aug 23 20:28:04 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+deferred class ToolInShell from WOKBuilder
+inherits Tool from WOKBuilder
+
+ ---Purpose:
+
+uses
+ HSequenceOfEntity from WOKBuilder,
+ HSequenceOfExtension from WOKBuilder,
+ Param from WOKUtils,
+ Shell from WOKUtils,
+ HSequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection
+
+is
+
+ Initialize(aname: HAsciiString from TCollection; params : Param from WOKUtils);
+
+ Shell(me)
+ returns Shell from WOKUtils is protected;
+
+
+ SetShell(me:mutable; ashell : Shell from WOKUtils);
+ ResetShell(me) is protected;
+
+ SetTemplate(me:mutable; aname : HAsciiString from TCollection);
+ Template(me) returns HAsciiString from TCollection;
+
+ Extensions(me) returns HSequenceOfExtension from WOKBuilder;
+ SetExtensions(me:mutable; exts : HSequenceOfExtension from WOKBuilder);
+
+ TreatedExtensionNames(me) returns HSequenceOfHAsciiString from TColStd;
+
+ OptionLine(me)
+ returns HAsciiString from TCollection;
+
+ Load(me:mutable)
+ is redefined;
+
+ EvalProduction(me)
+ returns HSequenceOfEntity from WOKBuilder;
+
+fields
+ myfile : HAsciiString from TCollection;
+ myshell : Shell from WOKUtils;
+ mytemplate : HAsciiString from TCollection;
+ myexts : HSequenceOfExtension from WOKBuilder;
+end ToolInShell;
--- /dev/null
+// File: WOKBuilder_ToolInShell.cxx
+// Created: Wed Aug 23 20:10:30 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <Standard_ProgramError.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_Extension.hxx>
+
+
+#include <WOKBuilder_CDLFile.hxx>
+#include <WOKBuilder_Include.hxx>
+#include <WOKBuilder_CodeGenFile.hxx>
+#include <WOKBuilder_Compilable.hxx>
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_MFile.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_ArchiveLibrary.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+#include <WOKBuilder_CompressedFile.hxx>
+#include <WOKBuilder_TarFile.hxx>
+
+#include <WOKBuilder_ToolInShell.ixx>
+
+//=======================================================================
+//function : WOKBuilder_ToolInShell
+//purpose :
+//=======================================================================
+WOKBuilder_ToolInShell::WOKBuilder_ToolInShell(const Handle(TCollection_HAsciiString) &aname,
+ const WOKUtils_Param& params)
+ : WOKBuilder_Tool(aname, params)
+{
+}
+
+//=======================================================================
+//function : Shell
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Shell) WOKBuilder_ToolInShell::Shell() const
+{
+ return myshell;
+}
+
+//=======================================================================
+//function : SetShell
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShell::SetShell(const Handle(WOKUtils_Shell)& ashell )
+{
+ myshell = ashell;
+}
+
+//=======================================================================
+//function : ResetShell
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShell::ResetShell() const
+{
+ if(!myshell.IsNull())
+ myshell->Kill();
+}
+
+//=======================================================================
+//function : SetTemplate
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShell::SetTemplate(const Handle(TCollection_HAsciiString)& atempl)
+{
+ mytemplate = atempl;
+}
+
+//=======================================================================
+//function : Template
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ToolInShell::Template() const
+{
+ return mytemplate;
+}
+
+
+//=======================================================================
+//function : Extensions
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfExtension) WOKBuilder_ToolInShell::Extensions() const
+{
+ return myexts;
+}
+
+
+//=======================================================================
+//function : SetExtensions
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShell::SetExtensions(const Handle(WOKBuilder_HSequenceOfExtension)& exts)
+{
+ myexts = exts;
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShell::Load()
+{
+ Handle(TCollection_HAsciiString) astr;
+ Handle(TCollection_HAsciiString) afile;
+ Handle(WOKUtils_Path) apath;
+ Standard_Integer i=1;
+
+ // Extensions reconnues par le compilo
+ myexts = new WOKBuilder_HSequenceOfExtension;
+
+ astr = EvalToolParameter("Extensions");
+
+ while(!(afile= astr->Token(" \t", i))->IsEmpty())
+ {
+ apath = new WOKUtils_Path(afile);
+ myexts->Append(apath->Extension());
+ i++;
+ }
+
+ astr = EvalToolParameter("Template");
+ SetTemplate(astr);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : TreatedExtensionNames
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKBuilder_ToolInShell::TreatedExtensionNames() const
+{
+ Standard_Integer i = 1;
+ Handle(TCollection_HAsciiString) astr;
+ Handle(TCollection_HAsciiString) afile;
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+
+ astr = EvalToolParameter("Extensions");
+
+ while(!(afile= astr->Token(" \t", i))->IsEmpty())
+ {
+ Handle(WOKUtils_Path) apath = new WOKUtils_Path(afile);
+ result->Append(apath->ExtensionName());
+ i++;
+ }
+ return result;
+}
+
+//=======================================================================
+//function : OptionLine
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKBuilder_ToolInShell::OptionLine() const
+{
+ Handle(TCollection_HAsciiString) result;
+ Handle(TCollection_HAsciiString) opttpl;
+ Handle(TColStd_HSequenceOfHAsciiString) args;
+ Standard_Integer i;
+
+ if(opttpl.IsNull())
+ {
+ opttpl = new TCollection_HAsciiString(Name());
+ opttpl->AssignCat("_OptLine");
+
+ if(!Params().IsSet(opttpl->ToCString()))
+ {
+ return result;
+ }
+
+ args = Params().GetArguments(opttpl->ToCString());
+
+ for(i=1; i<=args->Length(); i++)
+ {
+ if(!Params().IsSet(args->Value(i)->ToCString()))
+ {
+ ErrorMsg << "WOKBuilder_ToolInShell::OptionLine"
+ << "Could not eval ToolInShell option argument : " << args->Value(i)->ToCString() << endm;
+ return result;
+ }
+ }
+ }
+
+ result = EvalToolTemplate("OptLine");
+ return result;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : EvalProduction
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_ToolInShell::EvalProduction() const
+{
+ Handle(WOKBuilder_HSequenceOfEntity) nullseq, result = new WOKBuilder_HSequenceOfEntity;
+ Handle(TCollection_HAsciiString) prodlist;
+ Handle(TCollection_HAsciiString) aprod;
+ Handle(WOKUtils_Path) apath;
+ Handle(WOKBuilder_Entity) anent;
+ Standard_Integer i = 1;
+
+ prodlist = EvalToolTemplate("Production");
+
+ if(prodlist.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShell::EvalProduction"
+ << "Coul not eval production of " << Name() << endm;
+ return nullseq;
+ }
+
+ aprod = prodlist->Token(" \t\n", i);
+
+ while(!aprod->IsEmpty())
+ {
+ apath = new WOKUtils_Path(OutputDir()->Name(), aprod);
+
+ switch(apath->Extension())
+ {
+ case WOKUtils_CFile:
+ case WOKUtils_CXXFile:
+ case WOKUtils_F77File:
+ anent = new WOKBuilder_Compilable(apath);
+ break;
+ case WOKUtils_ObjectFile:
+ anent = new WOKBuilder_ObjectFile(apath);
+ break;
+ case WOKUtils_MFile:
+ anent = new WOKBuilder_MFile(apath);
+ break;
+ case WOKUtils_CDLFile:
+ anent = new WOKBuilder_CDLFile(apath);
+ break;
+ case WOKUtils_HFile:
+ case WOKUtils_HXXFile:
+ case WOKUtils_IXXFile:
+ case WOKUtils_JXXFile:
+ case WOKUtils_LXXFile:
+ case WOKUtils_GXXFile:
+ case WOKUtils_PXXFile:
+ case WOKUtils_INCFile:
+ anent = new WOKBuilder_Include(apath);
+ break;
+ case WOKUtils_LexFile:
+ case WOKUtils_YaccFile:
+ case WOKUtils_PSWFile:
+ case WOKUtils_LWSFile:
+ anent = new WOKBuilder_CodeGenFile(apath);
+ break;
+ case WOKUtils_ArchiveFile:
+ anent = new WOKBuilder_ArchiveLibrary(apath);
+ break;
+ case WOKUtils_DSOFile:
+ anent = new WOKBuilder_SharedLibrary(apath);
+ break;
+ case WOKUtils_TarFile:
+ anent = new WOKBuilder_TarFile(apath);
+ break;
+ case WOKUtils_CompressedFile:
+ anent = new WOKBuilder_CompressedFile(apath);
+ break;
+ case WOKUtils_CSHFile:
+ case WOKUtils_DBFile:
+ case WOKUtils_FDDBFile:
+ case WOKUtils_DDLFile:
+ case WOKUtils_HO2File:
+ case WOKUtils_LibSchemaFile:
+ case WOKUtils_AppSchemaFile:
+ case WOKUtils_TemplateFile:
+ case WOKUtils_DATFile:
+ case WOKUtils_ODLFile:
+ case WOKUtils_IDLFile:
+ case WOKUtils_LispFile:
+ case WOKUtils_IconFile:
+ case WOKUtils_TextFile:
+ case WOKUtils_UnknownFile:
+ case WOKUtils_NoExtFile:
+ default:
+ anent = new WOKBuilder_Miscellaneous(apath);
+ break;
+ }
+
+ if(!anent.IsNull()) result->Append(anent);
+
+ i++;
+ aprod = prodlist->Token(" \t\n", i);
+ }
+
+ return result;
+}
+
+
--- /dev/null
+-- File: WOKBuilder_ToolInShellIterator.cdl
+-- Created: Thu Jul 11 21:33:46 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+class ToolInShellIterator from WOKBuilder
+
+ ---Purpose:
+
+uses
+ Entity from WOKBuilder,
+ HSequenceOfEntity from WOKBuilder,
+ ToolInShell from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ HSequenceOfToolInShell from WOKBuilder,
+ DataMapOfHAsciiStringOfToolInShell from WOKBuilder,
+ HSequenceOfPath from WOKUtils,
+ Shell from WOKUtils,
+ Param from WOKUtils,
+ Path from WOKUtils,
+ HAsciiString from TCollection
+is
+
+ Create(toolgroup : HAsciiString from TCollection;
+ Param : Param from WOKUtils)
+ returns ToolInShellIterator from WOKBuilder;
+
+ Create(tools : HSequenceOfToolInShell from WOKBuilder)
+ returns ToolInShellIterator from WOKBuilder;
+
+ Create(toolgroup : HAsciiString from TCollection;
+ ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils;
+ Param : Param from WOKUtils)
+ returns ToolInShellIterator from WOKBuilder;
+
+ Init(me:out; ashell : Shell from WOKUtils;
+ adir : Path from WOKUtils)
+ is virtual;
+
+ SetShell(me:out; ashell : Shell from WOKUtils);
+ Shell(me) returns Shell from WOKUtils;
+
+ SetParam(me:out; Param : Param from WOKUtils);
+ Param(me) returns Param from WOKUtils;
+
+ SetOutputDir(me:out; apath : Path from WOKUtils);
+ OutputDir(me) returns Path from WOKUtils;
+
+ GetTool(me;aname : HAsciiString from TCollection; params : Param from WOKUtils)
+ returns ToolInShell from WOKBuilder
+ is virtual;
+
+ LoadGroup(me:out)
+ returns Integer from Standard
+ is virtual;
+
+ Tools(me)
+ returns HSequenceOfToolInShell from WOKBuilder;
+
+ IsTreatedExtension(me; anext : HAsciiString from TCollection)
+ returns Boolean from Standard;
+
+ AppropriateTool(me; anent : Entity from WOKBuilder)
+ returns ToolInShell from WOKBuilder;
+
+ Produces(me)
+ returns HSequenceOfEntity from WOKBuilder;
+
+fields
+ mygroup : HAsciiString from TCollection;
+ myexts : DataMapOfHAsciiStringOfToolInShell from WOKBuilder;
+ myparams : Param from WOKUtils;
+ myshell : Shell from WOKUtils;
+ myoutdir : Path from WOKUtils;
+ mytools : HSequenceOfToolInShell from WOKBuilder;
+ myproduction : HSequenceOfEntity from WOKBuilder is protected;
+end CompilerIterator;
--- /dev/null
+// File: WOKBuilder_ToolInShellIterator.cxx
+// Created: Thu Jul 11 21:44:48 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Extension.hxx>
+
+#include <WOKBuilder_HSequenceOfExtension.hxx>
+#include <WOKBuilder_ToolInShell.hxx>
+#include <WOKBuilder_Command.hxx>
+#include <WOKBuilder_HSequenceOfToolInShell.hxx>
+#include <WOKBuilder_Entity.hxx>
+
+#include <WOKBuilder_ToolInShellIterator.ixx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_ToolInShellIterator
+//purpose :
+//=======================================================================
+WOKBuilder_ToolInShellIterator::WOKBuilder_ToolInShellIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const WOKUtils_Param& params)
+ : mygroup(agroup), myparams(params)
+{
+
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_ToolInShellIterator
+//purpose :
+//=======================================================================
+WOKBuilder_ToolInShellIterator::WOKBuilder_ToolInShellIterator(const Handle(WOKBuilder_HSequenceOfToolInShell)& atoolseq)
+ : mytools(atoolseq)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKBuilder_ToolInShellIterator
+//purpose :
+//=======================================================================
+WOKBuilder_ToolInShellIterator::WOKBuilder_ToolInShellIterator(const Handle(TCollection_HAsciiString)& agroup,
+ const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& apath,
+ const WOKUtils_Param& params)
+ : mygroup(agroup), myshell(ashell), myoutdir(apath), myparams(params)
+{
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShellIterator::Init(const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKUtils_Path)& apath)
+
+{
+ myshell = ashell; myoutdir = apath;
+
+ Handle(WOKBuilder_HSequenceOfToolInShell) tools = Tools();
+
+ if(!tools.IsNull())
+ {
+ for(Standard_Integer i=1; i<=tools->Length(); i++)
+ {
+ Handle(WOKBuilder_ToolInShell) atool = tools->Value(i);
+
+ atool->SetShell(ashell);
+ atool->SetOutputDir(apath);
+ }
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetTool
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_ToolInShell) WOKBuilder_ToolInShellIterator::GetTool(const Handle(TCollection_HAsciiString)& aname,
+ const WOKUtils_Param& params) const
+{
+ return new WOKBuilder_Command(aname,params);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetShell
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShellIterator::SetShell(const Handle(WOKUtils_Shell)& ashell)
+{
+ myshell = ashell;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Shell
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Shell) WOKBuilder_ToolInShellIterator::Shell() const
+{
+ return myshell;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetParams
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShellIterator::SetParam(const WOKUtils_Param& params)
+{
+ myparams = params;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Params
+//purpose :
+//=======================================================================
+WOKUtils_Param WOKBuilder_ToolInShellIterator::Param() const
+{
+ return myparams;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetOutputDir
+//purpose :
+//=======================================================================
+void WOKBuilder_ToolInShellIterator::SetOutputDir(const Handle(WOKUtils_Path)& apath)
+{
+ myoutdir = apath;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutputDir
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Path) WOKBuilder_ToolInShellIterator::OutputDir() const
+{
+ return myoutdir;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : LoadGroup
+//purpose :
+//=======================================================================
+Standard_Integer WOKBuilder_ToolInShellIterator::LoadGroup()
+{
+ Handle(TCollection_HAsciiString) varname, toolsnames, toolname;
+ Handle(WOKBuilder_ToolInShell) atool;
+
+ if(mygroup.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShellIterator::LoadGroup"
+ << "Cannot not load an unamed tool group" << endm;
+ return 1;
+ }
+
+ varname = new TCollection_HAsciiString("%");
+ varname->AssignCat(mygroup);
+ varname->AssignCat("_Tools");
+
+ toolsnames = myparams.Eval(varname->ToCString(), Standard_True);
+
+ if(toolsnames.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShellIterator::LoadGroup"
+ << "Cannot not eval tool list for group : " << mygroup << " (parameter : " << varname << ")" << endm;
+ return 1;
+ }
+
+ mytools = new WOKBuilder_HSequenceOfToolInShell;
+
+
+ Standard_Integer i=1;
+ toolname = toolsnames->Token(" \t\n", i);
+
+ while(!toolname->IsEmpty())
+ {
+ atool = GetTool(toolname, myparams);
+
+ if(atool.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShellIterator::LoadGroup"
+ << "Cannot not get Tool : " << toolname << endm;
+ return 1;
+ }
+
+ atool->Load();
+ atool->SetShell(myshell);
+ atool->SetOutputDir(myoutdir);
+
+ Handle(TColStd_HSequenceOfHAsciiString) extseq = atool->TreatedExtensionNames();
+
+ if(!extseq.IsNull())
+ {
+ Standard_Integer j;
+
+ for(j=1; j<=extseq->Length(); j++)
+ {
+ if(myexts.IsBound(extseq->Value(j)))
+ {
+ Handle(WOKBuilder_ToolInShell) prevtool = myexts.Find(extseq->Value(j));
+
+ WarningMsg << "WOKBuilder_ToolInShellIterator::LoadGroup"
+ << "Extension " << extseq->Value(j) << " is already recognized by " << prevtool->Name() << endm;
+
+ WarningMsg << "WOKBuilder_ToolInShellIterator::LoadGroup"
+ << "It is ignored for " << atool->Name() << endm;
+ }
+ else
+ {
+ myexts.Bind(extseq->Value(j), atool);
+ }
+ }
+ }
+
+ mytools->Append(atool);
+
+ i++;
+ toolname = toolsnames->Token(" \t\n", i);
+ }
+
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Tools
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfToolInShell) WOKBuilder_ToolInShellIterator::Tools() const
+{
+ return mytools;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsTreatedExtension
+//purpose :
+//=======================================================================
+Standard_Boolean WOKBuilder_ToolInShellIterator::IsTreatedExtension(const Handle(TCollection_HAsciiString)& anext) const
+{
+ if(myexts.IsBound(anext))
+ return Standard_True;
+ return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AppropriateTool
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_ToolInShell) WOKBuilder_ToolInShellIterator::AppropriateTool(const Handle(WOKBuilder_Entity)& anent) const
+{
+ Handle(WOKBuilder_HSequenceOfExtension) exts;
+ Handle(TCollection_HAsciiString) Ext;
+ Handle(WOKBuilder_ToolInShell) NULLTOOL;
+
+ if(anent.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShellIterator::AppropriateTool"
+ << "Cannot determine Tool for Null Entity" << endm;
+ return NULLTOOL;
+ }
+
+ if(anent->Path().IsNull())
+ {
+ ErrorMsg << "WOKBuilder_ToolInShellIterator::AppropriateTool"
+ << "Cannot determine Tool for Null path entity" << endm;
+ return NULLTOOL;
+ }
+
+ Ext = anent->Path()->ExtensionName();
+
+ if(myexts.IsBound(Ext))
+ {
+ return myexts.Find(Ext);
+ }
+ return NULLTOOL;
+}
+
+
+//=======================================================================
+//function : Produces
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_HSequenceOfEntity) WOKBuilder_ToolInShellIterator::Produces() const
+{
+ return myproduction;
+}
--- /dev/null
+-- File: WOKBuilder_WNTCollector.cdl
+-- Created: Mon Oct 21 12:26:51 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+deferred class WNTCollector from WOKBuilder inherits ToolInShell from WOKBuilder
+
+ ---Purpose: defines abstract class to provide collection of
+ -- input files ( Windows NT specific )
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils,
+ File from OSD,
+ HSequenceOfObjectFile from WOKBuilder,
+ BuildStatus from WOKBuilder,
+ Path from WOKUtils
+
+ is
+
+ Initialize (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ );
+ ---Purpose: initialization
+
+ SetTargetName ( me : mutable; aName : HAsciiString from TCollection );
+ ---Purpose: sets name for target
+
+ TargetName ( me ) returns HAsciiString from TCollection;
+ ---Purpose: retrieves the target name
+
+ OpenCommandFile ( me : mutable ) returns Boolean from Standard;
+ ---Purpose: creates tool command file
+
+ CloseCommandFile ( me : mutable ) returns Boolean from Standard;
+ ---Purpose: closes tool command file
+
+ EvalCFExt ( me : mutable )
+ returns HAsciiString from TCollection is deferred;
+ ---Purpose: evaluates extension for name of the command file
+
+ EvalHeader ( me : mutable ) returns HAsciiString from TCollection is deferred;
+ ---Purpose: evaluats tool command line
+
+ ProduceObjectList (
+ me : mutable;
+ anObjectList : HSequenceOfObjectFile from WOKBuilder
+ );
+ ---Purpose: writes list of the object files to the command file
+
+ EvalFooter ( me : mutable ) returns HAsciiString from TCollection is deferred;
+ ---Purpose: evaluates additional information for the tool
+
+ Execute ( me : mutable )
+ returns BuildStatus from WOKBuilder
+ is redefined static;
+ ---Purpose: executes a tool ( library manager )
+
+ fields
+
+ myTargetName : HAsciiString from TCollection is protected;
+ myCommandFile : File from OSD is protected;
+
+end WNTCollector;
--- /dev/null
+#include <WOKBuilder_WNTCollector.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <OSD_Protection.hxx>
+
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_ExportLibrary.hxx>
+#include <WOKBuilder_HSequenceOfEntity.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_RegExp.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#ifdef WNT
+# define FASTCALL __fastcall
+#else
+# define FASTCALL
+#endif //WNT
+
+static void FASTCALL _print_output ( Standard_CString, WOKBuilder_Tool* );
+static void FASTCALL _delete_file ( const Handle( TCollection_HAsciiString )& );
+
+WOKBuilder_WNTCollector::WOKBuilder_WNTCollector (const Handle(TCollection_HAsciiString)& aName,
+ const WOKUtils_Param& aParams)
+: WOKBuilder_ToolInShell ( aName, aParams )
+{
+}
+
+void WOKBuilder_WNTCollector::SetTargetName(const Handle( TCollection_HAsciiString )& aName)
+{
+ Params ().Set ( "%CollectorOutput", aName -> ToCString () );
+ myTargetName = aName;
+}
+
+Standard_Boolean WOKBuilder_WNTCollector::OpenCommandFile()
+{
+ Standard_Boolean retVal = Standard_False;
+
+ Handle(TCollection_HAsciiString) ext = EvalCFExt();
+
+ if(ext.IsNull())
+ {
+ ErrorMsg << "WOKBuilder_WNTCollector::OpenCommandFile"
+ << "Could not evaluate extension for tool command file" << endm;
+ }
+ else
+ {
+ Handle(TCollection_HAsciiString) fileName = new TCollection_HAsciiString(myTargetName);
+ fileName->AssignCat(ext);
+
+ myCommandFile.SetPath(OSD_Path(fileName->String()));
+ myCommandFile.Build(OSD_WriteOnly, OSD_Protection());
+
+ if(myCommandFile.Failed())
+ {
+ ErrorMsg << "WOKBuilder_WNTCollector :: OpenCommandFile"
+ << "Could not create tool command file '" << fileName << "' - " << endm;
+ myCommandFile.Perror ();
+ }
+ else
+ retVal = Standard_True;
+ }
+ return retVal;
+}
+
+Standard_Boolean WOKBuilder_WNTCollector::CloseCommandFile()
+{
+ Standard_Boolean retVal = Standard_False;
+
+ myCommandFile.Close();
+
+ if(myCommandFile.Failed())
+ {
+ ErrorMsg << "WOKBuilder_WNTCollector :: OpenCommandFile"
+ << "Could not create tool command file - " << endm;
+ myCommandFile.Perror ();
+ }
+ else
+ retVal = Standard_True;
+ return retVal;
+}
+
+void WOKBuilder_WNTCollector::ProduceObjectList(const Handle(WOKBuilder_HSequenceOfObjectFile)& anObjectList)
+{
+ for( Standard_Integer i=1; i<=anObjectList->Length(); ++i)
+ {
+ TCollection_AsciiString line = anObjectList->Value(i)->Path()->Name()->String();
+
+ line.AssignCat("\r\n");
+ myCommandFile.Write(line,line.Length());
+ }
+}
+
+WOKBuilder_BuildStatus WOKBuilder_WNTCollector::Execute()
+{
+ static Handle(WOKUtils_RegExp) linkerLogo = new WOKUtils_RegExp (new TCollection_HAsciiString("[ \t]*Creating library.* and object.*"));
+
+ Standard_Integer i;
+ TCollection_AsciiString cmdFile;
+ OSD_Path cmdPath;
+ Handle(WOKUtils_Path) prodPath;
+ Handle(TColStd_HSequenceOfHAsciiString) errmsgs;
+ Handle(TCollection_HAsciiString) cmdFileName;
+
+ myCommandFile.Path(cmdPath);
+ cmdPath.SystemName(cmdFile);
+
+ if(!Shell()->IsLaunched()) Shell()->Launch();
+
+ Shell()->ClearOutput();
+
+ Shell()->Send(EvalHeader());
+ Shell()->Send(new TCollection_HAsciiString("@"));
+ Shell()->Send(cmdFileName = new TCollection_HAsciiString(cmdFile));
+ Shell()->Send(new TCollection_HAsciiString(" "));
+ Shell()->Send(EvalFooter());
+
+ _print_output("Creating : ", this);
+
+ Shell()->Execute(new TCollection_HAsciiString(" "));
+
+ _delete_file(cmdFileName);
+
+ if(Shell()->Status())
+ {
+ Standard_Boolean ph = ErrorMsg.PrintHeader();
+
+ ErrorMsg << "WOKBuilder_WNTCollector :: Execute" << "Errors Occured :" << endm;
+
+ errmsgs = Shell()->Errors();
+
+ ErrorMsg.DontPrintHeader();
+
+ for( i=1; i<=errmsgs->Length(); i++)
+ {
+ if(linkerLogo->Match(errmsgs->Value(i)) != -1) continue;
+
+ ErrorMsg << "WOKBuilder_WNTCollector :: Execute" << errmsgs -> Value ( i ) << endm;
+ }
+
+ if(ph) ErrorMsg.DoPrintHeader();
+
+ _print_output("Failed : ", this);
+
+ Shell()->ClearOutput();
+
+ return WOKBuilder_Failed;
+ }
+ else
+ {
+ Handle(WOKBuilder_Entity) ent;
+ Standard_Boolean ph = InfoMsg.PrintHeader();
+
+ InfoMsg << "WOKBuilder_WNTCollector::Execute" << "Succeeded : ";
+
+ for( i=1; i<=Produces()->Length(); ++i)
+ {
+ ent = Produces()->Value(i);
+
+ if(ent->IsKind(STANDARD_TYPE(WOKBuilder_ExportLibrary))) continue;
+
+ prodPath = ent->Path();
+ if(prodPath->Exists())
+ InfoMsg << prodPath->FileName() << " ";
+ }
+
+ InfoMsg << endm;
+ InfoMsg.DontPrintHeader();
+
+ errmsgs = Shell()->Errors();
+
+ for( i=1; i<=errmsgs->Length(); i++)
+ {
+ if(linkerLogo->Match(errmsgs->Value(i))!=-1) continue;
+
+ InfoMsg << "WOKBuilder_WNTCollector::Execute" << errmsgs->Value(i) << endm;
+ }
+
+ if(ph) InfoMsg.DoPrintHeader();
+ }
+
+ Shell()->ClearOutput();
+
+ return WOKBuilder_Success;
+}
+
+static void FASTCALL _print_output( Standard_CString msg, WOKBuilder_Tool* tool)
+{
+ Handle(WOKBuilder_Entity) ent;
+
+ InfoMsg << "WOKBuilder_WNTCollector::Execute"
+ << msg;
+
+ for(Standard_Integer i=1; i<=tool->Produces()->Length(); ++i)
+ {
+ ent = tool->Produces()->Value(i);
+
+ if(ent->IsKind(STANDARD_TYPE(WOKBuilder_ExportLibrary))) continue;
+
+ InfoMsg << ent -> Path () -> FileName () << " ";
+ }
+
+ InfoMsg << endm;
+}
+
+static void FASTCALL _delete_file(const Handle(TCollection_HAsciiString)& name)
+{
+ Handle(WOKUtils_Path) path = new WOKUtils_Path(name);
+
+ if(path->Exists()) path->RemoveFile();
+}
--- /dev/null
+-- File: WOKBuilder_WNTLibrary.cdl
+-- Created: Mon Oct 21 13:30:04 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+deferred class WNTLibrarian from WOKBuilder inherits WNTCollector from WOKBuilder
+
+ ---Purpose: defines link tool ( library manager )
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils
+
+ is
+
+ Initialize (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ );
+ ---Purpose: initialization
+
+ EvalCFExt ( me : mutable )
+ returns HAsciiString from TCollection is redefined static;
+ ---Purpose: evaluates extension for name of the command file
+
+end WNTLibrarian;
--- /dev/null
+#include <WOKBuilder_WNTLibrarian.ixx>
+
+WOKBuilder_WNTLibrarian::WOKBuilder_WNTLibrarian(const Handle(TCollection_HAsciiString)& aName,
+ const WOKUtils_Param& aParams)
+: WOKBuilder_WNTCollector(aName,aParams)
+{
+}
+
+Handle(TCollection_HAsciiString) WOKBuilder_WNTLibrarian::EvalCFExt()
+{
+ return EvalToolParameter("LibraryCFExt");
+}
--- /dev/null
+-- File: WOKBuilder_WNTLinker.cdl
+-- Created: Mon Oct 21 12:57:17 1996
+-- Author: PLOTNIKOV Eugeny
+-- <eugeny@maniax>
+---Copyright: Matra Datavision 1996
+
+deferred class WNTLinker from WOKBuilder inherits WNTCollector from WOKBuilder
+
+ ---Purpose: defines link tool ( linker )
+
+ uses
+
+ HAsciiString from TCollection,
+ Param from WOKUtils,
+ HSequenceOfLibrary from WOKBuilder,
+ HSequenceOfHAsciiString from TColStd,
+ DEFile from WOKBuilder
+
+ is
+
+ Initialize (
+ aName : HAsciiString from TCollection;
+ aParams : Param from WOKUtils
+ );
+ ---Purpose: initialization
+
+ ProduceDEFile (
+ me : mutable;
+ aDEFile : DEFile from WOKBuilder
+ );
+ ---Purpose: writes DEF file specification to the tool command file
+
+ ProduceLibraryList (
+ me : mutable;
+ aLibList : HSequenceOfLibrary from WOKBuilder
+ );
+ ---Purpose: writes list of libraries to the tool command file
+
+ ProduceExternList (
+ me : mutable;
+ anExternList : HSequenceOfHAsciiString from TColStd
+ );
+ ---Purpose: writes list of the external references to the tool command file
+
+end WNTLinker;
--- /dev/null
+#include <WOKBuilder_WNTLinker.ixx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKBuilder_Library.hxx>
+
+WOKBuilder_WNTLinker::WOKBuilder_WNTLinker(const Handle(TCollection_HAsciiString)& aName,
+ const WOKUtils_Param& aParams)
+: WOKBuilder_WNTCollector( aName, aParams )
+{
+}
+
+void WOKBuilder_WNTLinker::ProduceDEFile(const Handle(WOKBuilder_DEFile)& aDEFile)
+{
+ Handle(TCollection_HAsciiString) defLine = EvalToolParameter("LinkerDEFSwitch");
+
+ if(!defLine.IsNull())
+ {
+ defLine->AssignCat(aDEFile->Path()->Name());
+ defLine->AssignCat("\r\n");
+
+ myCommandFile.Write(defLine->String(), defLine->Length());
+ }
+}
+
+void WOKBuilder_WNTLinker::ProduceLibraryList(const Handle(WOKBuilder_HSequenceOfLibrary)& aLibList)
+{
+ for ( int i=1; i<=aLibList->Length(); ++i)
+ {
+ TCollection_AsciiString line = aLibList->Value(i)->Path()->Name()->String();
+
+ line.AssignCat("\r\n");
+ myCommandFile.Write(line,line.Length());
+ }
+}
+
+void WOKBuilder_WNTLinker::ProduceExternList(const Handle(TColStd_HSequenceOfHAsciiString)& anExternList)
+{
+ for(Standard_Integer i=1; i<=anExternList->Length(); ++i )
+ {
+ TCollection_AsciiString line = anExternList->Value(i)->String();
+
+ line.AssignCat("\r\n");
+ myCommandFile.Write(line, line.Length());
+ }
+}
+