--- /dev/null
+WOKMake_Step_1.cxx
+WOKMake_AdmFileTypes.hxx
+WOKMake_StepAccessMacro.hxx
+WOKMake_StepConstructPtr.hxx
--- /dev/null
+-- File: WOKMake.cdl
+-- Created: Wed 28 Jun 15:22:48 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+package WOKMake
+
+ ---Purpose: umake Command
+ --
+ -- Implements the Notion of a WOKernel Entities Construction
+ --
+ -- WOKMake Handles the link beetween WOKernel and WOKBuilder
+ --
+
+uses
+ WOKernel,
+ WOKBuilder,
+ WOKUtils,
+ WOKTools,
+ TColStd,
+ TCollection,
+ MMgt,
+ Standard
+is
+
+ enumeration DependStatus is Unknown, TargetNotFound, DepListChanged, OutOfDate
+ ---Purpose: Lists various cases of dependance status
+ end DependStatus;
+
+ enumeration Status is Uptodate, Success, Incomplete, Failed, Processed, Unprocessed;
+ ---Purpose: Status of Step Execution
+ --
+ -- UpToDate : All out Entities are built and UpToDate
+ -- Success : Entities out of date where processed successfully
+ -- Incomplete : Available Entities out of date where processed successfully
+ -- (but some are still missing)
+ -- Failed : Some of the entities could not be processed.
+
+ enumeration StepOption is Force, None;
+
+ enumeration FileStatus is Undetermined, Disappeared, New, Same, Moved;
+
+ --class StepDescrExplorer;
+
+ deferred class StepFile;
+ class InputFile;
+ class OutputFile;
+
+ class DepItem;
+
+ imported StepConstructPtr;
+ class StepBuilder;
+
+ deferred class Step;
+
+ class MetaStep;
+ class TriggerStep;
+
+ --class StepDescr;
+ class BuildProcessGroup;
+ class BuildProcess;
+ ---Purpose: BuildProcess handles Step Sequence execution
+ -- (within a unit or units)
+
+ class BuildProcessIterator;
+
+ pointer BuildProcessPtr to BuildProcess from WOKMake;
+
+-- INSTANTIATIONS
+
+ class SequenceOfInputFile
+ instantiates Sequence from TCollection ( InputFile from WOKMake );
+ class HSequenceOfInputFile
+ instantiates HSequence from TCollection ( InputFile from WOKMake ,
+ SequenceOfInputFile from WOKMake );
+ class SequenceOfOutputFile
+ instantiates Sequence from TCollection ( OutputFile from WOKMake );
+ class HSequenceOfOutputFile
+ instantiates HSequence from TCollection ( OutputFile from WOKMake ,
+ SequenceOfOutputFile from WOKMake );
+
+ class SequenceOfStepOption
+ instantiates Sequence from TCollection ( StepOption from WOKMake );
+
+ class HSequenceOfStepOption
+ instantiates HSequence from TCollection ( StepOption from WOKMake,
+ SequenceOfStepOption from WOKMake );
+
+ class IndexedDataMapOfBuildProcessGroup
+ instantiates IndexedDataMap from WOKTools ( HAsciiString from TCollection,
+ BuildProcessGroup from WOKMake,
+ HAsciiStringHasher from WOKTools );
+
+ private class DataMapOfHAsciiStringOfDevUnit
+ ---Purpose: Used To List Known DevUnits in a visibility
+ -- Accelerates Step ImplementationDep
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ DevUnit from WOKernel,
+ HAsciiStringHasher from WOKTools );
+
+ class IndexedDataMapOfHAsciiStringOfInputFile
+ instantiates IndexedDataMap from WOKTools ( HAsciiString from TCollection,
+ InputFile from WOKMake,
+ HAsciiStringHasher from WOKTools );
+
+ class IndexedDataMapOfHAsciiStringOfOutputFile
+ instantiates IndexedDataMap from WOKTools ( HAsciiString from TCollection,
+ OutputFile from WOKMake,
+ HAsciiStringHasher from WOKTools );
+
+ private class DepItemHasher;
+ class IndexedMapOfDepItem
+ instantiates IndexedMap from WOKTools ( DepItem from WOKMake,
+ DepItemHasher from WOKMake );
+
+ class DataMapOfHAsciiStringOfStep
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ Step from WOKMake,
+ HAsciiStringHasher from WOKTools );
+
+ class DataMapOfHAsciiStringOfSequenceOfHAsciiString
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ SequenceOfHAsciiString from TColStd,
+ HAsciiStringHasher from WOKTools );
+
+ class DataMapOfHAsciiStringOfStepBuilder
+ instantiates DataMap from WOKTools ( HAsciiString from TCollection,
+ StepBuilder from WOKMake,
+ HAsciiStringHasher from WOKTools );
+end WOKMake;
--- /dev/null
+// File: WOKMake_AdmFileTypes.hxx
+// Created: Wed Mar 6 20:10:35 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+#ifndef WOKMake_AdmFileTypes_HeaderFile
+#define WOKMake_AdmFileTypes_HeaderFile
+
+static const char ADMFILE[] = "admfile";
+static const char DBADMFILE[] = "dbadmfile";
+static const char STADMFILE[] = "stadmfile";
+
+static const char TMPDIR[] = "tmpdir";
+static const char DBTMPDIR[] = "dbtmpdir";
+static const char STTMPDIR[] = "sttmpdir";
+
+#endif
--- /dev/null
+-- File: WOKMake_BuildProcess.cdl
+-- Created: Wed Mar 19 16:20:44 1997
+-- Author: Jean GAUTIER
+-- <jga@hourax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1997
+
+
+class BuildProcess from WOKMake
+inherits TShared from MMgt
+
+ ---Purpose:
+
+uses
+ HAsciiString from TCollection,
+ Shell from WOKUtils,
+ DevUnit from WOKernel,
+ UnitGraph from WOKernel,
+ Locator from WOKernel,
+ MSTranslatorIterator from WOKBuilder,
+ BuildProcessGroup from WOKMake,
+ Step from WOKMake,
+ DataMapOfHAsciiStringOfStep from WOKMake,
+ IndexedDataMapOfBuildProcessGroup from WOKMake,
+ HSequenceOfHAsciiString from TColStd,
+ SequenceOfHAsciiString from TColStd,
+ Boolean from Standard,
+ MapOfHAsciiString from WOKTools,
+ IndexedDataMapOfHAsciiStringOfInputFile from WOKMake,
+ DataMapOfHAsciiStringOfSequenceOfHAsciiString from WOKMake
+
+is
+
+ Create(alocator : Locator from WOKernel; ashell : Shell from WOKUtils; aunitgraph : UnitGraph from WOKernel)
+ returns mutable BuildProcess from WOKMake;
+
+
+ UnitGraph(me)
+ ---C++: return const &
+ ---C++: inline
+ returns UnitGraph from WOKernel;
+
+ Locator(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Locator from WOKernel;
+
+ Shell(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Shell from WOKUtils;
+
+ TranslatorIterator(me:mutable)
+ ---C++: return &
+ ---C++: inline
+ returns MSTranslatorIterator from WOKBuilder;
+
+ GetKnownUnits(me:mutable);
+
+ KnownUnits(me:mutable)
+ ---C++: return &
+ ---C++: inline
+ returns MapOfHAsciiString from WOKTools;
+
+ MakeState(me:mutable)
+ ---C++: return &
+ ---C++: inline
+ returns IndexedDataMapOfHAsciiStringOfInputFile from WOKMake;
+
+ ComputeSteps(me:mutable; aunit : DevUnit from WOKernel)
+ returns Boolean from Standard;
+
+ RemoveStep(me:mutable; aid : HAsciiString from TCollection)
+ returns Boolean from Standard;
+
+ RemoveUnit(me:mutable; aname : HAsciiString from TCollection)
+ returns Boolean from Standard;
+
+ ClearUnits(me:mutable);
+
+ Steps(me)
+ ---C++: return const &
+ ---C++: inline
+ returns DataMapOfHAsciiStringOfStep from WOKMake;
+
+ ClearGroups(me:mutable);
+
+ Groups(me)
+ ---C++: return const &
+ ---C++: inline
+ returns IndexedDataMapOfBuildProcessGroup from WOKMake;
+
+ Units(me)
+ ---C++: return const &
+ ---C++: inline
+ returns DataMapOfHAsciiStringOfSequenceOfHAsciiString from WOKMake;
+
+ GetGroup(me:mutable; aname : HAsciiString from TCollection)
+ returns BuildProcessGroup from WOKMake;
+
+ AddStep(me:mutable; astep : Step from WOKMake) is private;
+
+ StepExists(me:mutable; aunit : DevUnit from WOKernel; acode : HAsciiString from TCollection)
+ returns Boolean from Standard;
+
+ GetStepFromID(me:mutable; anid : HAsciiString from TCollection)
+ returns Step from WOKMake;
+
+ GetAndAddStep(me:mutable; aunit : DevUnit from WOKernel; acode, asubcode : HAsciiString from TCollection)
+ ---C++: return const &
+ returns Step from WOKMake;
+
+ IsUnitInProcess(me; aname : HAsciiString from TCollection)
+ returns Boolean from Standard;
+
+ GetUnitSteps(me; aunit : HAsciiString from TCollection)
+ ---C++: return const &
+ returns SequenceOfHAsciiString from TColStd;
+
+ Find(me; aunit : DevUnit from WOKernel; acode, asubcode : HAsciiString from TCollection)
+ ---C++: return const &
+ returns Step from WOKMake;
+
+ Find(me; anid : HAsciiString from TCollection)
+ ---C++: return const &
+ returns Step from WOKMake;
+
+fields
+
+ myunitgraph : UnitGraph from WOKernel;
+ mylocator : Locator from WOKernel;
+ myshell : Shell from WOKUtils;
+ mycdlit : MSTranslatorIterator from WOKBuilder;
+ myknownunits : MapOfHAsciiString from WOKTools;
+ mymakestate : IndexedDataMapOfHAsciiStringOfInputFile from WOKMake;
+
+ mysteps : DataMapOfHAsciiStringOfStep from WOKMake;
+ mygroups : IndexedDataMapOfBuildProcessGroup from WOKMake;
+ myunits : DataMapOfHAsciiStringOfSequenceOfHAsciiString from WOKMake;
+
+end BuildProcess;
--- /dev/null
+// File: WOKMake_BuildProcess.cxx
+// Created: Mon Mar 24 13:45:01 1997
+// Author: Jean GAUTIER
+// <jga@hourax.paris1.matra-dtv.fr>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKBuilder_MSTool.hxx>
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_UnitNesting.hxx>
+
+#include <WOKMake_StepBuilder.hxx>
+
+#include <WOKMake_BuildProcess.ixx>
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_BuildProcess
+//purpose :
+//=======================================================================
+WOKMake_BuildProcess::WOKMake_BuildProcess(const Handle(WOKernel_Locator)& alocator,
+ const Handle(WOKUtils_Shell)& ashell,
+ const Handle(WOKernel_UnitGraph)& agraph)
+: mylocator(alocator), myshell(ashell), myunitgraph(agraph), mycdlit(WOKBuilder_MSTool::GetMSchema())
+{
+}
+
+//=======================================================================
+//function : GetKnownUnits
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcess::GetKnownUnits()
+{
+ if(!myknownunits.Extent())
+ {
+ // Liste des Uds connues
+ Handle(TColStd_HSequenceOfHAsciiString) aseq = mylocator->Visibility();
+ Handle(TColStd_HSequenceOfHAsciiString) units;
+ Handle(TCollection_HAsciiString) aunitname;
+ Handle(TCollection_HAsciiString) afullname, abasename;
+ Standard_Integer i,j;
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ const Handle(WOKernel_UnitNesting)& anesting = mylocator->Session()->GetUnitNesting(aseq->Value(i));
+ anesting->Open();
+
+ units = anesting->Units();
+
+ for(j=1; j<=units->Length(); j++)
+ {
+ aunitname = mylocator->Session()->GetDevUnit(units->Value(j))->Name();
+ if(!myknownunits.Contains(aunitname))
+ {
+ myknownunits.Add(aunitname);
+ }
+ }
+ }
+ }
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ComputeSteps
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcess::ComputeSteps(const Handle(WOKernel_DevUnit)& aunit)
+{
+
+
+ if(myunits.IsBound(aunit->Name())) return Standard_False;
+
+ Handle(TCollection_HAsciiString) groups = aunit->Params().Eval("%WOKSteps_Groups");
+
+ if(groups.IsNull())
+ {
+ ErrorMsg << "WOKMake_BuildProcess::ComputeSteps"
+ << "Could not eval %WOKSteps_Groups setting build process groups" << endm;
+ return Standard_True;
+ }
+
+ Standard_Integer i = 1;
+ Handle(TCollection_HAsciiString) group = groups->Token(" \t", i);
+
+ myunits.Bind(aunit->Name(), TColStd_SequenceOfHAsciiString());
+
+ TColStd_SequenceOfHAsciiString& unitsteps = myunits(aunit->Name());
+
+ while(!group->IsEmpty())
+ {
+ Handle(WOKMake_BuildProcessGroup) agroup = GetGroup(group);
+
+
+ Handle(TCollection_HAsciiString) groupstepsname = new TCollection_HAsciiString("%WOKSteps_");
+
+ groupstepsname->AssignCat(group);
+ groupstepsname->AssignCat("Group");
+
+ Handle(TCollection_HAsciiString) groupsteps = aunit->Params().Eval(groupstepsname->ToCString());
+
+ if(!groupsteps.IsNull())
+ {
+ Standard_Integer j=1;
+ Handle(TCollection_HAsciiString) step = groupsteps->Token(" \t", j);
+
+ while(!step->IsEmpty())
+ {
+ Handle(WOKMake_Step) thestep = WOKMake_StepBuilder::BuildStep(this, aunit, step, Handle(TCollection_HAsciiString)());
+
+ if(!thestep.IsNull())
+ {
+ agroup->AddStep(thestep->UniqueName());
+ unitsteps.Append(thestep->UniqueName());
+ if(!mysteps.IsBound(thestep->UniqueName())) mysteps.Bind(thestep->UniqueName(), thestep);
+ }
+ else
+ {
+ ErrorMsg << "WOKMake_BuildProcess::ComputeSteps"
+ << "Could not build step " << step << " for unit " << aunit->Name() << endm;
+ }
+ j++;
+ step = groupsteps->Token(" \t", j);
+ }
+ }
+ else
+ {
+ WarningMsg << "WOKMake_BuildProcess::ComputeSteps"
+ << "Could not eval step group " << group << " (%WOKSteps_" << group << "Group" << ")" << endm;
+ }
+
+ if(!mygroups.Contains(agroup->Name()))
+ mygroups.Add(agroup->Name(), agroup);
+
+ i++;
+ group = groups->Token(" \t", i);
+ }
+
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : RemoveStep
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcess::RemoveStep(const Handle(TCollection_HAsciiString)& anid)
+{
+ if(mysteps.IsBound(anid))
+ {
+ mysteps.UnBind(anid);
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : RemoveStep
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcess::RemoveUnit(const Handle(TCollection_HAsciiString)& aname)
+{
+ if(myunits.IsBound(aname))
+ {
+ TColStd_SequenceOfHAsciiString& steps = myunits.ChangeFind(aname);
+
+ for(Standard_Integer i=1; i<steps.Length(); i++)
+ {
+ mysteps.UnBind(steps.Value(i));
+ }
+ steps.Clear();
+ return Standard_True;
+ }
+ return Standard_False;
+}
+//=======================================================================
+//function : ClearUnits
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcess::ClearUnits()
+{
+ myunits.Clear();
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetGroup
+//purpose :
+//=======================================================================
+Handle(WOKMake_BuildProcessGroup) WOKMake_BuildProcess::GetGroup(const Handle(TCollection_HAsciiString)& aname)
+{
+ if(mygroups.Contains(aname)) return mygroups.FindFromKey(aname);
+ else
+ {
+ Handle(WOKMake_BuildProcessGroup) result = new WOKMake_BuildProcessGroup(this, aname);
+ mygroups.Add(result->Name(), result);
+ return result;
+ }
+}
+
+//=======================================================================
+//function : ClearGroups
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcess::ClearGroups()
+{
+ mygroups.Clear();
+}
+
+//=======================================================================
+//function : StepExists
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcess::StepExists(const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode)
+{
+ Handle(TCollection_HAsciiString) anid = WOKMake_Step::UniqueName(aunit, acode, Handle(TCollection_HAsciiString)());
+
+ if(mysteps.IsBound(anid)) return Standard_True;
+
+ if(myunits.IsBound(aunit->Name()))
+ {
+ return Standard_False;
+ }
+ else
+ {
+ Handle(WOKMake_Step) thestep = WOKMake_StepBuilder::BuildStep(this, aunit, acode,Handle(TCollection_HAsciiString)());
+ if(!thestep.IsNull())
+ return Standard_True;
+ else
+ return Standard_False;
+ }
+}
+
+//=======================================================================
+//function : GetStepFromID
+//purpose :
+//=======================================================================
+Handle(WOKMake_Step) WOKMake_BuildProcess::GetStepFromID(const Handle(TCollection_HAsciiString)& anid)
+{
+ Handle(WOKMake_Step) result;
+
+ if(mysteps.IsBound(anid))
+ {
+ result = mysteps.Find(anid);
+ }
+
+ if(result.IsNull())
+ {
+ Handle(TCollection_HAsciiString) uname, acode, asubcode;
+
+ WOKMake_Step::SplitUniqueName(anid, uname, acode, asubcode);
+
+ Handle(WOKernel_DevUnit) aunit = Locator()->LocateDevUnit(uname);
+
+ if(!aunit.IsNull())
+ {
+ result = WOKMake_StepBuilder::BuildStep(this, aunit, acode,asubcode);
+
+ if(result.IsNull())
+ {
+ ErrorMsg << "WOKMake_BuildProcess::GetStepFromID"
+ << "Cannot get step " << acode << " for unit " << aunit->Name() << " (type : " << aunit->Type() << ")" << endm;
+ return result;
+ }
+ mysteps.Bind(result->UniqueName(), result);
+ }
+ else
+ {
+ ErrorMsg << "WOKMake_BuildProcess::GetStepFromID"
+ << "Cannot locate dev unit : " << uname << endm;
+ return result;
+ }
+ }
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetAndAddStep
+//purpose :
+//=======================================================================
+const Handle(WOKMake_Step)& WOKMake_BuildProcess::GetAndAddStep(const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Handle(TCollection_HAsciiString)& asubcode)
+{
+ static Handle(WOKMake_Step) NULLRESULT;
+ Handle(TCollection_HAsciiString) anid = WOKMake_Step::UniqueName(aunit, acode, asubcode);
+
+ if(mysteps.IsBound(anid))
+ {
+ const Handle(WOKMake_Step)& result = mysteps.Find(anid);
+
+ if(result.IsNull())
+ return NULLRESULT;
+ else return result;
+ }
+
+ if(myunits.IsBound(aunit->Name()) && asubcode.IsNull())
+ {
+ ErrorMsg << "WOKMake_BuildProcess::GetAndAddStep"
+ << "Cannot get step (" << acode << ") for unit " << aunit->Name() << " (type : " << aunit->Type() << ")" << endm;
+ return NULLRESULT;
+ }
+ else
+ {
+ Handle(WOKMake_Step) thestep = WOKMake_StepBuilder::BuildStep(this, aunit, acode,asubcode);
+ if(!thestep.IsNull())
+ {
+ thestep->SetSubCode(asubcode);
+ mysteps.Bind(thestep->UniqueName(), thestep);
+ return mysteps.Find(thestep->UniqueName());
+ }
+ else
+ {
+ ErrorMsg << "WOKMake_BuildProcess::GetAndAddStep"
+ << "Cannot get step " << acode << " for unit " << aunit->Name() << " (type : " << aunit->Type() << ")" << endm;
+ return NULLRESULT;
+ }
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsUnitInProcess
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcess::IsUnitInProcess(const Handle(TCollection_HAsciiString)& aname) const
+{
+ return myunits.IsBound(aname);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetUnitSteps
+//purpose :
+//=======================================================================
+const TColStd_SequenceOfHAsciiString& WOKMake_BuildProcess::GetUnitSteps(const Handle(TCollection_HAsciiString)& aname) const
+{
+ static TColStd_SequenceOfHAsciiString EMPTYRESULT;
+
+ if(!myunits.IsBound(aname))
+ {
+ return EMPTYRESULT;
+ }
+ else
+ return myunits.Find(aname);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetStep
+//purpose :
+//=======================================================================
+const Handle(WOKMake_Step)& WOKMake_BuildProcess::Find(const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Handle(TCollection_HAsciiString)& asubcode) const
+{
+ Handle(TCollection_HAsciiString) anid = WOKMake_Step::UniqueName(aunit, acode, asubcode);
+
+ static Handle(WOKMake_Step) NULLRESULT;
+
+ if(mysteps.IsBound(anid)) return mysteps.Find(anid);
+
+ return NULLRESULT;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetStep
+//purpose :
+//=======================================================================
+const Handle(WOKMake_Step)& WOKMake_BuildProcess::Find(const Handle(TCollection_HAsciiString)& astepid) const
+{
+ static Handle(WOKMake_Step) NULLRESULT;
+
+ if(mysteps.IsBound(astepid)) return mysteps.Find(astepid);
+ return NULLRESULT;
+}
+
--- /dev/null
+// File: WOKMake_BuildProcess.lxx
+// Created: Mon Mar 24 15:12:08 1997
+// Author: Jean GAUTIER
+// <jga@hourax.paris1.matra-dtv.fr>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : UnitGraph
+//purpose :
+//=======================================================================
+inline const Handle(WOKernel_UnitGraph)& WOKMake_BuildProcess::UnitGraph() const
+{
+ return myunitgraph;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Locator
+//purpose :
+//=======================================================================
+inline const Handle(WOKernel_Locator)& WOKMake_BuildProcess::Locator() const
+{
+ return mylocator;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Shell
+//purpose :
+//=======================================================================
+inline const Handle(WOKUtils_Shell)& WOKMake_BuildProcess::Shell() const
+{
+ return myshell;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Steps
+//purpose :
+//=======================================================================
+inline const WOKMake_DataMapOfHAsciiStringOfStep& WOKMake_BuildProcess::Steps() const
+{
+ return mysteps;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Groups
+//purpose :
+//=======================================================================
+inline const WOKMake_IndexedDataMapOfBuildProcessGroup& WOKMake_BuildProcess::Groups() const
+{
+ return mygroups;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Units
+//purpose :
+//=======================================================================
+inline const WOKMake_DataMapOfHAsciiStringOfSequenceOfHAsciiString& WOKMake_BuildProcess::Units() const
+{
+ return myunits;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : TranslatorIterator
+//purpose :
+//=======================================================================
+inline WOKBuilder_MSTranslatorIterator& WOKMake_BuildProcess::TranslatorIterator()
+{
+ return mycdlit;
+}
+
+//=======================================================================
+//function : KnownUnits
+//purpose :
+//=======================================================================
+inline WOKTools_MapOfHAsciiString& WOKMake_BuildProcess::KnownUnits()
+{
+ return myknownunits;
+}
+
+//=======================================================================
+//function : MakeState
+//purpose :
+//=======================================================================
+inline WOKMake_IndexedDataMapOfHAsciiStringOfInputFile& WOKMake_BuildProcess::MakeState()
+{
+ return mymakestate;
+}
--- /dev/null
+-- File: WOKMake_BuildProcessGroup.cdl
+-- Created: Thu Jun 12 11:13:05 1997
+-- Author: Jean GAUTIER
+-- <jga@hourax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1997
+
+
+class BuildProcessGroup from WOKMake
+inherits TShared from MMgt
+
+ ---Purpose:
+
+uses
+ BuildProcess from WOKMake,
+ BuildProcessPtr from WOKMake,
+ Step from WOKMake,
+ UnitGraph from WOKernel,
+ SequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection
+
+
+is
+
+ Create(abp : BuildProcess from WOKMake; aname : HAsciiString from TCollection)
+ returns BuildProcessGroup from WOKMake;
+
+ Name(me)
+ returns HAsciiString from TCollection;
+
+ AddStep(me:mutable; astep : HAsciiString from TCollection);
+
+ Steps(me)
+ ---C++: return const &
+ returns SequenceOfHAsciiString from TColStd;
+
+ Step(me; anidx : Integer from Standard)
+ ---C++: return const &
+ returns Step from WOKMake;
+
+ Length(me)
+ returns Integer from Standard;
+
+
+ ChangeSteps(me:mutable; aseq : SequenceOfHAsciiString from TColStd);
+
+
+ IsOrdered(me)
+ returns Boolean;
+
+ SetOrdered(me:mutable);
+
+fields
+
+ myname : HAsciiString from TCollection;
+ mybp : BuildProcessPtr from WOKMake;
+ mysteps : SequenceOfHAsciiString from TColStd;
+ myordered : Boolean from Standard;
+
+end BuildProcessGroup;
--- /dev/null
+// File: WOKMake_BuildProcessGroup.cxx
+// Created: Thu Jun 12 11:21:26 1997
+// Author: Jean GAUTIER
+// <jga@hourax.paris1.matra-dtv.fr>
+
+
+#include <WOKMake_BuildProcessGroup.ixx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_BuildProcessGroup
+//purpose :
+//=======================================================================
+WOKMake_BuildProcessGroup::WOKMake_BuildProcessGroup(const Handle(WOKMake_BuildProcess)& abp,
+ const Handle(TCollection_HAsciiString)& aname)
+: myname(aname), mybp(abp.operator->()),myordered(Standard_True)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Name
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_BuildProcessGroup::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AddStep
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcessGroup::AddStep(const Handle(TCollection_HAsciiString)& astep)
+{
+ mysteps.Append(astep);
+ myordered = Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Steps
+//purpose :
+//=======================================================================
+const TColStd_SequenceOfHAsciiString& WOKMake_BuildProcessGroup::Steps() const
+{
+ return mysteps;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Step
+//purpose :
+//=======================================================================
+const Handle(WOKMake_Step)& WOKMake_BuildProcessGroup::Step(const Standard_Integer anidx) const
+{
+ return mybp->Find(mysteps.Value(anidx));
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Length
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_BuildProcessGroup::Length() const
+{
+ return mysteps.Length();
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ChangeSteps
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcessGroup::ChangeSteps(const TColStd_SequenceOfHAsciiString& thesteps)
+{
+ mysteps.Clear();
+ mysteps.Assign(thesteps);
+ myordered = Standard_False;
+}
+
+Standard_Boolean WOKMake_BuildProcessGroup::IsOrdered() const
+{
+ return myordered;
+}
+
+void WOKMake_BuildProcessGroup::SetOrdered()
+{
+ myordered = Standard_True;
+}
--- /dev/null
+-- File: WOKMake_BuildProcessIterator.cdl
+-- Created: Thu Jun 19 11:00:07 1997
+-- Author: Jean GAUTIER
+-- <jga@hourax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1997
+
+
+class BuildProcessIterator from WOKMake
+
+ ---Purpose:
+
+uses
+
+ BuildProcess from WOKMake,
+ BuildProcessGroup from WOKMake,
+ Step from WOKMake,
+ Status from WOKMake,
+ MapOfHAsciiString from WOKTools
+
+is
+
+ Create(aprocess : BuildProcess from WOKMake; alogflag : Boolean from Standard)
+ returns BuildProcessIterator from WOKMake;
+
+ CurGroup(me)
+ ---C++: return const &
+ returns BuildProcessGroup from WOKMake;
+
+ CurStep(me)
+ ---C++: return const &
+ returns Step from WOKMake;
+
+ MakeStep(me:out)
+ returns Status from WOKMake;
+
+ Next(me:out);
+
+ More(me)
+ returns Boolean from Standard;
+
+ Terminate(me:out)
+ returns Status from WOKMake;
+
+ ReorderCurrentGroup(me:in out)
+ is private;
+
+fields
+
+ myprocess : BuildProcess from WOKMake;
+ mystatus : Status from WOKMake;
+
+ mygrpidx : Integer from Standard;
+ mystepidx : Integer from Standard;
+ myprocessed : MapOfHAsciiString from WOKTools;
+ mylogflag : Boolean from Standard;
+
+end BuildProcessIterator;
--- /dev/null
+// File: WOKMake_BuildProcessIterator.cxx
+// Created: Thu Jun 19 11:08:47 1997
+// Author: Jean GAUTIER
+// <jga@hourax.paris1.matra-dtv.fr>
+
+#include <Standard_ErrorHandler.hxx>
+
+#include <MMgt_StorageManager.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+#ifndef WNT
+#include <WOKUtils_ProcessManager.hxx>
+#include <OSD_SIGINT.hxx>
+#else
+#include <WOKUtils_ShellManager.hxx>
+#define WOKUtils_ProcessManager WOKUtils_ShellManager
+#include <OSD_Exception_CTRL_BREAK.hxx>
+#endif
+
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_MapIteratorOfMapOfHAsciiString.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_Locator.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_BasicUnitTypes.hxx>
+
+#include <WOKernel_SortedImpldepFromIterator.hxx>
+#include <WOKernel_UnitGraph.hxx>
+
+#include <WOKMake_Step.hxx>
+#include <WOKMake_MetaStep.hxx>
+#include <WOKMake_HSequenceOfOutputFile.hxx>
+#include <WOKMake_OutputFile.hxx>
+#include <WOKMake_DataMapIteratorOfDataMapOfHAsciiStringOfSequenceOfHAsciiString.hxx>
+#include <WOKMake_DataMapOfHAsciiStringOfSequenceOfHAsciiString.hxx>
+
+#include <WOKMake_BuildProcessIterator.ixx>
+
+// ###### REFERENCER LE STORAGE MANAGER DES COLLECTIONS ######
+extern Standard_IMPORT MMgt_StorageManager aStorageManager;
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_BuildProcessIterator
+//purpose :
+//=======================================================================
+WOKMake_BuildProcessIterator::WOKMake_BuildProcessIterator(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Standard_Boolean alogflag)
+: myprocess(aprocess), mygrpidx(1), mystepidx(1), mystatus(WOKMake_Unprocessed), mylogflag(alogflag)
+{
+ Handle(WOKMake_Step) curstep = CurStep();
+
+ while(curstep.IsNull() && More())
+ {
+ Next();
+ curstep = CurStep();
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CurGroup
+//purpose :
+//=======================================================================
+const Handle(WOKMake_BuildProcessGroup)& WOKMake_BuildProcessIterator::CurGroup() const
+{
+ if(mygrpidx <= myprocess->Groups().Extent())
+ {
+ return myprocess->Groups()(mygrpidx);
+ }
+ else
+ {
+ static Handle(WOKMake_BuildProcessGroup) NULLRESULT;
+ return NULLRESULT;
+ }
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CurStep
+//purpose :
+//=======================================================================
+const Handle(WOKMake_Step)& WOKMake_BuildProcessIterator::CurStep() const
+{
+ if(mygrpidx <= myprocess->Groups().Extent())
+ {
+ const Handle(WOKMake_BuildProcessGroup)& group = myprocess->Groups()(mygrpidx);
+
+ if(mystepidx <= group->Steps().Length())
+ {
+ return myprocess->Find(group->Steps().Value(mystepidx));
+ }
+ else
+ {
+ static Handle(WOKMake_Step) NULLRESULT;
+ return NULLRESULT;
+ }
+ }
+ else
+ {
+ static Handle(WOKMake_Step) NULLRESULT;
+ return NULLRESULT;
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : MakeStep
+//purpose :
+//=======================================================================
+WOKMake_Status WOKMake_BuildProcessIterator::MakeStep()
+{
+ const Handle(WOKMake_Step)& step = CurStep();
+
+ if(step.IsNull())
+ {
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Invalid NULL step in iterator" << endm;
+ mystatus = WOKMake_Failed;
+ return mystatus;
+ }
+
+ const Handle(TColStd_HSequenceOfHAsciiString)& precsteps = step->PrecedenceSteps();
+
+ if(!precsteps.IsNull())
+ {
+ for(Standard_Integer i=1; i<=precsteps->Length(); i++)
+ {
+ const Handle(WOKMake_Step)& precstep = myprocess->Find(precsteps->Value(i));
+
+ if(precstep.IsNull())
+ {
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Could not find precedence step : " << precsteps->Value(i) << endm;
+ mystatus = WOKMake_Failed;
+ return mystatus;
+ }
+
+ switch(precstep->Status())
+ {
+ case WOKMake_Failed:
+ case WOKMake_Incomplete:
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Step " << step->Code() << " not done : almost " << precsteps->Value(i) << " failed" << endm;
+ if(myprocessed.Contains(step->Unit()->Name())) myprocessed.Remove(step->Unit()->Name());
+ step->SetStatus(WOKMake_Failed);
+ return WOKMake_Failed;
+ default:
+ break;
+ }
+ }
+ }
+
+ if(step->IsToExecute())
+ {
+ WOKTools_MsgStreamPtr astream = NULL;
+ Handle(WOKernel_File) logfile;
+
+ WOKTools_Info theinfo = InfoMsg;
+
+ if(!mylogflag)
+ {
+ theinfo .DontPrintHeader();
+ theinfo << "WOKMake_BuildProcessIterator::MakeStep" << endm;
+ theinfo << "WOKMake_BuildProcessIterator::MakeStep" << "=====> " << step->UniqueName() << endm;
+ theinfo << "WOKMake_BuildProcessIterator::MakeStep" << endm;
+ theinfo.DoPrintHeader();
+ }
+ else
+ {
+ theinfo.DontPrintHeader();
+ theinfo << "WOKMake_BuildProcessIterator::MakeStep" << "=====> " << step->UniqueName() << flushm;
+ theinfo.DoPrintHeader();
+ }
+
+ if(mylogflag)
+ {
+ logfile = step->AdmFile(step->LogFileName());
+
+ logfile->GetPath();
+ astream = new ofstream(logfile->Path()->Name()->ToCString(), ios::out);
+
+ if(astream->good())
+ {
+ InfoMsg.LogToStream(astream);
+ WarningMsg.LogToStream(astream);
+ ErrorMsg.LogToStream(astream);
+ VerboseMsg.LogToStream(astream);
+ }
+ }
+
+ try {
+
+ step->Make();
+
+ //myprocess->TranslatorIterator().Reset();
+ //WOKBuilder_MSTool::GetMSchema()->Clear();
+
+ }
+ catch (Standard_Failure) {
+
+ step->SetFailed();
+
+ Handle(Standard_Failure) E = Standard_Failure::Caught();
+
+#ifndef WNT
+ if(E->IsKind(STANDARD_TYPE(OSD_SIGINT)))
+#else
+ if(E->IsKind(STANDARD_TYPE(OSD_Exception_CTRL_BREAK)))
+#endif
+ {
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Process received interupt signal" << endm;
+ WOKUtils_ProcessManager::KillAll();
+ mygrpidx = myprocess->Groups().Extent()+1;
+
+ }
+ else
+ {
+ strstream astream;
+ astream << E << ends;
+
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Exception was raised : " << astream.str() << endm;
+ }
+ }
+
+
+ if(mylogflag && astream)
+ {
+ InfoMsg.EndLogging();
+ WarningMsg.EndLogging();
+ ErrorMsg.EndLogging();
+ VerboseMsg.EndLogging();
+ astream->close();
+ delete astream;
+ }
+
+ if(!mylogflag)
+ {
+ theinfo << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code();
+ }
+
+ switch(step->Status())
+ {
+ case WOKMake_Uptodate:
+ theinfo << " is up to date" << endm;
+ break;
+ case WOKMake_Success:
+ if(!myprocessed.Contains(step->Unit()->Name())) myprocessed.Add(step->Unit()->Name());
+ theinfo << " is successfull" << endm;
+ break;
+ case WOKMake_Processed:
+ if(!myprocessed.Contains(step->Unit()->Name())) myprocessed.Add(step->Unit()->Name());
+ //theinfo << " is processed" << endm;
+ break;
+ case WOKMake_Incomplete:
+ if(myprocessed.Contains(step->Unit()->Name())) myprocessed.Remove(step->Unit()->Name());
+ theinfo << endm;
+ WarningMsg << " is incomplete" << endm;
+ if(mylogflag)
+ {WarningMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Consult " << logfile->Path()->Name()->ToCString() << " for details" << endm;}
+ return WOKMake_Incomplete;
+
+ case WOKMake_Failed:
+ if(myprocessed.Contains(step->Unit()->Name())) myprocessed.Remove(step->Unit()->Name());
+ theinfo << endm;
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " failed" << endm;
+ if(mylogflag)
+ {ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Consult " << logfile->Path()->Name()->ToCString() << " for details" << endm;}
+ return WOKMake_Failed;
+
+ case WOKMake_Unprocessed:
+ theinfo << endm;
+ WarningMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " is still unprocessed" << endm;
+ if(mylogflag)
+ {WarningMsg << "WOKMake_BuildProcessIterator::MakeStep"
+ << "Consult " << logfile->Path()->Name()->ToCString() << " for details" << endm;}
+ break;
+ }
+
+ }
+ else
+ {
+ step->Make();
+
+ switch(step->Status())
+ {
+ case WOKMake_Uptodate:
+ InfoMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " is up to date" << endm;
+ break;
+ case WOKMake_Success:
+ if(!myprocessed.Contains(step->Unit()->Name())) myprocessed.Add(step->Unit()->Name());
+ InfoMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " is successfull" << endm;
+ break;
+ case WOKMake_Processed:
+ if(!myprocessed.Contains(step->Unit()->Name())) myprocessed.Add(step->Unit()->Name());
+ //InfoMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " is processed" << endm;
+ break;
+ case WOKMake_Incomplete:
+ if(myprocessed.Contains(step->Unit()->Name())) myprocessed.Remove(step->Unit()->Name());
+ WarningMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " is incomplete" << endm;
+ return WOKMake_Incomplete;
+
+ case WOKMake_Failed:
+ if(myprocessed.Contains(step->Unit()->Name())) myprocessed.Remove(step->Unit()->Name());
+ ErrorMsg << "WOKMake_BuildProcessIterator::MakeStep" << "Step " << step->Code() << " failed" << endm;
+ return WOKMake_Failed;
+
+ case WOKMake_Unprocessed:
+ break;
+ }
+ }
+
+ return WOKMake_Success;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Next
+//purpose :
+//=======================================================================
+void WOKMake_BuildProcessIterator::Next()
+{
+ const Handle(WOKMake_BuildProcessGroup)& curgroup = CurGroup();
+
+ if(!curgroup.IsNull())
+ {
+ if(mystepidx >= curgroup->Steps().Length())
+ {
+ mygrpidx++;
+ if(mygrpidx <= myprocess->Groups().Extent())
+ {
+ if(myprocess->Groups().FindFromIndex(mygrpidx)->Steps().Length()) {
+ mystepidx = 1;
+ ReorderCurrentGroup();
+ }
+ else {
+ Next();
+ }
+ }
+ }
+ else
+ {
+ mystepidx++;
+ }
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : More
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_BuildProcessIterator::More() const
+{
+ if(mygrpidx < myprocess->Groups().Extent())
+ {
+ return Standard_True;
+ }
+ else if(mygrpidx == myprocess->Groups().Extent())
+ {
+ if(mystepidx <= myprocess->Groups().FindFromIndex(mygrpidx)->Steps().Length())
+ {
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Terminate
+//purpose :
+//=======================================================================
+WOKMake_Status WOKMake_BuildProcessIterator::Terminate()
+{
+ WOKMake_Status result = WOKMake_Success;
+ myprocess->ClearGroups();
+
+ WOKMake_DataMapIteratorOfDataMapOfHAsciiStringOfSequenceOfHAsciiString anit(myprocess->Units());
+
+ InfoMsg << "WOKMake_BuildProcessIterator::Terminate"
+ << "------------------ Process report ------------------" << endm;
+
+ while(anit.More())
+ {
+ Handle(WOKernel_DevUnit) aunit = myprocess->Locator()->LocateDevUnit(anit.Key());
+
+ Handle(TColStd_HSequenceOfHAsciiString) unitfiles = aunit->FileList();
+
+ if(unitfiles.IsNull())
+ {
+ unitfiles = new TColStd_HSequenceOfHAsciiString;
+ aunit->SetFileList(unitfiles);
+ }
+
+ const TColStd_SequenceOfHAsciiString& steps = anit.Value();
+
+ // UPDATE :
+ // 0 : nothing decided
+ // 1 : decided to update
+ // 2 : decided to not update
+ Standard_Integer update = 0;
+ Handle(TCollection_HAsciiString) failedlist = new TCollection_HAsciiString;
+
+ for(Standard_Integer i=1; i<=steps.Length(); i++)
+ {
+ const Handle(WOKMake_Step)& step = myprocess->Find(steps.Value(i));
+
+ if(!step.IsNull())
+ {
+ switch(step->Status())
+ {
+ case WOKMake_Success:
+ case WOKMake_Processed:
+ if(update < 1 ) update = 1;
+ break;
+ case WOKMake_Unprocessed:
+ case WOKMake_Uptodate:
+ break;
+ case WOKMake_Incomplete:
+ case WOKMake_Failed:
+ if(update < 2 ) update = 2;
+ failedlist->AssignCat(step->Code());
+ failedlist->AssignCat(" ");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ switch(update)
+ {
+ case 0:
+ //InfoMsg << "WOKMake_BuildProcessIterator::Terminate"
+ // << "Not done " << anit.Key() << endm;
+ break;
+ case 1:
+ {
+ InfoMsg << "WOKMake_BuildProcessIterator::Terminate"
+ << "Success " << anit.Key() << endm;
+ for(Standard_Integer i=1; i<=steps.Length(); i++) {
+ const Handle(WOKMake_Step)& step = myprocess->Find(steps.Value(i));
+
+ if(!step.IsNull()) {
+ const Handle(WOKMake_HSequenceOfOutputFile)& outlist = step->OutputFileList();
+
+ if(!outlist.IsNull()) {
+ for(Standard_Integer j=1; j<=outlist->Length(); j++) {
+ const Handle(WOKMake_OutputFile)& outfile = outlist->Value(j);
+
+ if(outfile->IsProduction() &&
+ outfile->IsPhysic() &&
+ outfile->IsLocateAble() &&
+ outfile->IsMember()) {
+ unitfiles->Append(outfile->ID());
+ }
+ }
+ Handle(WOKMake_MetaStep) mstep = Handle(WOKMake_MetaStep)::DownCast(step);
+ if (!mstep.IsNull()) {
+ Handle(TColStd_HSequenceOfHAsciiString) substeps = mstep->UnderlyingSteps();
+ if (!substeps.IsNull()) {
+ for (Standard_Integer k=1; k<= substeps->Length(); k++) {
+ const Handle(WOKMake_Step)& substep = myprocess->Find(substeps->Value(k));
+ if(!substep.IsNull()) {
+ const Handle(WOKMake_HSequenceOfOutputFile)& outslist = substep->OutputFileList();
+ if(!outslist.IsNull()) {
+ for(Standard_Integer l=1; l<=outslist->Length(); l++) {
+ const Handle(WOKMake_OutputFile)& outfile = outslist->Value(l);
+ if(outfile->IsProduction() &&
+ outfile->IsPhysic() &&
+ outfile->IsLocateAble() &&
+ outfile->IsMember()) {
+ unitfiles->Append(outfile->ID());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ ErrorMsg << "WOKMake_BuildProcessIterator::Terminate"
+ << "Could not obtain step " << steps.Value(i) << endm;
+ return WOKMake_Failed;
+ }
+ }
+ aunit->DumpFileList(myprocess->Locator());
+ }
+ break;
+ case 2:
+ {
+ result = WOKMake_Failed;
+ InfoMsg << "WOKMake_BuildProcessIterator::Terminate"
+ << "Failed " << anit.Key() << " (" << failedlist << ")"<< endm;
+ }
+ }
+
+ // On va arreter de bouffer la memoire pour rien
+ myprocess->RemoveUnit(aunit->Name());
+ aunit->Close();
+
+ anit.Next();
+ }
+
+ myprocess->ClearUnits();
+
+ InfoMsg << "WOKMake_BuildProcessIterator::Terminate"
+ << "----------------------------------------------------" << endm;
+
+ WOKUtils_ProcessManager::KillAll();
+ //aStorageManager.Purge();
+
+ return result;
+}
+
+void WOKMake_BuildProcessIterator::ReorderCurrentGroup()
+{
+ if (!strcmp(CurGroup()->Name()->ToCString(),"Lib")) {
+ if (!CurGroup()->IsOrdered()) {
+
+ TColStd_SequenceOfHAsciiString thesteps;
+ Handle(WOKernel_Locator) theloc = myprocess->Locator();
+ Handle(TCollection_HAsciiString) pkgstype = new TCollection_HAsciiString("PACKAGES");
+ WOKernel_SortedImpldepFromIterator algo;
+ WOKMake_DataMapOfHAsciiStringOfSequenceOfHAsciiString lsttksteps;
+ WOKTools_MapOfHAsciiString udadded;
+ Standard_Integer i;
+ Standard_Boolean toadd;
+
+ for (i=1; i<= CurGroup()->Steps().Length(); i++) {
+ Handle(WOKMake_Step) astep = myprocess->Find(CurGroup()->Steps().Value(i));
+ // on traite uniquement que les UDS ad hoc (default shema et toolkit)
+ toadd = Standard_False;
+ if (!astep->IsToExecute()) {
+ toadd = Standard_True;
+ }
+ else {
+ // on sait si une UD convient par %WOKSteps_IsOrdered
+ if (strcmp(astep->Unit()->Params().Eval("%WOKSteps_IsOrdered")->ToCString(),"Yes")) {
+ toadd = Standard_True;
+ }
+ }
+ if (toadd) {
+ thesteps.Append(CurGroup()->Steps().Value(i));
+ }
+ else {
+
+ if (lsttksteps.IsBound(astep->Unit()->Name())) {
+ lsttksteps(astep->Unit()->Name()).Append(CurGroup()->Steps().Value(i));
+ }
+ else {
+ TColStd_SequenceOfHAsciiString aseq;
+ lsttksteps.Bind(astep->Unit()->Name(),aseq);
+
+ lsttksteps(astep->Unit()->Name()).Append(CurGroup()->Steps().Value(i));
+
+ algo.FromVertex(astep->Unit()->Name());
+
+
+ // ajout des ImplDep dans le UnitGraph
+
+ Handle(WOKernel_File) impldepfile = astep->Unit()->ImplDepFile(theloc,astep->Unit()->Name());
+ if (impldepfile.IsNull()) {
+ ErrorMsg << "WOKMake_BuildProcessIterator::ReorderCurrentGroup" <<
+ "Unable to get ImplDep file for unit " << astep->Unit()->Name()->ToCString() << endm;
+ }
+ else {
+ impldepfile->GetPath();
+ Handle(TColStd_HSequenceOfHAsciiString) deps = astep->Unit()->ReadImplDepFile(impldepfile->Path(),
+ theloc,
+ Standard_False);
+ myprocess->UnitGraph()->Add(astep->Unit()->Name(),deps);
+ }
+
+ if (WOKernel_IsToolkit(astep->Unit())) {
+ // ajout du package dans UnitGraph
+ // le tk est fournisseur des uds qui le composent
+
+ Handle(TCollection_HAsciiString) PACKAGESname = astep->Unit()->Params().Eval("%FILENAME_PACKAGES");
+ Handle(WOKernel_File) filepack = theloc->Locate(astep->Unit()->Name(),
+ pkgstype,
+ PACKAGESname);
+ if (filepack.IsNull()) {
+ ErrorMsg << "WOKMake_BuildProcessIterator::ReorderCurrentGroup" <<
+ "Unable to get PACKAGES file for unit " << astep->Unit()->Name()->ToCString() << endm;
+ }
+ else {
+ filepack->GetPath();
+ WOKUtils_AdmFile afile(filepack->Path());
+ Handle(TColStd_HSequenceOfHAsciiString) udsoftk = afile.Read();
+
+ for (Standard_Integer j=1;j<= udsoftk->Length(); j++) {
+ myprocess->UnitGraph()->Add(udsoftk->Value(j),astep->Unit()->Name());
+ udadded.Add(udsoftk->Value(j));
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ // on y va !
+
+ if (lsttksteps.Extent() > 1) {
+ algo.Perform(myprocess->UnitGraph());
+
+ Standard_Boolean IsCyclic = Standard_False;
+ Handle(TColStd_HSequenceOfHAsciiString) orderedtks = new TColStd_HSequenceOfHAsciiString ;
+ while(algo.More()) {
+ if(algo.NbVertices() > 1) {
+ ErrorMsg << "WOKMake_BuildProcessIterator::ReorderCurrentGroup"
+ << "Cyclic dependency detected between: ";
+
+ for(i=1; i<= algo.NbVertices(); i++) {
+ ErrorMsg << algo.Value(i) << " ";
+ }
+
+ ErrorMsg << endm;
+
+ IsCyclic = Standard_True;
+ }
+ else {
+ if (lsttksteps.IsBound(algo.Value(1))) {
+ orderedtks->Prepend(algo.Value(1));
+ }
+ }
+ algo.Next();
+ }
+ if (!IsCyclic) {
+ for (i=1;i<=orderedtks->Length();i++) {
+ const TColStd_SequenceOfHAsciiString& aseq = lsttksteps(orderedtks->Value(i));
+ for (Standard_Integer j=1; j<= aseq.Length(); j++) {
+ thesteps.Append(aseq(j));
+ }
+ }
+ CurGroup()->ChangeSteps(thesteps);
+ }
+ WOKTools_MapIteratorOfMapOfHAsciiString itadd(udadded);
+ // on remet le UnitGraph en etat
+ while (itadd.More()) {
+ myprocess->UnitGraph()->Remove(itadd.Key());
+ itadd.Next();
+ }
+ }
+ CurGroup()->SetOrdered();
+ }
+ }
+}
+
+
--- /dev/null
+-- File: WOKMake_DepItem.cdl
+-- Created: Mon Nov 20 19:58:42 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class DepItem from WOKMake
+inherits TShared from MMgt
+
+ ---Purpose: Handles Single Output Item within a step
+
+uses
+ IndexedMapOfDepItem from WOKMake,
+ FileStatus from WOKMake,
+ Path from WOKUtils,
+ HAsciiString from TCollection,
+ Boolean from Standard
+
+is
+
+ Create(afile : HAsciiString from TCollection ; issuedfrom : HAsciiString from TCollection)
+ returns mutable DepItem from WOKMake;
+
+
+ SetOrigin(me:mutable; anorigin : HAsciiString from TCollection);
+ IssuedFrom(me)
+ ---C++: return const &
+ ---C++: inline
+ returns HAsciiString from TCollection;
+
+ SetOutputFile(me:mutable; afile : HAsciiString from TCollection);
+ OutputFile(me)
+ ---C++: return const &
+ ---C++: inline
+ returns HAsciiString from TCollection;
+
+ SetDirect(me:mutable);
+ SetIndirect(me:mutable);
+ IsDirectDep(me)
+ ---C++: inline
+ returns Boolean from Standard;
+
+ SetStatus(me:mutable; astatus : FileStatus from WOKMake);
+ Status(me)
+ ---C++: inline
+ returns FileStatus from WOKMake;
+
+ --
+ -- READ/WRITE OUTPUT FILES
+ --
+
+ ReadLine(myclass; astream : out IStream from Standard;
+ anitem : out DepItem from WOKMake;
+ lastone : DepItem from WOKMake)
+ is private;
+
+ WriteLine(myclass; astream : out OStream from Standard;
+ anitem : DepItem from WOKMake;
+ lastone : DepItem from WOKMake)
+ is private;
+
+ -- Into/From a seq
+ ReadFile(myclass; afile : Path from WOKUtils;
+ aseq : out IndexedMapOfDepItem from WOKMake)
+ returns Integer from Standard;
+
+ WriteFile(myclass; afile : Path from WOKUtils; aseq : IndexedMapOfDepItem from WOKMake)
+ returns Integer from Standard;
+
+
+fields
+ myfile : HAsciiString from TCollection;
+ myorigin : HAsciiString from TCollection;
+ mydirect : Boolean from Standard;
+ mystatus : FileStatus from WOKMake;
+end DepItem;
--- /dev/null
+// File: WOKMake_DepItem.cxx
+// Created: Mon Nov 20 20:11:59 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <fstream.h>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKMake_DepItem.ixx>
+
+#define READBUF_SIZE 1024
+
+//=======================================================================
+//function : WOKMake_DepItem
+//purpose :
+//=======================================================================
+WOKMake_DepItem::WOKMake_DepItem(const Handle(TCollection_HAsciiString)& afile,
+ const Handle(TCollection_HAsciiString)& issuedfrom)
+: myfile(afile), myorigin(issuedfrom)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetOrigin
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::SetOrigin(const Handle(TCollection_HAsciiString)& afile)
+{
+ myorigin = afile;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetOutputFile
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::SetOutputFile(const Handle(TCollection_HAsciiString)& aoutfile)
+{
+ myfile = aoutfile;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetDirect
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::SetDirect()
+{
+ mydirect = Standard_True;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetIndirect
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::SetIndirect()
+{
+ mydirect = Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetStatus
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::SetStatus(const WOKMake_FileStatus astatus)
+{
+ mystatus = astatus;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadLine
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::ReadLine(Standard_IStream& astream, Handle(WOKMake_DepItem)& anitem, const Handle(WOKMake_DepItem)& lastone)
+{
+ static char aflag;
+ static char aoutbuf[READBUF_SIZE], afrombuf[READBUF_SIZE];
+
+ *aoutbuf = *afrombuf = '\0';
+ aflag = 0;
+
+ if(!astream)
+ {
+ anitem.Nullify();
+ return;
+ }
+
+ astream.get(aflag);
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(aoutbuf, READBUF_SIZE, ' ');
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(afrombuf, READBUF_SIZE);
+ astream.ignore(READBUF_SIZE, '\n');
+ //astream >> aflag >> setw(READBUF_SIZE) >> aoutbuf >> setw(READBUF_SIZE) >> afrombuf;
+
+ if(aflag == 0 || aoutbuf[0] == '\0' || afrombuf[0] == '\0')
+ {
+ anitem.Nullify();
+ return;
+ }
+
+ if(aoutbuf[0] == '*')
+ {
+ if(!lastone.IsNull())
+ {
+ anitem = new WOKMake_DepItem(lastone->OutputFile(),
+ new TCollection_HAsciiString(afrombuf));
+ }
+ else
+ {
+ ErrorMsg << "WOKMake_DepItem::ReadLine"
+ << "Could not read invalid first line" << endm;
+ anitem.Nullify();
+ return;
+ }
+ }
+ else
+ {
+ anitem = new WOKMake_DepItem(new TCollection_HAsciiString(aoutbuf),
+ new TCollection_HAsciiString(afrombuf));
+ }
+
+ if(aflag == '+')
+ {
+ anitem->SetDirect();
+ }
+ else
+ {
+ anitem->SetIndirect();
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteLine
+//purpose :
+//=======================================================================
+void WOKMake_DepItem::WriteLine(Standard_OStream& astream, const Handle(WOKMake_DepItem)& anitem, const Handle(WOKMake_DepItem)& lastone)
+{
+
+ if(anitem->IsDirectDep())
+ {
+ astream << "+ ";
+ }
+ else
+ {
+ astream << "- ";
+ }
+
+ if(!lastone.IsNull())
+ {
+ if(!strcmp(anitem->OutputFile()->ToCString(), lastone->OutputFile()->ToCString()))
+ {
+ astream << "* " << anitem->IssuedFrom()->ToCString() << endl;
+ return;
+ }
+ }
+ astream << anitem->OutputFile()->ToCString() << " " << anitem->IssuedFrom()->ToCString() << endl;
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_DepItem::ReadFile(const Handle(WOKUtils_Path)& afile,
+ WOKMake_IndexedMapOfDepItem& amap)
+{
+ if(afile.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_DepItem::ReadFile : NullInput");
+ }
+
+ if(afile->Exists())
+ {
+ Standard_Integer i;
+ ifstream astream(afile->Name()->ToCString(), ios::in);
+ Handle(WOKMake_DepItem) item, lastone;
+ Handle(TCollection_HAsciiString) locatorname;
+
+ ReadLine(astream, item,lastone);
+ lastone = item;
+
+ while(!item.IsNull())
+ {
+ i++;
+ amap.Add(item);
+ ReadLine(astream, item,lastone);
+ lastone = item;
+ }
+
+ astream.close();
+ return i;
+ }
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_DepItem::WriteFile(const Handle(WOKUtils_Path)& apath,
+ const WOKMake_IndexedMapOfDepItem& amap)
+{
+ if(apath.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_DepItem::WriteFile : NullInput");
+ }
+
+ ofstream astream(apath->Name()->ToCString(), ios::out);
+
+ if(!astream)
+ {
+ ErrorMsg << "WOKMake_DepItem::WriteFile" << "Could not open " << apath->Name() << endm;
+ Standard_ProgramError::Raise("");
+ }
+
+ Handle(WOKMake_DepItem) lastone;
+ Standard_Integer i;
+ for(i=1; i<=amap.Extent(); i++)
+ {
+ const Handle(WOKMake_DepItem)& item = amap(i);
+ WriteLine(astream, item, lastone);
+ lastone = item;
+ }
+ astream.close();
+ return 0;
+}
--- /dev/null
+// File: WOKMake_DepItem.lxx
+// Created: Thu Mar 7 11:58:45 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+
+//=======================================================================
+//function : IssuedFrom
+//purpose :
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKMake_DepItem::IssuedFrom() const
+{
+ return myorigin;
+}
+
+//=======================================================================
+//function : OutputFile
+//purpose :
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKMake_DepItem::OutputFile() const
+{
+ return myfile;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsDirectDep
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_DepItem::IsDirectDep() const
+{
+ return mydirect;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Status
+//purpose :
+//=======================================================================
+WOKMake_FileStatus WOKMake_DepItem::Status() const
+{
+ return mystatus;
+}
+
--- /dev/null
+-- File: WOKMake_DepItemHasher.cdl
+-- Created: Fri Oct 3 16:14:37 1997
+-- Author: Jean GAUTIER
+-- <jga@hourax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1997
+
+private class DepItemHasher from WOKMake
+uses
+ DepItem from WOKMake
+is
+
+ HashCode(myclass; Key : DepItem from WOKMake) returns Integer;
+ ---Level: Public
+ ---Purpose: Returns a HasCode value for the Key <K> in the
+ -- range 0..Upper.
+ -- Default ::HashCode(K,Upper)
+
+ IsEqual(myclass; K1, K2 : DepItem from WOKMake) returns Boolean;
+ ---Level: Public
+ ---Purpose: Returns True when the two keys are the same. Two
+ -- same keys must have the same hashcode, the
+ -- contrary is not necessary.
+ -- Default K1 == K2
+end;
--- /dev/null
+// File: WOKMake_DepItemHasher.cxx
+// Created: Fri Oct 3 16:15:43 1997
+// Author: Jean GAUTIER
+// <jga@hourax.paris1.matra-dtv.fr>
+
+
+#include <TCollection_HAsciiString.hxx>
+
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+
+#include <WOKMake_DepItemHasher.ixx>
+
+
+Standard_Integer WOKMake_DepItemHasher::HashCode (const Handle(WOKMake_DepItem) &Value)
+{
+ return
+ (WOKTools_HAsciiStringHasher::HashCode(Value->IssuedFrom()) +
+ WOKTools_HAsciiStringHasher::HashCode(Value->OutputFile()));
+}
+
+Standard_Boolean WOKMake_DepItemHasher::IsEqual(const Handle(WOKMake_DepItem) &K1, const Handle(WOKMake_DepItem) &K2)
+{
+ if (!strcmp(K1->IssuedFrom()->ToCString(), K2->IssuedFrom()->ToCString()) &&
+ !strcmp(K1->OutputFile()->ToCString(), K2->OutputFile()->ToCString()))
+ return Standard_True;
+ else
+ return Standard_False;
+}
+
--- /dev/null
+-- File: WOKMake_InputFile.cdl
+-- Created: Mon Nov 20 19:56:42 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+
+class InputFile from WOKMake
+inherits StepFile from WOKMake
+
+ ---Purpose: Handles Single Input Item within a step
+
+uses
+ IndexedDataMapOfHAsciiStringOfInputFile from WOKMake,
+ HSequenceOfInputFile from WOKMake,
+ FileStatus from WOKMake,
+ OutputFile from WOKMake,
+ Locator from WOKernel,
+ File from WOKernel,
+ Entity from WOKBuilder,
+ Path from WOKUtils,
+ HAsciiString from TCollection,
+ Boolean from Standard
+is
+
+ Create returns mutable InputFile from WOKMake;
+
+ Create(anid : HAsciiString from TCollection;
+ afile : File from WOKernel;
+ abuildent : Entity from WOKBuilder;
+ aoldpath : Path from WOKUtils)
+ returns mutable InputFile from WOKMake;
+
+ Create(outfile : OutputFile from WOKMake)
+ returns mutable InputFile from WOKMake;
+
+
+ --
+ -- READ/WRITE INPUT FILES
+ --
+
+ ReadLine(myclass; astream : out IStream from Standard;
+ locator : Locator from WOKernel;
+ infile : out InputFile from WOKMake)
+ is private;
+
+ WriteLine(myclass; astream : out OStream from Standard;
+ infile : InputFile from WOKMake)
+ is private;
+
+ -- Into/From a map
+ ReadFile(myclass; afile : Path from WOKUtils;
+ alocator : Locator from WOKernel;
+ amap : out IndexedDataMapOfHAsciiStringOfInputFile from WOKMake)
+ returns Integer from Standard;
+
+ WriteFile(myclass; afile : Path from WOKUtils; amap : IndexedDataMapOfHAsciiStringOfInputFile from WOKMake)
+ returns Integer from Standard;
+
+ -- Into/From a seq
+ ReadFile(myclass; afile : Path from WOKUtils;
+ alocator : Locator from WOKernel;
+ aseq : HSequenceOfInputFile from WOKMake)
+ returns Integer from Standard;
+
+ WriteFile(myclass; afile : Path from WOKUtils; aseq : HSequenceOfInputFile from WOKMake)
+ returns Integer from Standard;
+
+ -- Mgt Flags
+
+ SetDirectFlag(me:mutable; aflag : Boolean from Standard);
+ IsDirectInput(me)
+ ---Purpose: True if File is in Input Flow of Step
+ -- False if it is a deducted dependency input
+ ---C++: inline
+ returns Boolean from Standard;
+
+end InputFile;
+
+
--- /dev/null
+// File: WOKMake_InputFile.cxx
+// Created: Mon Nov 20 20:11:05 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <fstream.h>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKernel_Locator.hxx>
+
+#include <WOKMake_InputFile.ixx>
+
+#define READBUF_SIZE 1024
+
+//=======================================================================
+//function : WOKMake_InputFile
+//purpose :
+//=======================================================================
+WOKMake_InputFile::WOKMake_InputFile()
+{
+}
+
+//=======================================================================
+//function : WOKMake_InputFile
+//purpose :
+//=======================================================================
+WOKMake_InputFile::WOKMake_InputFile(const Handle(TCollection_HAsciiString)& anid,
+ const Handle(WOKernel_File)& afile,
+ const Handle(WOKBuilder_Entity)& anent,
+ const Handle(WOKUtils_Path)& apath)
+: WOKMake_StepFile(anid, afile, anent, apath)
+{
+}
+
+//=======================================================================
+//function : WOKMake_InputFile
+//purpose :
+//=======================================================================
+WOKMake_InputFile::WOKMake_InputFile(const Handle(WOKMake_OutputFile)& outfile)
+ : WOKMake_StepFile(outfile->ID(), outfile->File(), outfile->BuilderEntity(), outfile->LastPath())
+{
+ SetLocateFlag(outfile->IsLocateAble());
+ SetPhysicFlag(outfile->IsPhysic());
+ SetStepID(outfile->IsStepID());
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadLine
+//purpose :
+//=======================================================================
+void WOKMake_InputFile::ReadLine(Standard_IStream & astream,
+ const Handle(WOKernel_Locator)& alocator,
+ Handle(WOKMake_InputFile)& infile)
+{
+ Standard_Integer i,len;
+ Handle(TCollection_HAsciiString) id;
+ Handle(TCollection_HAsciiString) aunitname, atype, aname;
+ Handle(TCollection_HAsciiString) oldpath;
+ Handle(WOKernel_File) afile;
+ Handle(WOKMake_InputFile) ainfile;
+ static char flags[READBUF_SIZE];
+ static char anamebuf[READBUF_SIZE], apathbuf[READBUF_SIZE];
+
+ *flags = *anamebuf = *apathbuf = '\0';
+
+ if(!astream)
+ {
+ infile.Nullify();
+ return;
+ }
+
+ //astream >> setw(READBUF_SIZE) >> flags >> setw(READBUF_SIZE) >> anamebuf >> setw(READBUF_SIZE) >> apathbuf;
+ astream.get(flags, READBUF_SIZE, ' ');
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(anamebuf, READBUF_SIZE, ' ');
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(apathbuf, READBUF_SIZE);
+ astream.ignore(READBUF_SIZE, '\n');
+
+
+ if(anamebuf[0] == '\0' || flags[0] == '\0' || apathbuf[0] == '\0' )
+ {
+ infile.Nullify();
+ return;
+ }
+
+ oldpath = new TCollection_HAsciiString(apathbuf);
+ ainfile = new WOKMake_InputFile;
+
+ len = strlen(flags);
+ for(i=0; i<len; i++)
+ {
+ switch(flags[i])
+ {
+ case '+':
+ ainfile->SetDirectFlag(Standard_True);
+ break;
+ case '-':
+ ainfile->SetDirectFlag(Standard_False);
+ break;
+ case 'V':
+ ainfile->SetPhysicFlag(Standard_False);
+ break;
+ case 'S':
+ ainfile->SetStepID(Standard_True);
+ break;
+ }
+ }
+
+ if(anamebuf[0] != '.')
+ {
+ Handle(TCollection_HAsciiString) id = new TCollection_HAsciiString(anamebuf);
+
+ if(ainfile->IsPhysic())
+ {
+ afile = alocator->Locate(id);
+
+ if(!afile.IsNull())
+ {
+ id = afile->LocatorName();
+ }
+ }
+
+ ainfile->SetID(id);
+ ainfile->SetFile(afile);
+ ainfile->SetLastPath(new WOKUtils_Path(oldpath));
+ ainfile->SetLocateFlag(Standard_True);
+
+ //if(!strcmp(id->Token(":", 2)->ToCString(), "msentity"))
+ //{
+ // ainfile->SetPhysicFlag(Standard_False);
+ //}
+ }
+ else
+ {
+ ainfile->SetID(oldpath);
+ ainfile->SetLastPath(new WOKUtils_Path(oldpath));
+ ainfile->SetLocateFlag(Standard_False);
+ }
+
+
+ infile = ainfile;
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteLine
+//purpose :
+//=======================================================================
+void WOKMake_InputFile::WriteLine(Standard_OStream& astream,
+ const Handle(WOKMake_InputFile)& infile)
+{
+ if(infile.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_InputFile::WriteLine : Null Input");
+ }
+
+ if(infile->IsDirectInput()) astream << "+";
+ else astream << "-";
+ if(!infile->IsPhysic()) astream << "V";
+ if(infile->IsStepID()) astream << "S";
+
+ astream << " ";
+
+ if(!infile->IsLocateAble())
+ {
+ astream << ". " << infile->LastPath()->Name()->ToCString() << endl;
+ }
+ else
+ {
+ if(infile->IsPhysic())
+ {
+ astream << infile->File()->LocatorName()->ToCString() << " " << infile->LastPath()->Name()->ToCString() << endl;
+ }
+ else
+ {
+ astream << infile->ID()->ToCString() << " ." << endl;
+ }
+ }
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_InputFile::ReadFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKernel_Locator)& alocator,
+ WOKMake_IndexedDataMapOfHAsciiStringOfInputFile& amap)
+{
+ if(apath->Exists())
+ {
+ Standard_Integer i;
+ ifstream astream(apath->Name()->ToCString());
+ Handle(WOKMake_InputFile) infile;
+ Handle(TCollection_HAsciiString) locatorname;
+
+ ReadLine(astream, alocator, infile);
+
+ while(!infile.IsNull())
+ {
+ i++;
+ amap.Add(infile->ID(), infile);
+ ReadLine(astream, alocator, infile);
+ }
+
+ astream.close();
+ return i;
+ }
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_InputFile::WriteFile(const Handle(WOKUtils_Path)& apath,
+ const WOKMake_IndexedDataMapOfHAsciiStringOfInputFile& amap)
+{
+ Standard_Integer i;
+ ofstream astream(apath->Name()->ToCString(), ios::out);
+
+ if(!astream)
+ {
+ ErrorMsg << "WOKMake_StepInput::Dump" << "Could not open " << apath->Name() << endm;
+ Standard_ProgramError::Raise("");
+ }
+
+
+ for(i=1; i<=amap.Extent(); i++)
+ {
+ WriteLine(astream, amap(i));
+ }
+ astream.close();
+ return 0;
+}
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_InputFile::ReadFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKernel_Locator)& alocator,
+ const Handle(WOKMake_HSequenceOfInputFile)& aseq)
+{
+ if(apath.IsNull() || aseq.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_InputFile::ReadFile : NullInput");
+ }
+
+ if(apath->Exists())
+ {
+ Standard_Integer i;
+ ifstream astream(apath->Name()->ToCString(), ios::in);
+ Handle(WOKMake_InputFile) infile;
+ Handle(TCollection_HAsciiString) locatorname;
+
+ ReadLine(astream, alocator, infile);
+
+ while(!infile.IsNull())
+ {
+ i++;
+ aseq->Append(infile);
+ ReadLine(astream, alocator, infile);
+ }
+
+ astream.close();
+ return i;
+ }
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_InputFile::WriteFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKMake_HSequenceOfInputFile)& aseq)
+{
+ Standard_Integer i;
+ ofstream astream(apath->Name()->ToCString(), ios::out);
+
+ if(!astream)
+ {
+ ErrorMsg << "WOKMake_StepInput::Dump" << "Could not open " << apath->Name() << endm;
+ Standard_ProgramError::Raise("");
+ }
+
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ WriteLine(astream, aseq->Value(i));
+ }
+ astream.close();
+ return 0;
+}
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetDirectFlag
+//purpose :
+//=======================================================================
+void WOKMake_InputFile::SetDirectFlag(const Standard_Boolean aflag)
+{
+ if(aflag)
+ myattr |= STEPFILE_DIRECT;
+ else
+ myattr &= (STEPFILE_DIRECT ^ myattr);
+}
--- /dev/null
+// File: WOKMake_InputFile.lxx
+// Created: Tue Jun 18 14:05:56 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsDirectInput
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_InputFile::IsDirectInput() const
+{
+ if(myattr & STEPFILE_DIRECT) return Standard_True;
+ else return Standard_False;
+}
--- /dev/null
+-- File: WOKMake_MetaStep.cdl
+-- Created: Mon Aug 26 17:06:37 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class MetaStep from WOKMake
+inherits Step from WOKMake
+
+ ---Purpose:
+
+uses
+ BuildProcess from WOKMake,
+ HSequenceOfInputFile from WOKMake,
+ OutputFile from WOKMake,
+ InputFile from WOKMake,
+ Status from WOKMake,
+ DevUnit from WOKernel,
+ HSequenceOfHAsciiString from TColStd,
+ HAsciiString from TCollection
+
+is
+
+ Create( aprocess : BuildProcess from WOKMake;
+ aunit : DevUnit from WOKernel;
+ acode : HAsciiString from TCollection;
+ checked, hidden : Boolean from Standard);
+
+ HandleInputFile(me:mutable; anitem : InputFile from WOKMake)
+ returns Boolean from Standard
+ is redefined protected;
+
+ SetAdmFileType(me:mutable; atype : HAsciiString from TCollection);
+ AdmFileType(me)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ SetOutputDirTypeName(me:mutable; atype : HAsciiString from TCollection);
+ OutputDirTypeName(me)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ GetUnderlyingSteps(me:mutable)
+ ---Purpose: Get Underlying steps using output of input steps
+ returns HSequenceOfHAsciiString from TColStd
+ is virtual protected;
+
+ GetLastUnderlyingSteps(me:mutable)
+ ---Purpose: Get Underlying steps using last output of step
+ returns HSequenceOfHAsciiString from TColStd
+ is virtual protected;
+
+ UnderlyingSteps(me:mutable)
+ returns HSequenceOfHAsciiString from TColStd
+ is virtual;
+ SetUnderlyingSteps(me:mutable; steps : HSequenceOfHAsciiString from TColStd);
+
+
+
+ Parts(me)
+ returns HSequenceOfHAsciiString from TColStd;
+ SetParts(me:mutable; parts : HSequenceOfHAsciiString from TColStd);
+
+ Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake)
+ ---Purpose: Executes underlying steps
+ -- Computes output files
+ is redefined private;
+
+ Make(me:mutable)
+ ---Purpose: Computes dependances
+ -- Decides if perform is needed.
+ -- Performs Step on needed entities
+ -- returns status
+ returns Status from WOKMake is redefined;
+
+ HandleOutputFile(me:mutable; anfile : OutputFile from WOKMake)
+ ---Purpose: Handles Output file new/same/disappereread
+ returns Boolean from Standard
+ is redefined protected;
+
+fields
+
+ myadmtype : HAsciiString from TCollection;
+ myouttype : HAsciiString from TCollection;
+ myparts : HSequenceOfHAsciiString from TColStd;
+ myundersteps : HSequenceOfHAsciiString from TColStd;
+
+end MetaStep;
--- /dev/null
+// File: WOKMake_MetaStep.cxx
+// Created: Mon Aug 26 17:12:32 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKernel_Locator.hxx>
+#include <WOKernel_File.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <WOKMake_AdmFileTypes.hxx>
+#include <WOKMake_OutputFile.hxx>
+#include <WOKMake_HSequenceOfOutputFile.hxx>
+
+#include <WOKMake_MetaStep.ixx>
+
+
+
+//=======================================================================
+//function : WOKMake_MetaStep
+//purpose :
+//=======================================================================
+WOKMake_MetaStep::WOKMake_MetaStep(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Standard_Boolean checked,
+ const Standard_Boolean hidden)
+ : WOKMake_Step(aprocess, aunit, acode, checked, hidden)
+{
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetAdmFileType
+//purpose :
+//=======================================================================
+void WOKMake_MetaStep::SetAdmFileType(const Handle(TCollection_HAsciiString)& atype)
+{
+ myadmtype = atype;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AdmFileType
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_MetaStep::AdmFileType() const
+{
+ return myadmtype;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetOutputDirTypeName
+//purpose :
+//=======================================================================
+void WOKMake_MetaStep::SetOutputDirTypeName(const Handle(TCollection_HAsciiString)& atype)
+{
+ myouttype = atype;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutputDirTypeName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_MetaStep::OutputDirTypeName() const
+{
+ return myadmtype;
+}
+
+//=======================================================================
+//function : HandleInputFile
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_MetaStep::HandleInputFile(const Handle(WOKMake_InputFile)& infile)
+{
+ if(infile->IsStepID())
+ return Standard_True;
+ return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetUnderlyingSteps
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKMake_MetaStep::GetUnderlyingSteps()
+{
+ Standard_Integer i,j;
+ Handle(TColStd_HSequenceOfHAsciiString) subcodeseq = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) NULLRESULT;
+
+ for(i=1; i<=myinflow.Extent(); i++)
+ {
+ Handle(WOKMake_InputFile) infile = myinflow(i);
+
+ if(infile->IsStepID())
+ {
+ Handle(TCollection_HAsciiString) aunit = infile->ID()->Token(":", 1);
+ Handle(TCollection_HAsciiString) acode = infile->ID()->Token(":", 2);
+ Handle(TCollection_HAsciiString) apart = infile->ID()->Token(":", 3);
+ Standard_Boolean known = Standard_False;
+
+ if(!apart->IsEmpty())
+ {
+ for(j=1;j<=subcodeseq->Length(); j++)
+ if(!strcmp(apart->ToCString(), subcodeseq->Value(j)->ToCString()))
+ known = Standard_True;
+
+ if(!known)
+ {
+ subcodeseq->Append(apart);
+ }
+ }
+ }
+ }
+
+ for(i=1; i<=subcodeseq->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) thesubcode = subcodeseq->Value(i);
+ Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(Unit(), Code(), thesubcode);
+
+ if(thestep.IsNull())
+ {
+ ErrorMsg << "WOKMake_MetaStep::GetUnderlyingSteps"
+ << "Could not obtain step for code : " << Code() << " in unit " << Unit()->Name() << endm;
+ SetFailed();
+ return NULLRESULT;
+ }
+
+ Handle(TColStd_HSequenceOfHAsciiString) precsteps = new TColStd_HSequenceOfHAsciiString;
+
+ for(j=1; j<=myinflow.Extent(); j++)
+ {
+ Handle(WOKMake_InputFile) infile = myinflow(j);
+ Handle(TCollection_HAsciiString) aunit = infile->ID()->Token(":", 1);
+ Handle(TCollection_HAsciiString) acode = infile->ID()->Token(":", 2);
+ Handle(TCollection_HAsciiString) apart = infile->ID()->Token(":", 3);
+ Handle(WOKMake_Step) precstep;
+
+
+ Handle(WOKernel_DevUnit) precunit = Locator()->LocateDevUnit(aunit);
+
+ if(precunit.IsNull())
+ {
+ ErrorMsg << "WOKMake_MetaStep::Execute"
+ << "Specified unit (" << aunit << ") in input of step " << Code()
+ << " of " << Unit()->Name() << " could not be found" << endm;
+ SetFailed();
+ return NULLRESULT;
+ }
+
+ if(apart->IsEmpty())
+ {
+ precstep = BuildProcess()->GetAndAddStep(precunit, acode, Handle(TCollection_HAsciiString)());
+ }
+ else
+ {
+ precstep = BuildProcess()->GetAndAddStep(precunit, acode, apart);
+ }
+
+ if(precstep.IsNull())
+ {
+ ErrorMsg << "WOKMake_MetaStep::GetUnderlyingSteps"
+ << "Could not obtain step for code : " << acode << " in unit " << precunit->Name() << endm;
+ SetFailed();
+ return NULLRESULT;
+ }
+
+ if(!strcmp(thesubcode->ToCString(), apart->ToCString()) || apart->IsEmpty())
+ {
+ precsteps->Append(precstep->UniqueName());
+ }
+ }
+
+ // verifer que chaque precedence step de la MetaStep est une precedence step de
+ // la sous step. sinon l'ajouter telle quelle.
+
+ for(Standard_Integer l=1; l<=PrecedenceSteps()->Length(); l++)
+ {
+ const Handle(WOKMake_Step)& precstep = BuildProcess()->Find(PrecedenceSteps()->Value(l));
+ const Standard_CString preccode = precstep->Code()->ToCString();
+ Standard_Boolean found = Standard_False;
+
+ for(Standard_Integer k=1; k<=precsteps->Length() && !found; k++)
+ {
+ const Handle(WOKMake_Step)& subprec = BuildProcess()->Find(precsteps->Value(k));
+ const Standard_CString subpreccode = subprec->Code()->ToCString();
+ if(!strcmp(preccode, BuildProcess()->Find(precsteps->Value(k))->Code()->ToCString()))
+ found = Standard_True;
+ }
+
+ if(!found)
+ {
+ precsteps->Append(precstep->UniqueName());
+ Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(precstep->StepOutputID(),
+ Handle(WOKernel_File)(),
+ Handle(WOKBuilder_Entity)(),
+ Handle(WOKUtils_Path)());
+ infile->SetLocateFlag(Standard_True);
+ infile->SetStepID(Standard_True);
+ infile->SetDirectFlag(Standard_True);
+ infile->SetPhysicFlag(Standard_False);
+ myinflow.Add(infile->ID(), infile);
+ }
+ }
+
+ if(IsToExecute())
+ thestep->DoExecute();
+
+ thestep->SetPrecedenceSteps(precsteps);
+ thestep->SetTargets(Targets());
+ thestep->SetOptions(Options());
+
+ result->Append(thestep->UniqueName());
+
+ }
+
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetLastUnderlyingSteps
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKMake_MetaStep::GetLastUnderlyingSteps()
+{
+ Standard_Integer i;
+
+ Handle(WOKMake_HSequenceOfOutputFile) out = OutputFileList();
+ Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+ Handle(TColStd_HSequenceOfHAsciiString) NULLRESULT;
+
+
+ if (out.IsNull()) return result;
+
+ for(i=1; i<=out->Length(); i++)
+ {
+ const Handle(WOKMake_OutputFile)& outfile = out->Value(i);
+
+ if(outfile->IsStepID())
+ {
+ Handle(TCollection_HAsciiString) aunit = outfile->ID()->Token(":", 1);
+ Handle(TCollection_HAsciiString) acode = outfile->ID()->Token(":", 2);
+ Handle(TCollection_HAsciiString) apart = outfile->ID()->Token(":", 3);
+
+ Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(Unit(), acode, apart);
+
+ if(thestep.IsNull())
+ {
+ return NULLRESULT;
+ }
+
+ thestep->DontExecute();
+
+ result->Append(thestep->UniqueName());
+ }
+
+ }
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetUnderlyingSteps
+//purpose :
+//=======================================================================
+void WOKMake_MetaStep::SetUnderlyingSteps(const Handle(TColStd_HSequenceOfHAsciiString)& steps)
+{
+ myparts = new TColStd_HSequenceOfHAsciiString;
+ Standard_Integer i;
+
+ if(steps.IsNull())
+ {
+ myparts.Nullify();
+ myundersteps.Nullify();
+ }
+
+ for(i=1; i<=steps->Length(); i++)
+ {
+ myparts->Append(BuildProcess()->Find(steps->Value(i))->SubCode());
+ }
+ myundersteps = steps;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : UnderlyingSteps
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKMake_MetaStep::UnderlyingSteps()
+{
+ if(!myundersteps.IsNull())
+ {
+ return myundersteps;
+ }
+ if(!IsToExecute())
+ {
+ SetUnderlyingSteps(GetLastUnderlyingSteps());
+ return myundersteps;
+ }
+ else
+ {
+ SetUnderlyingSteps(GetUnderlyingSteps());
+ return myundersteps;
+ }
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Execute
+//purpose :
+//=======================================================================
+void WOKMake_MetaStep::Execute(const Handle(WOKMake_HSequenceOfInputFile)& execlist)
+{
+ Standard_Integer i,j;
+ Standard_Boolean ok = Standard_True;
+ Handle(TColStd_HSequenceOfHAsciiString) subcodeseq = new TColStd_HSequenceOfHAsciiString;
+
+ Handle(TColStd_HSequenceOfHAsciiString) thesteps;
+
+ thesteps = UnderlyingSteps();
+
+ for(j=1;j<=thesteps->Length(); j++)
+ {
+ Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesteps->Value(j));
+
+ thestep->DontExecute();
+ }
+
+ for(i=1; i<=execlist->Length(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = execlist->Value(i);
+
+ if(infile->IsStepID())
+ {
+ Handle(TCollection_HAsciiString) aunit = infile->ID()->Token(":", 1);
+ Handle(TCollection_HAsciiString) acode = infile->ID()->Token(":", 2);
+ Handle(TCollection_HAsciiString) apart = infile->ID()->Token(":", 3);
+
+ if(!apart->IsEmpty())
+ {
+ for(j=1;j<=thesteps->Length(); j++)
+ {
+ Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesteps->Value(j));
+
+ if(!thestep->SubCode().IsNull())
+ {
+ if(!strcmp(apart->ToCString(), thestep->SubCode()->ToCString()))
+ {
+ thestep->DoExecute();
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ for(i=1; i<=thesteps->Length(); i++)
+ {
+ Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesteps->Value(i));
+
+ if (thestep->IsToExecute())
+ {
+ InfoMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << endm;
+ }
+
+ thestep->Make();
+
+ if (thestep->IsToExecute())
+ {
+ switch(thestep->Status())
+ {
+ case WOKMake_Uptodate:
+ InfoMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << " is uptodate" << endm;
+ break;
+ case WOKMake_Success:
+ InfoMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << " succeeded" << endm;
+ break;
+ case WOKMake_Incomplete:
+ WarningMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << " is incomplete" << endm;
+ break;
+ case WOKMake_Failed:
+ ErrorMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << " failed" << endm;
+ ok = Standard_False;
+ break;
+ case WOKMake_Unprocessed:
+ WarningMsg << "WOKMake_MetaStep::Execute"
+ << "========> " << thestep->SubCode() << " is still unprocessed" << endm;
+ ok=Standard_False;
+ break;
+ }
+ }
+
+ Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile;
+
+ outfile->SetID(thestep->StepOutputID());
+ outfile->SetLocateFlag(Standard_True);
+ outfile->SetPhysicFlag(Standard_False);
+ outfile->SetStepID(Standard_True);
+
+ Handle(TColStd_HSequenceOfHAsciiString) precsteps = thestep->PrecedenceSteps();
+
+ for(j=1; j<=precsteps->Length(); j++)
+ {
+ Handle(TCollection_HAsciiString) unitname = precsteps->Value(j)->Token(":", 1);
+ Handle(TCollection_HAsciiString) precid = BuildProcess()->Find(precsteps->Value(j))->StepOutputID();
+ Handle(WOKMake_InputFile) infile = myinflow.FindFromKey(precid);
+
+ if(infile.IsNull())
+ {
+ WarningMsg << "WOKMake_MetaStep::Execute"
+ << "Ignoring precedence step dependence on " << precid << " (not in input list)" << endm;
+ }
+ else
+ {
+ AddExecDepItem(infile, outfile, Standard_True);
+ }
+ }
+ }
+
+ thesteps.Nullify();
+
+ if(ok) SetSucceeded();
+ else SetFailed();
+ return;
+}
+
+
+
+//=======================================================================
+//function : Make
+//purpose :
+//=======================================================================
+WOKMake_Status WOKMake_MetaStep::Make()
+{
+
+ if(IsToExecute())
+ {
+ GetInputFlow();
+ if(CheckStatus("getting input list")) return Status();
+
+ Handle(WOKMake_HSequenceOfInputFile) execlist;
+
+ execlist = ExecutionInputList();
+
+ if(CheckStatus("determine exec list")) return Status();
+
+ if(execlist->Length() || IsChecked())
+ {
+ Execute(execlist);
+
+ if(CheckStatus("execution")) return Status();
+ }
+ else
+ {
+ SetUptodate();
+ }
+
+ AcquitExecution(execlist);
+
+ if(CheckStatus("acquit execution")) return Status();
+ }
+ else
+ {
+ Standard_Integer i;
+
+ Handle(TColStd_HSequenceOfHAsciiString) steps = GetLastUnderlyingSteps();
+
+ if(!steps.IsNull())
+ {
+ for(i=1;i<=steps->Length(); i++)
+ {
+ BuildProcess()->Find(steps->Value(i))->Make();
+ }
+ }
+ }
+
+ Handle(WOKMake_HSequenceOfOutputFile) outlist = OutputFileList();
+ Handle(TColStd_HSequenceOfHAsciiString) unitfiles = Unit()->FileList();
+
+ if(unitfiles.IsNull())
+ {
+ unitfiles = new TColStd_HSequenceOfHAsciiString;
+ Unit()->SetFileList(unitfiles);
+ }
+
+ if(!outlist.IsNull())
+ {
+ for(Standard_Integer j=1; j<=outlist->Length(); j++)
+ {
+ Handle(WOKMake_OutputFile) outfile = outlist->Value(j);
+
+ if(outfile->IsProduction() &&
+ outfile->IsPhysic() &&
+ outfile->IsLocateAble() &&
+ outfile->IsMember())
+ {
+ unitfiles->Append(outfile->ID());
+ }
+ }
+ }
+
+ return Status();
+}
+
+//=======================================================================
+//function : HandleOutputFile
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_MetaStep::HandleOutputFile(const Handle(WOKMake_OutputFile)& afile)
+{
+ if(afile.IsNull()) return Standard_False;
+
+ if(afile->IsStepID())
+ {
+ switch(afile->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Same:
+ case WOKMake_Moved:
+ break;
+ case WOKMake_Disappeared:
+ {
+ Handle(TCollection_HAsciiString) apart = afile->ID()->Token(":", 3);
+ Handle(WOKMake_Step) thesubstep = BuildProcess()->GetAndAddStep(Unit(), Code(), apart);
+ if (!thesubstep.IsNull())
+ {
+ Handle(WOKernel_File) asubout;
+ asubout = thesubstep->LocateAdmFile(thesubstep->OutLocator(),thesubstep->OutputFilesFileName());
+
+ if (!asubout.IsNull())
+ {
+ //substep production has to be removed
+ Handle(WOKMake_HSequenceOfOutputFile) outsubfiles = new WOKMake_HSequenceOfOutputFile;
+
+ WOKMake_OutputFile::ReadFile(asubout->Path(), thesubstep->OutLocator(), outsubfiles);
+
+ for (Standard_Integer i=1; i<= outsubfiles->Length(); i++)
+ {
+ Handle(WOKMake_OutputFile) outsubfile = outsubfiles->Value(i);
+ if (!outsubfile.IsNull())
+ outsubfile->SetStatus(WOKMake_Disappeared);
+
+ thesubstep->HandleOutputFile(outsubfile);
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ return Standard_False;
+}
--- /dev/null
+-- File: WOKMake_OutputFile.cdl
+-- Created: Thu Apr 25 21:54:16 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1996
+
+
+class OutputFile from WOKMake
+inherits StepFile from WOKMake
+
+ ---Purpose:
+
+uses
+ Locator from WOKernel,
+ File from WOKernel,
+ Entity from WOKBuilder,
+ IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake,
+ HSequenceOfOutputFile from WOKMake,
+ FileStatus from WOKMake,
+ InputFile from WOKMake,
+ Path from WOKUtils,
+ HAsciiString from TCollection
+
+is
+
+ Create returns mutable OutputFile from WOKMake;
+
+ Create(anid : HAsciiString from TCollection;
+ afile : File from WOKernel;
+ abuildent : Entity from WOKBuilder;
+ aoldpath : Path from WOKUtils)
+ returns mutable OutputFile from WOKMake;
+
+ Create(aninfile : InputFile from WOKMake)
+ returns mutable OutputFile from WOKMake;
+
+ --
+ -- READ/WRITE OUTPUT FILES
+ --
+
+ ReadLine(myclass; astream : out IStream from Standard;
+ locator : Locator from WOKernel;
+ infile : out OutputFile from WOKMake)
+ is private;
+
+ WriteLine(myclass; astream : out OStream from Standard;
+ infile : OutputFile from WOKMake)
+ is private;
+
+ -- Into/From a map
+ ReadFile(myclass; afile : Path from WOKUtils;
+ alocator : Locator from WOKernel;
+ amap : out IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake)
+ returns Integer from Standard;
+
+ WriteFile(myclass; afile : Path from WOKUtils; amap : IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake)
+ returns Integer from Standard;
+
+ -- Into/From a seq
+ ReadFile(myclass; afile : Path from WOKUtils;
+ alocator : Locator from WOKernel;
+ aseq : HSequenceOfOutputFile from WOKMake)
+ returns Integer from Standard;
+
+ WriteFile(myclass; afile : Path from WOKUtils; aseq : HSequenceOfOutputFile from WOKMake)
+ returns Integer from Standard;
+
+ SetReference(me:mutable);
+ SetProduction(me:mutable);
+
+ IsProduction(me) returns Boolean from Standard;
+ ---C++: inline
+
+ SetMember(me:mutable);
+ SetExtern(me:mutable);
+
+ IsMember(me)
+ ---C++: inline
+ returns Boolean from Standard;
+
+end OutputFile;
--- /dev/null
+// File: WOKMake_OutputFile.cxx
+// Created: Thu Apr 25 21:57:20 1996
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <fstream.h>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKernel_Locator.hxx>
+
+#include <WOKMake_OutputFile.ixx>
+
+
+#define READBUF_SIZE 1024
+
+//=======================================================================
+//function : WOKMake_OutputFile
+//purpose :
+//=======================================================================
+WOKMake_OutputFile::WOKMake_OutputFile()
+{
+ SetMember();
+}
+
+//=======================================================================
+//function : WOKMake_OutputFile
+//purpose :
+//=======================================================================
+WOKMake_OutputFile::WOKMake_OutputFile(const Handle(TCollection_HAsciiString)& anid,
+ const Handle(WOKernel_File)& afile,
+ const Handle(WOKBuilder_Entity)& anent,
+ const Handle(WOKUtils_Path)& apath)
+ : WOKMake_StepFile(anid, afile, anent, apath)
+{
+ SetMember();
+}
+
+//=======================================================================
+//function : WOKMake_OutputFile
+//purpose :
+//=======================================================================
+WOKMake_OutputFile::WOKMake_OutputFile(const Handle(WOKMake_InputFile)& infile)
+ : WOKMake_StepFile(infile->ID(), infile->File(), infile->BuilderEntity(), infile->LastPath())
+{
+ SetLocateFlag(infile->IsLocateAble());
+ SetPhysicFlag(infile->IsPhysic());
+ SetStepID(infile->IsStepID());
+ //if(infile->IsMember()) SetMember();
+ //else SetExtern();
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadLine
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::ReadLine(Standard_IStream & astream,
+ const Handle(WOKernel_Locator)& alocator,
+ Handle(WOKMake_OutputFile)& outfile)
+{
+ Handle(TCollection_HAsciiString) id;
+ Handle(TCollection_HAsciiString) oldpath;
+ Handle(WOKernel_File) afile;
+ Handle(WOKMake_OutputFile) aoutfile;
+ Standard_Integer i,len;
+ static char flags[READBUF_SIZE];
+ static char anamebuf[READBUF_SIZE], apathbuf[READBUF_SIZE];
+
+ *flags = *anamebuf = *apathbuf = '\0';
+
+ if(!astream)
+ {
+ outfile.Nullify();
+ return;
+ }
+
+ //astream >> setw(READBUF_SIZE) >> flags >> setw(READBUF_SIZE) >> anamebuf >> setw(READBUF_SIZE) >> apathbuf;
+ astream.get(flags, READBUF_SIZE, ' ');
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(anamebuf, READBUF_SIZE, ' ');
+ astream.ignore(READBUF_SIZE, ' ');
+ astream.get(apathbuf, READBUF_SIZE);
+ astream.ignore(READBUF_SIZE, '\n');
+
+ if(flags[0] == '\0' || anamebuf[0] == '\0' || apathbuf[0] == '\0')
+ {
+ outfile.Nullify();
+ return;
+ }
+
+ aoutfile = new WOKMake_OutputFile;
+
+ len = strlen(flags);
+ for(i=0; i<len; i++)
+ {
+ switch(flags[i])
+ {
+ case '+':
+ aoutfile->SetProduction();
+ break;
+ case '-':
+ aoutfile->SetReference();
+ break;
+ case 'V':
+ aoutfile->SetPhysicFlag(Standard_False);
+ break;
+ case 'S':
+ aoutfile->SetStepID(Standard_True);
+ break;
+ case 'M':
+ aoutfile->SetMember();
+ break;
+ case 'E':
+ aoutfile->SetExtern();
+ break;
+ }
+ }
+
+ oldpath = new TCollection_HAsciiString(apathbuf);
+
+ if(anamebuf[0] != '.')
+ {
+ Handle(TCollection_HAsciiString) id = new TCollection_HAsciiString(anamebuf);
+
+ if( aoutfile->IsPhysic())
+ {
+ afile = alocator->Locate(id);
+
+ if(!afile.IsNull())
+ {
+ id = afile->LocatorName();
+ }
+ }
+
+ aoutfile->SetID(id);
+ aoutfile->SetFile(afile);
+ aoutfile->SetLastPath(new WOKUtils_Path(oldpath));
+ aoutfile->SetLocateFlag(Standard_True);
+
+ //if(!strcmp(id->Token(":", 2)->ToCString(), "msentity"))
+ //{
+ // aoutfile->SetPhysicFlag(Standard_False);
+ //}
+ }
+ else
+ {
+ aoutfile->SetID(oldpath);
+ aoutfile->SetLastPath(new WOKUtils_Path(oldpath));
+ aoutfile->SetLocateFlag(Standard_False);
+ }
+
+ outfile = aoutfile;
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteLine
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::WriteLine(Standard_OStream& astream,
+ const Handle(WOKMake_OutputFile)& outfile)
+{
+ if(outfile.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_OutputFile::WriteLine : Null Output");
+ }
+
+ if(outfile->IsProduction()) astream << "+";
+ else astream << "-";
+ if(!outfile->IsPhysic()) astream << "V";
+ if(outfile->IsStepID()) astream << "S";
+ if(outfile->IsMember()) astream << "M";
+ else astream << "E";
+
+ astream << " ";
+
+ if(outfile->IsLocateAble())
+ {
+ if(outfile->IsPhysic())
+ {
+ astream << outfile->File()->LocatorName()->ToCString() << " " << outfile->LastPath()->Name()->ToCString() << endl;
+ }
+ else
+ {
+ astream << outfile->ID()->ToCString() << " ." << endl;
+ }
+ }
+ else
+ {
+ astream << ". " << outfile->LastPath()->Name()->ToCString() << endl;
+ }
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_OutputFile::ReadFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKernel_Locator)& alocator,
+ WOKMake_IndexedDataMapOfHAsciiStringOfOutputFile& amap)
+{
+ if(apath->Exists())
+ {
+ Standard_Integer i;
+ ifstream astream(apath->Name()->ToCString());
+ Handle(WOKMake_OutputFile) outfile;
+
+ ReadLine(astream, alocator, outfile);
+
+ while(!outfile.IsNull())
+ {
+ i++;
+ amap.Add(outfile->ID(), outfile);
+ ReadLine(astream, alocator, outfile);
+ }
+ astream.close();
+ return i;
+ }
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_OutputFile::WriteFile(const Handle(WOKUtils_Path)& apath,
+ const WOKMake_IndexedDataMapOfHAsciiStringOfOutputFile& amap)
+{
+ Standard_Integer i;
+ ofstream astream(apath->Name()->ToCString(), ios::out);
+
+ if(!astream)
+ {
+ ErrorMsg << "WOKMake_StepOutput::Dump" << "Could not open " << apath->Name() << endm;
+ Standard_ProgramError::Raise("");
+ }
+
+ for(i=1; i<=amap.Extent(); i++)
+ {
+ WriteLine(astream, amap(i));
+ }
+ astream.close();
+ return 0;
+}
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ReadFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_OutputFile::ReadFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKernel_Locator)& alocator,
+ const Handle(WOKMake_HSequenceOfOutputFile)& aseq)
+{
+ if(apath.IsNull() || aseq.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_OutputFile::ReadFile : NullOutput");
+ }
+
+ if(apath->Exists())
+ {
+ Standard_Integer i;
+ ifstream astream(apath->Name()->ToCString(), ios::in);
+ Handle(WOKMake_OutputFile) outfile;
+
+ ReadLine(astream, alocator, outfile);
+ while(!outfile.IsNull())
+ {
+ i++;
+ aseq->Append(outfile);
+ ReadLine(astream, alocator, outfile);
+ }
+
+ astream.close();
+ return i;
+ }
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WriteFile
+//purpose :
+//=======================================================================
+Standard_Integer WOKMake_OutputFile::WriteFile(const Handle(WOKUtils_Path)& apath,
+ const Handle(WOKMake_HSequenceOfOutputFile)& aseq)
+{
+ Standard_Integer i;
+ ofstream astream(apath->Name()->ToCString(), ios::out);
+
+ if(!astream)
+ {
+ ErrorMsg << "WOKMake_StepOutput::Dump" << "Could not open " << apath->Name() << endm;
+ Standard_ProgramError::Raise("");
+ }
+
+ for(i=1; i<=aseq->Length(); i++)
+ {
+ WriteLine(astream, aseq->Value(i));
+ }
+ astream.close();
+ return 0;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetReference
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::SetReference()
+{
+ myattr &= (STEPFILE_REFPROD ^ myattr);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetReference
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::SetProduction()
+{
+ myattr |= STEPFILE_REFPROD;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetReference
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::SetMember()
+{
+ myattr |= STEPFILE_MEMBEXT;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetReference
+//purpose :
+//=======================================================================
+void WOKMake_OutputFile::SetExtern()
+{
+ myattr &= (STEPFILE_MEMBEXT ^ myattr);
+}
+
--- /dev/null
+// File: WOKMake_OutputFile.lxx
+// Created: Wed Jun 19 15:38:08 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsProduction
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_OutputFile::IsProduction() const
+{
+ if(myattr & STEPFILE_REFPROD) return Standard_True;
+ else return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsMember
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_OutputFile::IsMember() const
+{
+ if(myattr & STEPFILE_MEMBEXT) return Standard_True;
+ else return Standard_False;
+}
--- /dev/null
+-- File: WOKMake_Step.cdl
+-- Created: Wed Aug 23 11:21:00 1995
+-- Author: Jean GAUTIER
+-- <jga@cobrax>
+---Copyright: Matra Datavision 1995
+
+deferred class Step from WOKMake
+inherits TShared from MMgt
+
+ ---Purpose: Base class for umake Process
+
+uses
+ Status from WOKMake,
+ HSequenceOfStepOption from WOKMake,
+ HSequenceOfInputFile from WOKMake,
+ HSequenceOfOutputFile from WOKMake,
+ IndexedMapOfDepItem from WOKMake,
+ IndexedDataMapOfHAsciiStringOfInputFile from WOKMake,
+ IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake,
+ StepFile from WOKMake,
+ InputFile from WOKMake,
+ OutputFile from WOKMake,
+ DepItem from WOKMake,
+ FileStatus from WOKMake,
+ Status from WOKMake,
+ BuildProcess from WOKMake,
+ BuildProcessPtr from WOKMake,
+ DevUnit from WOKernel,
+ HSequenceOfFile from WOKernel,
+ File from WOKernel,
+ Locator from WOKernel,
+ UnitGraph from WOKernel,
+ HSequenceOfEntity from WOKBuilder,
+ Entity from WOKBuilder,
+ Shell from WOKUtils,
+ Path from WOKUtils,
+ HSequenceOfHAsciiString from TColStd,
+ HArray2OfInteger from TColStd,
+ HAsciiString from TCollection
+
+raises
+ ProgramError from Standard
+
+is
+ Initialize(aprocess : BuildProcess from WOKMake;
+ aunit : DevUnit from WOKernel;
+ acode : HAsciiString from TCollection;
+ checked, hidden : Boolean from Standard);
+
+
+ --- Contruction D'une WOKBuilder_Entity a partir d'un WOKernel_File
+ BuilderEntity(me; afile : File from WOKernel)
+ returns mutable Entity from WOKBuilder
+ is virtual protected;
+
+ BuilderEntity(me; apath : Path from WOKUtils)
+ returns mutable Entity from WOKBuilder
+ is virtual protected;
+
+ -- Calcul des entites en entree de l'etape
+ --
+ -- 1 - les entites propres a l'etape dans cette ud
+ -- 2 - les composants externes utilises par cette ud (autres specs,
+ -- includes ...)
+
+ HandleInputFile(me:mutable; anitem : InputFile from WOKMake)
+ ---Purpose: 1 - Adds File In list if file is an input of step
+ -- 2 - Sets Build Flag if file is a candidate to construction
+ returns Boolean from Standard
+ is deferred protected;
+
+ GetInputFromStep(me:mutable; astep : Step from WOKMake);
+
+ GetInputFlow(me:mutable)
+ ---Purpose: Computes Entity list involved in step preforming
+ -- in the InputFlow list.
+ is virtual protected;
+
+ -- Calcul des dependances liees a l'etape :
+ --
+ -- 1 - L'etape (ou un de ses composants) est-elle a (re)faire ?
+ -- 2 - Quels sont les entites d'entree de l'etape a refaire ?
+
+ InputFileList(me : mutable)
+ ---C++: return const &
+ returns HSequenceOfInputFile from WOKMake;
+
+ LoadDependencies(me:mutable)
+ is virtual protected;
+
+ StepFileStatus(me:mutable; afile : mutable StepFile from WOKMake; alocator : Locator from WOKernel)
+ returns FileStatus from WOKMake
+ is private;
+
+ OutOfDateEntities(me:mutable)
+ ---Purpose: Set Build flag to OutOfDate entities
+ -- Clears Build flag to Uptodate Entities
+ -- This base implementation does nothing
+ returns HSequenceOfInputFile from WOKMake
+ is virtual protected;
+
+ HandleTargets(me:mutable)
+ returns HSequenceOfInputFile from WOKMake
+ is virtual protected;
+
+ ForceBuild(me:mutable)
+ returns HSequenceOfInputFile from WOKMake
+ is virtual protected;
+ ---Purpose: Force construction of step
+
+ CompleteExecList(me:mutable; alist : HSequenceOfInputFile from WOKMake)
+ is virtual protected;
+
+ -- Construction
+ --
+
+ ExecutionInputList(me:mutable)
+ returns HSequenceOfInputFile from WOKMake
+ is virtual protected;
+
+ CheckStatus(me; acontext : CString from Standard)
+ returns Boolean from Standard
+ is protected;
+
+ AddExecDepItem(me: mutable; input : InputFile from WOKMake;
+ output : OutputFile from WOKMake;
+ adirectflag : Boolean from Standard);
+ ---Purpose: Add an execution item in sequence
+
+ Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake)
+ ---Purpose: Executes step
+ -- Computes output files
+ is deferred private;
+
+ AcquitExecution(me:mutable; execlist : HSequenceOfInputFile from WOKMake)
+ is virtual protected;
+
+ Init(me:mutable)
+ is virtual protected;
+
+
+ Make(me:mutable)
+ ---Purpose: Computes dependances
+ -- Decides if perform is needed.
+ -- Performs Step on needed entities
+ -- returns status
+ returns Status from WOKMake is virtual;
+
+ Terminate(me:mutable)
+ is virtual protected;
+
+ OutputFileList(me)
+ returns HSequenceOfOutputFile from WOKMake;
+
+ --
+ -- Ouput file Management
+ --
+
+ HandleOutputFile(me:mutable; anfile : OutputFile from WOKMake)
+ ---Purpose: Handles Output file new/same/disappereread
+ returns Boolean from Standard
+ is virtual ;
+
+ --
+ --
+ --
+ --
+
+ BuildProcess(me)
+ ---C++: inline
+ returns BuildProcess from WOKMake
+ is protected;
+
+ Unit(me)
+ ---C++: return const &
+ ---C++: inline
+ returns DevUnit from WOKernel;
+
+ StepOutputID(myclass; aname, acode: HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+ StepOutputID(myclass; aname, acode, asubcode : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+ StepOutputID(me)
+ returns HAsciiString from TCollection;
+
+
+ AdmFileType(me)
+ returns HAsciiString from TCollection
+ is deferred protected;
+
+ InputFilesFileName(me)
+ returns HAsciiString from TCollection
+ is virtual;
+ DepItemsFileName(me)
+ returns HAsciiString from TCollection
+ is virtual;
+ OutputFilesFileName(me)
+ returns HAsciiString from TCollection
+ is virtual;
+
+ LogFileName(me)
+ returns HAsciiString from TCollection
+ is virtual;
+
+ AdmFile(me; aname : HAsciiString from TCollection)
+ returns mutable File from WOKernel
+ is virtual;
+
+ LocateAdmFile(me; alocator : Locator from WOKernel; aname : HAsciiString from TCollection)
+ returns mutable File from WOKernel;
+
+
+ -- Step Properties Management
+ --
+
+ UniqueName(myclass; aunit : DevUnit from WOKernel; acode, asubcode : HAsciiString from TCollection)
+ returns HAsciiString from TCollection;
+
+ SplitUniqueName(myclass; anid : HAsciiString from TCollection; auname, acode, asubcode : out HAsciiString from TCollection);
+
+ UniqueName(me:mutable)
+ ---C++: return const &
+ returns HAsciiString from TCollection;
+
+ Code(me) returns HAsciiString from TCollection;
+
+ SetSubCode(me:mutable; acode : HAsciiString from TCollection) is private;
+ SubCode(me) returns HAsciiString from TCollection;
+
+ IsHidden(me) returns Boolean from Standard;
+ IsChecked(me) returns Boolean from Standard;
+
+ -- Step Status Management
+ --
+
+ SetUptodate(me:mutable);
+ SetSucceeded(me:mutable);
+ SetIncomplete(me:mutable);
+ SetFailed(me:mutable);
+ SetUnprocessed(me:mutable);
+ SetStatus(me:mutable; astatus : Status from WOKMake);
+
+ Status(me) returns Status from WOKMake;
+
+
+ IsOrIsSubStepOf(me; acode : HAsciiString from TCollection)
+ ---Purpose: return true if step has that code or if step is sub
+ -- of thet code
+ returns Boolean from Standard;
+
+ Shell(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Shell from WOKUtils;
+
+ UnitGraph(me)
+ ---C++: return const &
+ ---C++: inline
+ returns UnitGraph from WOKernel;
+
+ Locator(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Locator from WOKernel;
+
+ InLocator(me)
+ returns mutable Locator from WOKernel
+ is virtual;
+
+ OutLocator(me)
+ returns mutable Locator from WOKernel
+ is virtual;
+
+ OutputDirTypeName(me)
+ returns HAsciiString from TCollection
+ is deferred protected;
+
+ SetOutputDir(me:mutable; adir : Path from WOKUtils);
+ OutputDir(me:mutable) returns Path from WOKUtils;
+
+ IsDBMSDependent(me)
+ returns Boolean from Standard;
+ IsStationDependent(me)
+ returns Boolean from Standard;
+
+
+ -- Options Management
+ --
+
+ SetOptions(me:mutable; options : HSequenceOfStepOption from WOKMake);
+ Options(me) returns HSequenceOfStepOption from WOKMake;
+
+ -- Targets Management
+ --
+
+ SetTargets(me:mutable; targets : HSequenceOfHAsciiString from TColStd);
+ Targets(me) returns HSequenceOfHAsciiString from TColStd;
+
+ -- Gestion des etapes precedentes
+ --
+
+ PrecedenceSteps(me) returns HSequenceOfHAsciiString from TColStd;
+ SetPrecedenceSteps(me:mutable; steps : HSequenceOfHAsciiString from TColStd);
+
+ IsToExecute(me) returns Boolean from Standard;
+ DoExecute(me:mutable);
+ DontExecute(me:mutable);
+
+fields
+ myunit : DevUnit from WOKernel;
+ myunique : HAsciiString from TCollection;
+
+ mycode : HAsciiString from TCollection;
+ mysubcode : HAsciiString from TCollection;
+
+ myprocess : BuildProcessPtr from WOKMake;
+
+ myinputcomp : Boolean from Standard;
+ myinflow : IndexedDataMapOfHAsciiStringOfInputFile from WOKMake is protected;
+ myinput : HSequenceOfInputFile from WOKMake;
+
+ mydeploaded : Boolean from Standard;
+ mydepin : IndexedDataMapOfHAsciiStringOfInputFile from WOKMake is protected;
+ mydepitems : IndexedMapOfDepItem from WOKMake is protected;
+ mydepmatrix : HArray2OfInteger from TColStd is protected;
+ mydepout : IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake is protected;
+
+ myoutflow : IndexedDataMapOfHAsciiStringOfOutputFile from WOKMake is protected;
+ myitems : IndexedMapOfDepItem from WOKMake;
+
+ myoutput : HSequenceOfOutputFile from WOKMake;
+
+ myprecsteps : HSequenceOfHAsciiString from TColStd;
+ mystatus : Status from WOKMake;
+ mycheck : Boolean from Standard;
+ myhidden : Boolean from Standard;
+ myexecflag : Boolean from Standard;
+ mytargets : HSequenceOfHAsciiString from TColStd;
+ myoptions : HSequenceOfStepOption from WOKMake;
+
+ myoutputdir : Path from WOKUtils;
+
+
+friends
+
+ class StepBuilder from WOKMake,
+ class BuildProcess from WOKMake
+
+end Step;
+
--- /dev/null
+// File: WOKMake_Step.cxx
+// Created: Wed Aug 23 14:46:05 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <OSD_SharedLibrary.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_MapOfHAsciiString.hxx>
+
+#include <WOKUtils_AdmFile.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_Shell.hxx>
+
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_Entity.hxx>
+#include <WOKernel_Session.hxx>
+#include <WOKernel_UnitNesting.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_FileType.hxx>
+#include <WOKernel_HSequenceOfFile.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+
+#include <WOKBuilder_Include.hxx>
+#include <WOKBuilder_CDLFile.hxx>
+#include <WOKBuilder_Compilable.hxx>
+#include <WOKBuilder_CodeGenFile.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+#include <WOKBuilder_ObjectFile.hxx>
+#include <WOKBuilder_MFile.hxx>
+#include <WOKBuilder_CompressedFile.hxx>
+#include <WOKBuilder_ArchiveLibrary.hxx>
+#include <WOKBuilder_SharedLibrary.hxx>
+#include <WOKBuilder_Miscellaneous.hxx>
+#include <WOKBuilder_TarFile.hxx>
+#ifdef WNT
+# include <WOKBuilder_StaticLibrary.hxx>
+# include <WOKBuilder_ImportLibrary.hxx>
+#endif // WNT
+
+#include <WOKMake_InputFile.hxx>
+#include <WOKMake_DepItem.hxx>
+#include <WOKMake_OutputFile.hxx>
+#include <WOKMake_HSequenceOfStepOption.hxx>
+#include <WOKMake_StepConstructPtr.hxx>
+#include <WOKMake_MetaStep.hxx>
+#include <WOKMake_StepBuilder.hxx>
+
+#include <WOKMake_Step.ixx>
+
+//=======================================================================
+//function : WOKMake_Step
+//purpose :
+//=======================================================================
+WOKMake_Step::WOKMake_Step(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Standard_Boolean checked,
+ const Standard_Boolean hidden)
+: myprocess(aprocess.operator->()), myunit(aunit), mycode(acode), mycheck(checked), myhidden(hidden),
+ mystatus(WOKMake_Unprocessed), myexecflag(Standard_False), mydeploaded(Standard_False), myinputcomp(Standard_False)
+{
+}
+
+//=======================================================================
+//function : BuilderEntity
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_Entity) WOKMake_Step::BuilderEntity(const Handle(WOKernel_File)& afile) const
+{
+ Handle(WOKBuilder_Entity) result;
+ if(!afile.IsNull())
+ {
+ return BuilderEntity(afile->Path());
+ }
+ return result;
+}
+
+//=======================================================================
+//function : BuilderEntity
+//purpose :
+//=======================================================================
+Handle(WOKBuilder_Entity) WOKMake_Step::BuilderEntity(const Handle(WOKUtils_Path)& apath) const
+{
+ Handle(WOKBuilder_Entity) result;
+ if(!apath.IsNull())
+ {
+ switch(apath->Extension())
+ {
+ case WOKUtils_CFile: return new WOKBuilder_Compilable(apath);
+ case WOKUtils_HFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_CDLFile: return new WOKBuilder_CDLFile(apath);
+ case WOKUtils_CXXFile: return new WOKBuilder_Compilable(apath);
+ case WOKUtils_HXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_INCFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_IXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_JXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_LXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_GXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_LexFile: return new WOKBuilder_CodeGenFile(apath);
+ case WOKUtils_YaccFile: return new WOKBuilder_CodeGenFile(apath);
+ case WOKUtils_PXXFile: return new WOKBuilder_Include(apath);
+ case WOKUtils_LWSFile: return new WOKBuilder_CodeGenFile(apath);
+ case WOKUtils_F77File: return new WOKBuilder_Compilable(apath);
+ case WOKUtils_PSWFile: return new WOKBuilder_CodeGenFile(apath);
+ case WOKUtils_CSHFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_ObjectFile: return new WOKBuilder_ObjectFile(apath);
+ case WOKUtils_MFile: return new WOKBuilder_MFile(apath);
+ case WOKUtils_CompressedFile: return new WOKBuilder_CompressedFile(apath);
+ case WOKUtils_ArchiveFile: return new WOKBuilder_ArchiveLibrary(apath);
+ case WOKUtils_DSOFile: return new WOKBuilder_SharedLibrary(apath);
+ case WOKUtils_DATFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_LispFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_IconFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_TextFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_TarFile: return new WOKBuilder_TarFile(apath);
+ case WOKUtils_UnknownFile: return new WOKBuilder_Miscellaneous(apath);
+ case WOKUtils_NoExtFile: return new WOKBuilder_Miscellaneous(apath);
+#ifdef WNT
+ case WOKUtils_LIBFile: return new WOKBuilder_StaticLibrary ( apath );
+ case WOKUtils_IMPFile: return new WOKBuilder_ImportLibrary ( apath );
+#endif // WNT
+
+ default: return new WOKBuilder_Miscellaneous(apath);
+ }
+ }
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetInputFromStep
+//purpose :
+//=======================================================================
+void WOKMake_Step::GetInputFromStep(const Handle(WOKMake_Step)& astep)
+{
+ Standard_Integer j;
+ Handle(WOKMake_HSequenceOfOutputFile) out = astep->OutputFileList();
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MAKE") << "WOKMake_Step::GetInputFromStep"
+ << "Compute Input Flow from step: " << astep->Unit()->Name() << ":" << astep->Code() << endm;
+ }
+
+ if(out.IsNull())
+ {
+ ErrorMsg << "WOKMake_Step::GetInputFromStep"
+ << "Output file list of step (" << astep->Code() << ") is not available" << endm;
+ ErrorMsg << "WOKMake_Step::GetInputFromStep"
+ << "Please perform this step before using step : " << Code() << endm;
+ SetFailed();
+ return;
+ }
+
+ for(j=1; j<=out->Length(); j++)
+ {
+ const Handle(WOKMake_OutputFile)& outfile = out->Value(j);
+ Handle(WOKMake_InputFile) infile;
+
+ if(!myinflow.Contains(outfile->ID()))
+ {
+ if(!outfile->IsStepID() && outfile->IsLocateAble())
+ {
+ if(outfile->File().IsNull())
+ {
+ if(!outfile->IsPhysic())
+ {
+ Handle(TCollection_HAsciiString) type = outfile->ID()->Token(":", 2);
+ if(!strcmp("msentity", type->ToCString()))
+ {
+ Handle(TCollection_HAsciiString) name = outfile->ID()->Token(":", 3);
+ Handle(WOKernel_DevUnit) aunit = OutLocator()->LocateDevUnit(outfile->ID()->Token(":", 1));
+
+ if(aunit.IsNull())
+ {
+ WarningMsg << "WOKMake_Step::GetInputFromStep"
+ << "Skipping msentity " << name << " : unit "
+ << outfile->ID()->Token(":", 1) << " not found" << endm;
+ }
+ else
+ {
+ infile = new WOKMake_InputFile(outfile->ID(), Handle(WOKernel_File)(),
+ Handle(WOKBuilder_Entity)(), outfile->LastPath());
+ infile->SetLocateFlag(Standard_True);
+ infile->SetDirectFlag(Standard_True);
+ infile->SetPhysicFlag(Standard_False);
+ }
+ }
+ else
+ {
+ infile = new WOKMake_InputFile(outfile);
+ infile->SetDirectFlag(Standard_True);
+ }
+ }
+ else
+ {
+ WarningMsg << "WOKMake_Step::GetInputFromStep"
+ << "Skipping file " << outfile->LastPath()->Name() << " : not found" << endm;
+ }
+ }
+ else
+ {
+ infile = new WOKMake_InputFile(outfile);
+ infile->SetDirectFlag(Standard_True);
+ }
+ }
+ else if(outfile->IsStepID())
+ {
+ Handle(WOKMake_MetaStep) meta = Handle(WOKMake_MetaStep)::DownCast(this);
+
+ if(!meta.IsNull())
+ {
+ // In MetaSteps keep identical
+ infile = new WOKMake_InputFile(outfile);
+ infile->SetPhysicFlag(Standard_False);
+ infile->SetDirectFlag(Standard_True);
+ }
+ else
+ {
+ // in other ones expand underlying steps output
+ Handle(WOKMake_Step) ustep = myprocess->Find(outfile->ID());
+ if(!ustep.IsNull())
+ {
+ GetInputFromStep(ustep);
+ }
+ }
+ }
+ if(!outfile->IsLocateAble())
+ {
+ infile = new WOKMake_InputFile(outfile);
+ infile->SetDirectFlag(Standard_True);
+ }
+ }
+
+ if(!infile.IsNull())
+ {
+ if(HandleInputFile(infile))
+ {
+ myinflow.Add(infile->ID(), infile);
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : GetInputFlow
+//purpose :
+//=======================================================================
+void WOKMake_Step::GetInputFlow()
+{
+ if(myinputcomp) return;
+
+ Standard_Integer i;
+ Handle(TColStd_HSequenceOfHAsciiString) steps = PrecedenceSteps();
+
+ WOK_TRACE {
+ VerboseMsg("WOK_MAKE") << "WOKMake_Step::GetInputFlow"
+ << "Computing Input Flow" << endm;
+ }
+
+ if(steps.IsNull()) return;
+
+ for(i=1; i<=steps->Length(); i++)
+ {
+ GetInputFromStep(myprocess->Find(steps->Value(i)));
+ if(CheckStatus("WOKMake_Step::GetInputFlow")) return;
+ }
+
+ myinputcomp = Standard_True;
+ return;
+}
+
+//=======================================================================
+//function : InputFileList
+//purpose :
+//=======================================================================
+const Handle(WOKMake_HSequenceOfInputFile)& WOKMake_Step::InputFileList()
+{
+ if(!myinput.IsNull()) return myinput;
+
+ GetInputFlow();
+
+ myinput = new WOKMake_HSequenceOfInputFile;
+
+ for(Standard_Integer i=1; i<=myinflow.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& afile = myinflow(i);
+
+ if(afile->IsDirectInput())
+ {
+ switch(afile->Status())
+ {
+ case WOKMake_Undetermined:
+ case WOKMake_New:
+ case WOKMake_Same:
+ case WOKMake_Moved:
+ myinput->Append(afile);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return myinput;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : LoadDependencies
+//purpose :
+//=======================================================================
+void WOKMake_Step::LoadDependencies()
+{
+ if(mydeploaded) return;
+
+ Standard_Integer i;
+
+ Handle(WOKernel_File) inputfile = LocateAdmFile(InLocator(), InputFilesFileName());
+ if(inputfile.IsNull()) return;
+
+ Handle(WOKernel_File) outputfile = LocateAdmFile(OutLocator(), OutputFilesFileName());
+ if(outputfile.IsNull()) return;
+
+ Handle(WOKernel_File) depfile = LocateAdmFile(InLocator(), DepItemsFileName());
+ if(depfile.IsNull()) return;
+
+ WOKMake_InputFile::ReadFile(inputfile->Path(), InLocator(), mydepin);
+ WOKMake_OutputFile::ReadFile(outputfile->Path(), OutLocator(), mydepout);
+ WOKMake_DepItem::ReadFile(depfile->Path(), mydepitems);
+
+
+ if(mydepout.Extent() && mydepin.Extent())
+ {
+ mydepmatrix = new TColStd_HArray2OfInteger(1, mydepout.Extent(), 1, mydepin.Extent(), 0);
+
+ for(i=1; i<=mydepitems.Extent(); i++)
+ {
+ const Handle(WOKMake_DepItem)& anitem = mydepitems(i);
+ Standard_Integer in_index, out_index;
+
+ if(!mydepin.Contains(anitem->IssuedFrom()))
+ {
+ ErrorMsg << "WOKMake_Step::LoadDependencies"
+ << "Unknown origin : " << anitem->IssuedFrom() << endm;
+ ErrorMsg << "WOKMake_Step::LoadDependencies"
+ << "Dependences could not be loaded : will force step" << endm;
+ mydepmatrix.Nullify();
+ mydepitems.Clear();
+ mydepin.Clear();
+ mydepout.Clear();
+ return;
+ //Standard_ProgramError::Raise("WOKMake_Step::LoadDependencies : Unknown origin");
+ }
+ else
+ in_index = mydepin.FindIndex(anitem->IssuedFrom());
+
+ if(!mydepout.Contains(anitem->OutputFile()))
+ {
+ ErrorMsg << "WOKMake_Step::LoadDependencies"
+ << "Unknown output : " << anitem->OutputFile() << endm;
+ ErrorMsg << "WOKMake_Step::LoadDependencies"
+ << "Dependences could not be loaded : will force step" << endm;
+ mydepmatrix.Nullify();
+ mydepitems.Clear();
+ mydepin.Clear();
+ mydepout.Clear();
+ mydeploaded = Standard_True;
+ return;
+ //Standard_ProgramError::Raise("WOKMake_Step::LoadDependencies : Unknown output");
+ }
+ else
+ out_index = mydepout.FindIndex(anitem->OutputFile());
+
+ if(mydepmatrix->Value(out_index, in_index))
+ {
+ WarningMsg << "WOKMake_Step::LoadDependencies"
+ << "Ignoring duplicate line in depfile (" << anitem->OutputFile() << " : " << anitem->IssuedFrom() << ")" << endm;
+ }
+ else
+ {
+ mydepmatrix->SetValue(out_index, in_index, i);
+ }
+ }
+ }
+ mydeploaded = Standard_True;
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : StepFileStatus
+//purpose :
+//=======================================================================
+WOKMake_FileStatus WOKMake_Step::StepFileStatus(const Handle(WOKMake_StepFile)& afile, const Handle(WOKernel_Locator)& alocator)
+{
+ if(afile->IsLocateAble() && afile->IsPhysic())
+ {
+ Handle(WOKernel_File) current = alocator->Locate(afile->ID());
+
+ if(current.IsNull())
+ {
+ afile->SetStatus(WOKMake_Disappeared);
+ return WOKMake_Disappeared;
+ }
+ else
+ {
+ if(!current->Path()->Name()->IsSameString(afile->LastPath()->Name()))
+ {
+ afile->SetStatus(WOKMake_Moved);
+ return WOKMake_Moved;
+ }
+ }
+ }
+ else if(afile->IsPhysic())
+ {
+ if(!afile->LastPath()->Exists())
+ {
+ afile->SetStatus(WOKMake_Disappeared);
+ return WOKMake_Disappeared;
+ }
+ }
+
+ afile->SetStatus(WOKMake_Undetermined);
+ return WOKMake_Undetermined;
+}
+
+//=======================================================================
+//function : OutOfDateEntities
+//purpose :
+//=======================================================================
+Handle(WOKMake_HSequenceOfInputFile) WOKMake_Step::OutOfDateEntities()
+{
+ LoadDependencies();
+
+ Handle(WOKMake_HSequenceOfInputFile) result = new WOKMake_HSequenceOfInputFile;
+ Handle(WOKMake_InputFile) infile;
+ Handle(WOKMake_OutputFile) outfile;
+ WOKTools_MapOfHAsciiString amap;
+ Standard_Integer i,j, value;
+
+
+ if(mydepmatrix.IsNull())
+ {
+ return ForceBuild();
+ }
+
+
+ for(i=1; i<=mydepin.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = mydepin(i);
+
+ if(infile->IsDirectInput())
+ {
+ if(!myinflow.Contains(infile->ID()))
+ {
+ infile->SetStatus(WOKMake_Disappeared);
+ }
+ else
+ StepFileStatus(infile, InLocator());
+ }
+ else
+ StepFileStatus(infile, InLocator());
+
+ switch(infile->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Moved:
+ if(myinflow.Contains(infile->ID()))
+ {
+ const Handle(WOKMake_InputFile)& inflowfile = myinflow.FindFromKey(infile->ID());
+ amap.Add(inflowfile->ID());
+ result->Append(inflowfile);
+ }
+ break;
+ case WOKMake_Disappeared:
+ if(myinflow.Contains(infile->ID()))
+ {
+ ErrorMsg << "WOKMake_Step::OutOfDateEntities"
+ << "Could not locate input file : " << infile->ID() << endm;
+ SetFailed();
+ return result;
+ }
+ break;
+ case WOKMake_Same:
+ case WOKMake_Undetermined:
+ break;
+ }
+ }
+
+ for(i=1; i<=myinflow.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = myinflow(i);
+ if(!mydepin.Contains(infile->ID()))
+ {
+ if(amap.Add(infile->ID()))
+ result->Append(infile);
+ }
+ }
+
+ for(i=mydepmatrix->LowerRow(); i<=mydepmatrix->UpperRow(); i++)
+ {
+ Standard_Boolean outofdate = Standard_False;
+ Standard_Boolean founddirectdep = Standard_False;
+ Handle(WOKMake_InputFile) adirect;
+
+ const Handle(WOKMake_OutputFile)& outfile = mydepout(i);
+
+ switch(StepFileStatus(outfile, OutLocator()))
+ {
+ case WOKMake_New:
+ outofdate = Standard_True;
+ break;
+ case WOKMake_Disappeared:
+ outofdate = Standard_True;
+ break;
+ case WOKMake_Moved:
+ case WOKMake_Same:
+ case WOKMake_Undetermined:
+ break;
+ }
+
+
+ for(j=mydepmatrix->LowerCol(); j<=mydepmatrix->UpperCol() && !outofdate ; j++)
+ {
+ value = mydepmatrix->Value(i,j);
+
+ if(value)
+ {
+ const Handle(WOKMake_InputFile)& infile = mydepin(j);
+ switch(infile->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Moved:
+ outofdate = Standard_True;
+ break;
+ case WOKMake_Disappeared:
+ outofdate = Standard_True;
+ break;
+ case WOKMake_Same:
+ case WOKMake_Undetermined:
+ if(infile->IsPhysic())
+ {
+ if(infile->LastPath()->IsNewer(outfile->LastPath()))
+ outofdate = Standard_True;
+ }
+ else
+ {
+ if (infile->IsStepID())
+ outofdate = Standard_True;
+ else
+ outofdate = Standard_False;
+ }
+ break;
+ }
+ if(outofdate)
+ {
+ const Handle(WOKMake_DepItem)& anitem = mydepitems(value);
+ if(anitem->IsDirectDep())
+ if(myinflow.Contains(anitem->IssuedFrom()))
+ {
+ if(amap.Add(anitem->IssuedFrom()))
+ result->Append(myinflow.FindFromKey(anitem->IssuedFrom()));
+ founddirectdep = Standard_True;
+ }
+
+ }
+ }
+ }
+
+ if(outofdate && (! founddirectdep))
+ {
+ // rechercher une dep directe valide
+ for(j=mydepmatrix->LowerCol(); j<=mydepmatrix->UpperCol() && !founddirectdep ; j++)
+ {
+ value = mydepmatrix->Value(i,j);
+ if(value)
+ {
+ const Handle(WOKMake_DepItem)& anitem = mydepitems(value);
+ if(anitem->IsDirectDep())
+ {
+ outofdate = Standard_True;
+ founddirectdep = Standard_True;
+ if(myinflow.Contains(anitem->IssuedFrom()))
+ if(amap.Add(anitem->IssuedFrom()))
+ result->Append(myinflow.FindFromKey(anitem->IssuedFrom()));
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+//=======================================================================
+//function : HandleTargets
+//purpose :
+//=======================================================================
+Handle(WOKMake_HSequenceOfInputFile) WOKMake_Step::HandleTargets()
+{
+ Standard_Integer i;
+ Handle(TColStd_HSequenceOfHAsciiString) targets = Targets();
+ Handle(WOKMake_HSequenceOfInputFile) result = new WOKMake_HSequenceOfInputFile;
+ Handle(WOKMake_InputFile) infile;
+ WOKTools_MapOfHAsciiString amap;
+
+ for(i=1; i<=targets->Length(); i++)
+ {
+ if(!amap.Contains(targets->Value(i)))
+ {
+ amap.Add(targets->Value(i));
+ }
+ }
+
+ for(i=1; i<=myinflow.Extent(); i++)
+ {
+ infile = myinflow(i);
+ if (infile->IsLocateAble())
+ {
+ Handle(TCollection_HAsciiString) astr = infile->ID()->Token(":", 3);
+ if(!astr.IsNull())
+ {
+ if(amap.Contains(astr))
+ {
+ result->Append(infile);
+ }
+ }
+ }
+ else
+ {
+ if (!infile->LastPath().IsNull())
+ {
+ if(amap.Contains(infile->LastPath()->FileName()))
+ {
+ result->Append(infile);
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+//=======================================================================
+//function : ForceBuild
+//purpose :
+//=======================================================================
+Handle(WOKMake_HSequenceOfInputFile) WOKMake_Step::ForceBuild()
+{
+ Standard_Integer i;
+ Handle(WOKMake_HSequenceOfInputFile) result = new WOKMake_HSequenceOfInputFile;
+ Handle(WOKMake_InputFile) infile;
+
+ for(i=1; i<=myinflow.Extent(); i++)
+ {
+ result->Append(myinflow(i));
+ }
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CompleteExecList
+//purpose :
+//=======================================================================
+void WOKMake_Step::CompleteExecList(const Handle(WOKMake_HSequenceOfInputFile)& alist)
+{
+ Standard_Integer i;
+ Handle(WOKMake_InputFile) infile;
+ WOKTools_MapOfHAsciiString inmap;
+
+
+ for(i=1; i<=alist->Length(); i++)
+ {
+ inmap.Add(alist->Value(i)->ID());
+ }
+
+ LoadDependencies();
+
+ if(!mydepmatrix.IsNull())
+ {
+ for(i=1; i<=myinflow.Extent(); i++)
+ {
+ infile = myinflow(i);
+
+ if(mydepin.Contains(infile->ID()))
+ {
+ // Regarder s'il existe d'autres entrees directes
+ Standard_Integer in_index = mydepin.FindIndex(infile->ID());
+ Standard_Integer j, k;
+ Standard_Boolean generatedoutput = Standard_False;
+
+ for(j=mydepmatrix->LowerRow(); j<=mydepmatrix->UpperRow(); j++)
+ {
+ const Standard_Integer value = mydepmatrix->Value(j,in_index);
+
+ if(value)
+ {
+ const Handle(WOKMake_DepItem)& item = mydepitems(value);
+ if(item->IsDirectDep() && inmap.Contains(item->IssuedFrom()))
+ {
+ for(k=mydepmatrix->LowerCol(); k<=mydepmatrix->UpperCol(); k++)
+ {
+ const Standard_Integer value = mydepmatrix->Value(j,k);
+ if(value)
+ {
+ const Handle(WOKMake_DepItem)& item = mydepitems(value);
+ if(myinflow.Contains(item->IssuedFrom()))
+ {
+ const Handle(WOKMake_InputFile)& infile = myinflow.FindFromKey(item->IssuedFrom());
+
+
+ if(item->IsDirectDep())
+ {
+ if(!inmap.Contains(item->IssuedFrom()))
+ {
+ inmap.Add(infile->ID());
+ alist->Append(infile);
+ }
+ }
+ }
+ }
+ }
+ }
+ generatedoutput=Standard_True;
+ }
+ }
+
+ if(!generatedoutput && infile->IsDirectInput())
+ {
+ if(!inmap.Contains(infile->ID()) )
+ {
+ inmap.Add(infile->ID());
+ alist->Append(infile);
+ }
+ }
+ }
+ }
+ }
+ return;
+}
+
+
+//=======================================================================
+//function : ExecutionInputList
+//purpose :
+//=======================================================================
+Handle(WOKMake_HSequenceOfInputFile) WOKMake_Step::ExecutionInputList()
+{
+
+ Handle(WOKMake_HSequenceOfInputFile) result;
+
+ if(IsChecked() && !mytargets.IsNull() && !IsKind(STANDARD_TYPE(WOKMake_MetaStep))) return ForceBuild();
+
+ if(!mytargets.IsNull() && SubCode().IsNull())
+ {
+ result = HandleTargets();
+ }
+ else
+ {
+ if (IsChecked()) return ForceBuild();
+ else
+ result = new WOKMake_HSequenceOfInputFile;
+ }
+
+ if(!result->Length())
+ {
+ if(!myoptions.IsNull())
+ {
+ Standard_Integer i;
+ for(i=1; i<=myoptions->Length(); i++)
+ {
+ if(myoptions->Value(i) == WOKMake_Force)
+ return ForceBuild();
+ }
+ }
+ result = OutOfDateEntities();
+ }
+
+ CompleteExecList(result);
+ return result;
+}
+
+
+//=======================================================================
+//function : CheckStatus
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::CheckStatus(const Standard_CString amsg) const
+{
+ switch(Status())
+ {
+ case WOKMake_Uptodate:
+ case WOKMake_Success:
+ case WOKMake_Unprocessed:
+ case WOKMake_Incomplete:
+ case WOKMake_Processed:
+ break;
+ case WOKMake_Failed:
+ ErrorMsg << "WOKMake_Step::Make" << "Failed during " << amsg << endm;
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AddExecDepItem
+//purpose :
+//=======================================================================
+void WOKMake_Step::AddExecDepItem(const Handle(WOKMake_InputFile)& infile,
+ const Handle(WOKMake_OutputFile)& outfile,
+ const Standard_Boolean adirectflag)
+{
+ if(infile.IsNull() || outfile.IsNull())
+ Standard_ProgramError::Raise("WOKMake_Step::AddExecDepItem : Null Input");
+
+ myinflow.Add(infile->ID(), infile);
+ myoutflow.Add(outfile->ID(), outfile);
+
+ Handle(WOKMake_DepItem) item = new WOKMake_DepItem(outfile->ID(), infile->ID());
+ if(adirectflag) item->SetDirect();
+ else item->SetIndirect();
+
+ myitems.Add(item);
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AcquitExecution
+//purpose :
+//=======================================================================
+void WOKMake_Step::AcquitExecution(const Handle(WOKMake_HSequenceOfInputFile)& execlist)
+{
+ WOKMake_IndexedDataMapOfHAsciiStringOfInputFile inmap;
+ WOKMake_IndexedDataMapOfHAsciiStringOfOutputFile outmap;
+ WOKMake_IndexedMapOfDepItem items;
+ Handle(WOKMake_InputFile) infile;
+ Handle(WOKMake_OutputFile) outfile;
+ Handle(WOKMake_DepItem) item;
+ Standard_Integer i, j, index;
+
+ LoadDependencies();
+
+ if(!PrecedenceSteps().IsNull())
+ {
+ Handle(WOKernel_File) outs[3];
+
+ outs[0] = new WOKernel_File(InputFilesFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+ outs[1] = new WOKernel_File(OutputFilesFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+ outs[2] = new WOKernel_File(DepItemsFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+
+ for(i=0; i<3; i++)
+ {
+ outs[i]->GetPath();
+ Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(outs[i]->LocatorName(), outs[i], Handle(WOKBuilder_Entity)(), outs[i]->Path());
+
+ outfile->SetLocateFlag(Standard_True);
+ outfile->SetProduction();
+
+ for(j=1; j<=PrecedenceSteps()->Length(); j++)
+ {
+ const Handle(WOKMake_Step)& precstep = BuildProcess()->Find(PrecedenceSteps()->Value(j));
+
+ Handle(WOKernel_File) afile = precstep->LocateAdmFile(precstep->OutLocator(), precstep->OutputFilesFileName());
+
+ if(afile.IsNull())
+ {
+ WarningMsg << "WOKMake_Step::AcquitExecution"
+ << "Could not find precedence step (" << precstep->UniqueName()
+ << ") admin file : " << precstep->OutputFilesFileName() << endm;
+ }
+ else
+ {
+ Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(afile->LocatorName(), afile, Handle(WOKBuilder_Entity)(), afile->Path());
+ infile->SetLocateFlag(Standard_True);
+ infile->SetDirectFlag(Standard_False);
+
+ AddExecDepItem(infile, outfile, Standard_True);
+ }
+ }
+ }
+ }
+ else
+ {
+ Handle(WOKernel_File) outs[3];
+
+ outs[0] = new WOKernel_File(InputFilesFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+ outs[1] = new WOKernel_File(OutputFilesFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+ outs[2] = new WOKernel_File(DepItemsFileName(), Unit(), Unit()->GetFileType(AdmFileType()));
+
+
+ for(i=0; i<3; i++)
+ {
+ outs[i]->GetPath();
+ Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(outs[i]->LocatorName(), outs[i], Handle(WOKBuilder_Entity)(), outs[i]->Path());
+ outfile->SetLocateFlag(Standard_True);
+ outfile->SetProduction();
+
+
+ Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(outs[i]->LocatorName(), outs[i], Handle(WOKBuilder_Entity)(), outs[i]->Path());
+ infile->SetLocateFlag(Standard_True);
+ infile->SetDirectFlag(Standard_False);
+
+ AddExecDepItem(infile, outfile, Standard_True);
+ }
+ }
+
+ // Chargement de la map d'execution
+ WOKTools_MapOfHAsciiString execmap;
+
+ for(i=1; i<=execlist->Length(); i++)
+ {
+ execmap.Add(execlist->Value(i)->ID());
+ }
+
+ // BILAN INPUT
+ for(i=1; i<= mydepin.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = mydepin(i);
+ infile->SetStatus(WOKMake_Disappeared);
+ inmap.Add(infile->ID(), infile);
+ }
+
+ for(i=1; i<= myinflow.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = myinflow(i);
+
+ index = inmap.FindIndex(infile->ID());
+
+ if(index)
+ {
+ const Handle(WOKMake_InputFile)& oldfile = inmap(index);
+
+ inmap(index) = infile;
+
+ if(infile->IsPhysic())
+ {
+ if(infile->LastPath()->Name()->IsSameString(oldfile->LastPath()->Name()))
+ infile->SetStatus(WOKMake_Same);
+ else
+ infile->SetStatus(WOKMake_Moved);
+ }
+ else
+ infile->SetStatus(WOKMake_Same);
+ }
+ else
+ {
+ inmap.Add(infile->ID(), infile);
+ infile->SetStatus(WOKMake_New);
+ }
+ }
+ myinflow.Clear();
+
+ // BILAN OUTPUT
+
+ for(i=1; i<= mydepout.Extent(); i++)
+ {
+ const Handle(WOKMake_OutputFile)& outfile = mydepout(i);
+ outfile->SetStatus(WOKMake_Disappeared);
+ outmap.Add(outfile->ID(), outfile);
+ }
+
+ for(i=1; i<= myoutflow.Extent(); i++)
+ {
+ const Handle(WOKMake_OutputFile)& outfile = myoutflow(i);
+
+ index = outmap.FindIndex(outfile->ID());
+
+ if(index)
+ {
+ const Handle(WOKMake_OutputFile)& oldfile = outmap(index);
+
+ outmap(index) = outfile;
+
+ if(outfile->IsPhysic())
+ {
+ if(outfile->LastPath()->Name()->IsSameString(oldfile->LastPath()->Name()))
+ outfile->SetStatus(WOKMake_Same);
+ else
+ outfile->SetStatus(WOKMake_Moved);
+ }
+ else
+ outfile->SetStatus(WOKMake_Same);
+ }
+ else
+ {
+ outmap.Add(outfile->ID(), outfile);
+ outfile->SetStatus(WOKMake_New);
+ }
+ }
+ myoutflow.Clear();
+
+
+ // BILAN MATRIX/ITEMS
+ Handle(TCollection_HAsciiString) inid, outid;
+ Handle(TColStd_HArray2OfInteger) matrix;
+
+ Standard_Integer in_index, out_index;
+ Standard_Integer depvalue, value;
+
+ if(outmap.Extent() && inmap.Extent())
+ {
+ matrix = new TColStd_HArray2OfInteger(1, outmap.Extent(), 1, inmap.Extent(), 0);
+
+ if(myitems.Extent())
+ {
+ for(i=1; i<=myitems.Extent(); i++)
+ {
+ item = myitems(i);
+ out_index = outmap.FindIndex(item->OutputFile());
+ in_index = inmap.FindIndex(item->IssuedFrom());
+ items.Add(item);
+ matrix->SetValue(out_index, in_index, items.Extent());
+ item->SetStatus(WOKMake_New);
+ }
+ }
+
+
+ if(!mydepmatrix.IsNull())
+ {
+ Standard_Integer* idxtab = new Standard_Integer[mydepmatrix->UpperCol()+1];
+
+ for (j = mydepmatrix->LowerCol(); j <= mydepmatrix->UpperCol(); j++)
+ {
+ idxtab[j] = inmap.FindIndex(mydepin.FindKey(j));
+ }
+
+ for (i = mydepmatrix->LowerRow(); i <= mydepmatrix->UpperRow(); i++)
+ {
+ Standard_Boolean stillproduced = Standard_False;
+ Standard_Boolean stillforexec = Standard_False;
+ out_index = outmap.FindIndex(mydepout.FindKey(i));
+
+ const Handle(WOKMake_OutputFile)& outfile = outmap(out_index);
+
+ for (j = mydepmatrix->LowerCol(); j <= mydepmatrix->UpperCol(); j++)
+ {
+ //in_index = inmap.FindIndex(mydepin.FindKey(j));
+ in_index = idxtab[j];
+
+ const Handle(WOKMake_InputFile)& infile = inmap(in_index);
+
+ depvalue = mydepmatrix->Value(i,j);
+ value = matrix->Value(out_index, in_index);
+
+
+ if(!stillproduced)
+ {
+ if(depvalue)
+ {
+ const Handle(WOKMake_DepItem)& depitem = mydepitems(depvalue);
+ Standard_Boolean isinexec = execmap.Contains(depitem->IssuedFrom());
+
+ if( depitem->IsDirectDep() && infile->Status() != WOKMake_Disappeared)
+ {
+ if( value )
+ {
+ stillproduced = Standard_True;
+ stillforexec = Standard_True;
+ }
+ else if (depvalue && !isinexec )
+ {
+ stillproduced = Standard_True;
+ }
+ }
+ }
+ else if(value)
+ {
+ const Handle(WOKMake_DepItem)& item = items(value);
+ //Standard_Boolean isinexec = execmap.Contains(item->IssuedFrom());
+
+ if(!stillproduced && item->IsDirectDep())
+ {
+ stillproduced = Standard_True;
+ stillforexec = Standard_True;
+ }
+ }
+
+ if(stillproduced)
+ {
+ // Here I shoul roll back
+ }
+ }
+
+ if(depvalue && value)
+ {
+ // A LA FOIS AVANT et APRES
+ const Handle(WOKMake_DepItem)& item = items(value);
+ item->SetStatus(WOKMake_Same);
+ }
+ else if(depvalue)
+ {
+
+ // Dans les dependances seulement, on l'ajoute.
+ const Handle(WOKMake_DepItem)& depitem = mydepitems(depvalue);
+ items.Add(depitem);
+ depitem->SetStatus(WOKMake_Disappeared);
+ matrix->SetValue(out_index, in_index, items.Extent());
+
+ Standard_Boolean isinexec = execmap.Contains(depitem->IssuedFrom());
+
+ if(!isinexec)
+ {
+ if(infile->Status() != WOKMake_Disappeared)
+ {
+ depitem->SetStatus(WOKMake_Same);
+ }
+ }
+
+ if(stillproduced && !stillforexec )
+ {
+ if(!depitem->IsDirectDep())
+ {
+ infile->SetStatus(WOKMake_Same);
+ depitem->SetStatus(WOKMake_Same);
+ }
+ }
+ }
+ else if(value)
+ {
+ const Handle(WOKMake_DepItem)& item = items(value);
+ item->SetStatus(WOKMake_New);
+ }
+ }
+
+ if(stillproduced)
+ {
+ const Handle(WOKMake_OutputFile)& depoutfile = mydepout(i);
+ const Handle(WOKMake_OutputFile)& outfile = outmap(out_index);
+ if(depoutfile->IsPhysic())
+ {
+ if(depoutfile->LastPath()->Name()->IsSameString(outmap(out_index)->LastPath()->Name()))
+ outfile->SetStatus(WOKMake_Same);
+ else
+ outfile->SetStatus(WOKMake_Moved);
+ }
+ else
+ {
+ outfile->SetStatus(WOKMake_Same);
+ }
+ }
+ else
+ {
+ outmap(out_index)->SetStatus(WOKMake_Disappeared);
+ }
+ }
+ delete [] idxtab;
+ }
+ }
+
+ mydepmatrix.Nullify();
+ mydepin.Clear();
+ mydepout.Clear();
+
+ // BILAN ITEMS
+ myinflow.Clear();
+ myoutflow.Clear();
+ myitems.Clear();
+
+ if(!matrix.IsNull())
+ {
+ for (i = matrix->LowerRow(); i <= matrix->UpperRow(); i++)
+ {
+ if (outmap(i)->Status() != WOKMake_Disappeared) {
+ for (j = matrix->LowerCol(); j <= matrix->UpperCol(); j++)
+ {
+ value = matrix->Value(i,j);
+ if(value)
+ {
+ const Handle(WOKMake_DepItem)& item = items(value);
+ if((item->Status() == WOKMake_Same) || (item->Status() == WOKMake_New) )
+ {
+ myitems.Add(items(value));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for(i=1; i<=inmap.Extent(); i++)
+ {
+ const Handle(WOKMake_InputFile)& infile = inmap(i);
+
+ switch(inmap(i)->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Moved:
+ if(mystatus == WOKMake_Uptodate) mystatus = WOKMake_Processed;
+ case WOKMake_Same:
+ {
+ const Handle(WOKernel_File)& file = infile->File();
+ if(!file.IsNull())
+ {
+ const Handle(WOKUtils_Path)& path = file->Path();
+ if(!path.IsNull()) infile->SetLastPath(path);
+ }
+ myinflow.Add(infile->ID(), infile);
+ }
+ break;
+ case WOKMake_Undetermined:
+ case WOKMake_Disappeared:
+ if(mystatus == WOKMake_Uptodate) mystatus = WOKMake_Processed;
+ break;
+ }
+ }
+
+ myoutput = new WOKMake_HSequenceOfOutputFile;
+
+ for(i=1; i<=outmap.Extent(); i++)
+ {
+ const Handle(WOKMake_OutputFile)& outfile = outmap(i);
+
+ switch(outmap(i)->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Moved:
+ if(mystatus == WOKMake_Uptodate) mystatus = WOKMake_Processed;
+ case WOKMake_Same:
+ {
+ const Handle(WOKernel_File)& file = outfile->File();
+ if(!file.IsNull())
+ {
+ const Handle(WOKUtils_Path)& path = file->Path();
+ if(!path.IsNull()) outfile->SetLastPath(path);
+ }
+ myoutput->Append(outfile);
+ myoutflow.Add(outfile->ID(), outfile);
+ HandleOutputFile(outfile);
+ if(outfile->IsLocateAble() && outfile->IsPhysic())
+ {
+ if (!outfile->File().IsNull()) {
+ OutLocator()->ChangeAdd(outfile->File());
+ }
+ }
+ }
+ break;
+ case WOKMake_Undetermined:
+ case WOKMake_Disappeared:
+ HandleOutputFile(outfile);
+ if(mystatus == WOKMake_Uptodate) mystatus = WOKMake_Processed;
+ break;
+ }
+ }
+
+// if(mystatus != WOKMake_Uptodate)
+ {
+ Handle(WOKernel_File) infile = AdmFile(InputFilesFileName());
+
+ if(mystatus != WOKMake_Uptodate || !infile->Path()->Exists())
+ {
+ WOKMake_InputFile::WriteFile(infile->Path(), myinflow);
+ InLocator()->ChangeAdd(infile);
+ }
+
+ Handle(WOKernel_File) outfile = AdmFile(OutputFilesFileName());
+
+ if(mystatus != WOKMake_Uptodate || !outfile->Path()->Exists())
+ {
+ WOKMake_OutputFile::WriteFile(outfile->Path(), myoutflow);
+ OutLocator()->ChangeAdd(outfile);
+ }
+
+ Handle(WOKernel_File) items = AdmFile(DepItemsFileName());
+
+ if(mystatus != WOKMake_Uptodate || !items->Path()->Exists())
+ {
+ WOKMake_DepItem::WriteFile(items->Path(), myitems);
+ InLocator()->ChangeAdd(items);
+ }
+ }
+
+ myinflow.Clear();
+ myoutflow.Clear();
+ myitems.Clear();
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKMake_Step::Init()
+{
+
+}
+
+//=======================================================================
+//function : Make
+//purpose :
+//=======================================================================
+WOKMake_Status WOKMake_Step::Make()
+{
+
+ Init();
+
+ if(CheckStatus("perform init of step")) {Terminate(); return Status();}
+
+ if(IsToExecute())
+ {
+ Handle(WOKMake_HSequenceOfInputFile) execlist;
+
+ GetInputFlow();
+
+ if(CheckStatus("getting input list")) {Terminate(); return Status();}
+
+ execlist = ExecutionInputList();
+
+ if(CheckStatus("determine exec list")) {Terminate(); return Status();}
+
+ if(execlist->Length() || IsChecked())
+ {
+ Execute(execlist);
+
+ if(CheckStatus("execution")) {Terminate(); return Status();}
+ }
+ else
+ {
+ SetUptodate();
+ }
+
+ AcquitExecution(execlist);
+
+ if(CheckStatus("acquit execution")) {Terminate(); return Status();}
+ }
+
+ Standard_Boolean process = Standard_False;
+
+ if(!IsToExecute())
+ {
+ if(!PrecedenceSteps().IsNull())
+ {
+ for(Standard_Integer k=1; k<=PrecedenceSteps()->Length() && !process ; k++)
+ {
+ const Handle(WOKMake_Step)& astep = BuildProcess()->Find(PrecedenceSteps()->Value(k));
+
+ if(!astep.IsNull())
+ {
+ switch(astep->Status())
+ {
+ case WOKMake_Unprocessed:
+ case WOKMake_Uptodate:
+ case WOKMake_Failed:
+ break;
+ default:
+ process = Standard_True;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ process = Standard_False;
+ }
+ }
+ else
+ {
+ switch(Status())
+ {
+ case WOKMake_Uptodate:
+ case WOKMake_Unprocessed:
+ break;
+ default:
+ process = Standard_True;
+ }
+ }
+
+ if(process)
+ {
+ if(mystatus == WOKMake_Unprocessed) mystatus = WOKMake_Processed;
+ }
+
+ Terminate();
+ return Status();
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Terminate
+//purpose :
+//=======================================================================
+void WOKMake_Step::Terminate()
+{
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutputFileList
+//purpose :
+//=======================================================================
+Handle(WOKMake_HSequenceOfOutputFile) WOKMake_Step::OutputFileList() const
+{
+ Handle(WOKMake_HSequenceOfOutputFile) result;
+
+ if(Locator().IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_Step::OutputFileList Null Locator");
+ }
+
+ if(myoutput.IsNull())
+ {
+ Handle(WOKernel_File) afile;
+
+ afile = LocateAdmFile(OutLocator(), OutputFilesFileName());
+
+ if(afile.IsNull()) return result;
+
+ result = new WOKMake_HSequenceOfOutputFile;
+
+ WOKMake_OutputFile::ReadFile(afile->Path(), OutLocator(), result);
+ }
+ else
+ {
+ result = myoutput;
+ }
+ return result;
+}
+
+//=======================================================================
+//function : HandleOutputFile
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::HandleOutputFile(const Handle(WOKMake_OutputFile)& afile)
+{
+ if(afile.IsNull()) return Standard_False;
+ if(afile->File().IsNull()) return Standard_False;
+
+ if((afile->IsLocateAble() && afile->IsProduction() && afile->IsPhysic()) || afile->IsStepID())
+ {
+ switch(afile->Status())
+ {
+ case WOKMake_New:
+ case WOKMake_Same:
+ case WOKMake_Moved:
+ break;
+ case WOKMake_Disappeared:
+ {
+ Handle(WOKernel_Entity) nesting = Unit()->Session()->GetEntity(afile->File()->Nesting());
+
+ if(nesting->FullName()->IsSameString(Unit()->FullName()))
+ {
+ Handle(WOKUtils_Shell) ashell = Shell();
+ Handle(TCollection_HAsciiString) astr, atempl, acmd;
+
+ if(!ashell->IsLaunched()) ashell->Launch();
+ ashell->Lock();
+
+ astr = new TCollection_HAsciiString("%WOKSteps_Del_");
+ astr->AssignCat(afile->File()->TypeName());
+
+ if(! Unit()->Params().IsSet(astr->ToCString()))
+ {
+ astr = new TCollection_HAsciiString("%WOKSteps_Del_Default");
+ if(Unit()->Params().IsSet(astr->ToCString()))
+ {
+ atempl = Unit()->Params().Eval(astr->ToCString(),Standard_True);
+ }
+ }
+ else
+ {
+ atempl = Unit()->Params().Eval(astr->ToCString(),Standard_True);
+ }
+
+ if(atempl.IsNull())
+ {
+ WarningMsg << "WOKMake_Step::HandleOutputFile"
+ << "Could not determine Del action for type : " << afile->File()->TypeName() << endm;
+ ashell->UnLock();
+ return Standard_False;
+ }
+
+ if(! Unit()->Params().IsSet(atempl->ToCString()))
+ {
+ ErrorMsg << "WOKMake_Step::HandleOutputFile"
+ << "Could not eval Del action (" << atempl << ") for type : " << afile->File()->TypeName() << endm;
+ ashell->UnLock();
+ return Standard_False;
+ }
+
+
+ if(afile->File()->Path()->Exists() || afile->File()->Path()->IsSymLink())
+ {
+ Unit()->Params().Set("%FilePath", afile->File()->Path()->Name()->ToCString());
+
+ acmd = Unit()->Params().Eval(atempl->ToCString(),Standard_True);
+
+ if(!acmd.IsNull())
+ {
+ InfoMsg << "WOKMake_Step::HandleOutputFile"
+ << "Invoking " << atempl << " on " << afile->File()->Path()->Name() << endm;
+
+ ashell->Execute(acmd);
+
+ if(ashell->Status())
+ {
+ Handle(TColStd_HSequenceOfHAsciiString) resseq = ashell->Errors();
+ Standard_Boolean ph = ErrorMsg.PrintHeader();
+
+ ErrorMsg << "WOKMake_Step::HandleOutputFile" << "Errors occured in Shell" << endm;
+ ErrorMsg.DontPrintHeader();
+ for(Standard_Integer i=1; i<= resseq->Length(); i++)
+ {
+ ErrorMsg << "WOKMake_Step::HandleOutputFile" << resseq->Value(i) << endm;
+ }
+ if(ph) ErrorMsg.DoPrintHeader();
+ }
+ OutLocator()->ChangeRemove(afile->File());
+ ashell->ClearOutput();
+ return Standard_True;
+ }
+ }
+ else
+ {
+ if(afile->File()->Path()->IsSymLink())
+ {
+ WarningMsg << "WOKMake_Step::HandleOutputFile"
+ << "Disappeared File (" << afile->File()->UserPathName() << ") does not exists " << endm;
+ }
+ }
+ ashell->UnLock();
+
+ }
+ else
+ {
+ WarningMsg << "WOKMake_Step::HandleOutputFile"
+ << "File " << afile->File()->UserPathName() << " is not in " << Unit()->UserPathName()
+ << " : Disappeared and left untouched" << endm;
+ return Standard_False;
+ }
+ }
+ break;
+ }
+ }
+ return Standard_False;
+}
--- /dev/null
+// File: WOKMake_Step.lxx
+// Created: Mon Dec 4 15:31:20 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+
+
+#include <WOKMake_BuildProcess.hxx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : BuildProcess
+//purpose :
+//=======================================================================
+Handle(WOKMake_BuildProcess) WOKMake_Step::BuildProcess() const
+{
+ return myprocess;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Unit
+//purpose :
+//=======================================================================
+const Handle(WOKernel_DevUnit)& WOKMake_Step::Unit() const
+{
+ return myunit;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Locator
+//purpose :
+//=======================================================================
+const Handle(WOKernel_Locator)& WOKMake_Step::Locator() const
+{
+ return myprocess->Locator();
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Locator
+//purpose :
+//=======================================================================
+const Handle(WOKUtils_Shell)& WOKMake_Step::Shell() const
+{
+ return myprocess->Shell();
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Locator
+//purpose :
+//=======================================================================
+const Handle(WOKernel_UnitGraph)& WOKMake_Step::UnitGraph() const
+{
+ return myprocess->UnitGraph();
+}
+
--- /dev/null
+// File: WOKMake_StepAccessMacro.hxx
+// Created: Thu Jun 27 20:28:11 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKMake_StepAccessMacro_HeaderFile
+#define WOKMake_StepAccessMacro_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+# include <Standard_Macro.hxx>
+#endif
+
+#define DECLARE_STEP(STEPMAME) \
+extern "C" { \
+ Standard_EXPORT Handle(WOKMake_Step) STEPMAME##_(const Handle(WOKMake_BuildProcess)&,const Handle(WOKernel_DevUnit)&, const Handle(TCollection_HAsciiString)&, \
+ Standard_Boolean, Standard_Boolean); \
+} \
+Handle(WOKMake_Step) STEPMAME##_(const Handle(WOKMake_BuildProcess)&aprocess, const Handle(WOKernel_DevUnit)& aunit, const Handle(TCollection_HAsciiString)& acode, \
+ Standard_Boolean checked, Standard_Boolean hidden) \
+{return new STEPMAME(aprocess,aunit,acode,checked,hidden);}
+
+
+#endif
--- /dev/null
+-- File: WOKMake_StepBuilder.cdl
+-- Created: Wed Oct 23 17:00:00 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class StepBuilder from WOKMake
+
+ ---Purpose:
+
+uses
+ BuildProcess from WOKMake,
+ HAsciiString from TCollection,
+ DevUnit from WOKernel,
+ StepConstructPtr from WOKMake,
+ Step from WOKMake,
+ DataMapOfHAsciiStringOfStepBuilder from WOKMake
+
+is
+
+ Create
+ returns StepBuilder from WOKMake;
+
+ Create(aname : HAsciiString from TCollection; aptr : StepConstructPtr from WOKMake)
+ returns StepBuilder from WOKMake;
+
+ Name(me)
+ returns HAsciiString from TCollection;
+
+ Builder(me)
+ returns StepConstructPtr from WOKMake;
+
+ StepBuilders(myclass)
+ ---C++: return &
+ returns DataMapOfHAsciiStringOfStepBuilder from WOKMake;
+
+ Add(me);
+
+ BuildStep(myclass; aprocess : BuildProcess from WOKMake;
+ thename : HAsciiString from TCollection;
+ aunit : DevUnit from WOKernel;
+ acode : HAsciiString from TCollection;
+ checked,hidden : Boolean from Standard)
+ returns Step from WOKMake;
+
+ BuildStep(myclass; aprocess : BuildProcess from WOKMake;
+ aunit : DevUnit from WOKernel;
+ acode : HAsciiString from TCollection;
+ asubcode : HAsciiString from TCollection)
+ ---Warning: This entry point does not set precedence steps
+ returns Step from WOKMake;
+
+fields
+
+ myname : HAsciiString from TCollection;
+ myptr : StepConstructPtr from WOKMake;
+
+end StepBuilder;
--- /dev/null
+// File: WOKMake_StepBuilder.cxx
+// Created: Wed Oct 23 17:37:55 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#include <Standard_ProgramError.hxx>
+
+#include <OSD_SharedLibrary.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <WOKMake_MetaStep.hxx>
+#include <WOKMake_TriggerStep.hxx>
+#include <WOKMake_StepBuilder.ixx>
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_StepBuilder
+//purpose :
+//=======================================================================
+WOKMake_StepBuilder::WOKMake_StepBuilder()
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_StepBuilder
+//purpose :
+//=======================================================================
+WOKMake_StepBuilder::WOKMake_StepBuilder(const Handle(TCollection_HAsciiString)& aname, const WOKMake_StepConstructPtr& aptr)
+ : myname(aname), myptr(aptr)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Name
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_StepBuilder::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Builder
+//purpose :
+//=======================================================================
+WOKMake_StepConstructPtr WOKMake_StepBuilder::Builder() const
+{
+ return myptr;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : StepBuilders
+//purpose :
+//=======================================================================
+WOKMake_DataMapOfHAsciiStringOfStepBuilder& WOKMake_StepBuilder::StepBuilders()
+{
+ static WOKMake_DataMapOfHAsciiStringOfStepBuilder builders;
+ return builders;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Add
+//purpose :
+//=======================================================================
+void WOKMake_StepBuilder::Add() const
+{
+ WOK_TRACE {
+ VerboseMsg("WOK_STEP") << "WOKMake_StepBuilder::Add"
+ << "Adding " << myname << " in cache" << endm;
+ }
+ WOKMake_StepBuilder::StepBuilders().Bind(Name(), *this);
+}
+
+
+//purpose :
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : BuildStep
+//purpose :
+//=======================================================================
+Handle(WOKMake_Step) WOKMake_StepBuilder::BuildStep(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Handle(TCollection_HAsciiString)& name,
+ const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Standard_Boolean checked,
+ const Standard_Boolean hidden)
+{
+ Handle(WOKMake_Step) result;
+ WOKMake_DataMapOfHAsciiStringOfStepBuilder& knownsteps = WOKMake_StepBuilder::StepBuilders();
+ Standard_Integer i;
+
+ if(name.IsNull() || aunit.IsNull() || acode.IsNull())
+ {
+ ErrorMsg << "WOKMake_StepBuilder::BuildStep"
+ << "Invalid Input to WOKMake_StepBuilder::BuildStep" << endm;
+ Standard_ProgramError::Raise("Invalid Input to WOKMake_StepBuilder::BuildStep");
+ }
+
+ Handle(TCollection_HAsciiString) libs = aunit->Params().Eval("%WOKSteps_StepLibs",Standard_True);
+
+ if(libs.IsNull())
+ {
+ ErrorMsg << "WOKMake_Step::GetStep"
+ << "Could not eval parameter %WOKSteps_StepLibs" << endm;
+ return result;
+ }
+
+ if(knownsteps.IsBound(name))
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_STEP") << "WOKMake_StepBuilder::BuildStep"
+ << "Got " << name << " in cache at pos " << i << endm;
+ }
+ return (*knownsteps.Find(name).Builder())(aprocess,aunit,acode,checked,hidden);
+ }
+
+ Handle(TCollection_HAsciiString) key = new TCollection_HAsciiString(name);
+ Handle(TCollection_HAsciiString) keyword;
+
+ keyword = new TCollection_HAsciiString(" ");
+ keyword->AssignCat(key);
+ keyword->AssignCat(" ");
+
+ key->AssignCat("_");
+
+ i=1;
+ Handle(TCollection_HAsciiString) alib = libs->Token(" ", i);
+ while(!alib->IsEmpty())
+ {
+ Handle(WOKUtils_Path) alibpath;
+ TCollection_AsciiString stepprm("%");
+
+ stepprm.AssignCat(alib->ToCString());
+ stepprm.AssignCat("_DefinedSteps");
+
+ Handle(TCollection_HAsciiString) steps = aunit->Params().Eval(stepprm.ToCString(),Standard_True);
+
+ if(steps->Search(keyword) != -1)
+ {
+ // la lib contient l'etape recherchee
+ TCollection_AsciiString libparam("%");
+
+ libparam.AssignCat(alib->ToCString());
+ libparam.AssignCat("_LibPath");
+
+ Handle(TCollection_HAsciiString) libpath = aunit->Params().Eval(libparam.ToCString(),Standard_True);
+
+ if(libpath.IsNull())
+ {
+ ErrorMsg << "WOKMake_Step::GetStep"
+ << "Could not eval parameter " << libparam.ToCString() << endm;
+ return result;
+ }
+
+ alibpath = new WOKUtils_Path(libpath);
+
+ if(!alibpath->Exists())
+ {
+ alibpath = aunit->Params().SearchFile(libpath);
+
+ if(alibpath.IsNull())
+ {
+ ErrorMsg << "WOKMake_Step::GetStep"
+ << "Could not eval find library " << libpath << endm;
+ return result;
+ }
+ }
+
+
+ OSD_SharedLibrary ashlib(alibpath->Name()->ToCString());
+
+ if(!ashlib.DlOpen(OSD_RTLD_LAZY))
+ {
+ ErrorMsg << "WOKMake_Step::GetStep"
+ << "Could not open " << libpath << " : " << ashlib.DlError() << endm;
+ return result;
+ }
+
+ WOKMake_StepConstructPtr ptr = (WOKMake_StepConstructPtr) ashlib.DlSymb(key->ToCString());
+
+ if(ptr == NULL)
+ {
+ ErrorMsg << "WOKMake_Step::GetStep"
+ << "Could not find " << key << " in " << libpath << endm;
+ return result;
+ }
+
+ WOKMake_StepBuilder builder(name, ptr);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_STEP") << "WOKMake_Step::GetStep"
+ << "Adding main : " << name->ToCString() << endm;
+ }
+
+ builder.Add();
+ result = (*ptr) (aprocess, aunit, acode, checked, hidden);
+
+ //profitons du DLOpen
+ Standard_Integer k=1;
+ Handle(TCollection_HAsciiString) astr = steps->Token(" ", k);
+
+ while(!astr->IsEmpty())
+ {
+ if(!astr->IsSameString(name))
+ {
+ Handle(TCollection_HAsciiString) otherkey = new TCollection_HAsciiString(astr);
+ otherkey->AssignCat("_");
+
+ WOKMake_StepConstructPtr ptr = (WOKMake_StepConstructPtr) ashlib.DlSymb(otherkey->ToCString());
+
+ if(ptr == NULL)
+ {
+ WarningMsg << "WOKMake_Step::GetStep"
+ << "Could not find declared " << otherkey << " in " << libpath << endm;
+ }
+ else
+ {
+ WOKMake_StepBuilder builder(astr, ptr);
+
+ WOK_TRACE {
+ VerboseMsg("WOK_STEP") << "WOKMake_Step::GetStep"
+ << "Adding : " << astr->ToCString() << endm;
+ }
+ builder.Add();
+ }
+ }
+ k++;
+ astr = steps->Token(" ", k);
+ }
+
+
+ return result;
+ }
+ i++;
+ alib = libs->Token(" ", i);
+ }
+
+ if(result.IsNull())
+ {
+ WOK_TRACE {
+ VerboseMsg("WOK_STEP") << "WOKMake_Step::GetStep"
+ << key << " is a triggerred step" << endm;
+ }
+
+ Handle(WOKMake_TriggerStep) trigg = new WOKMake_TriggerStep(aprocess,aunit, acode, checked, hidden);
+ trigg->SetName(name);
+ result = trigg;
+ return result;
+ }
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : BuildStep
+//purpose :
+//=======================================================================
+Handle(WOKMake_Step) WOKMake_StepBuilder::BuildStep(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Handle(TCollection_HAsciiString)& asubcode)
+{
+ Handle(WOKMake_Step) result;
+
+ if(aunit.IsNull())
+ {
+ ErrorMsg << "WOKMake_StepBuilder::BuildStep"
+ << "Invalid Null Unit" << endm;
+ return result;
+ }
+ if(acode.IsNull())
+ {
+ ErrorMsg << "WOKMake_StepBuilder::BuildStep"
+ << "Invalid Null Step code" << endm;
+ return result;
+ }
+
+
+ Handle(TCollection_HAsciiString) keyword;
+ Handle(TCollection_HAsciiString) key;
+ TCollection_AsciiString astepdescrprm;
+
+ astepdescrprm.AssignCat("%WOKSteps_");
+ astepdescrprm.AssignCat(acode->ToCString());
+ astepdescrprm.ChangeAll('.', '_');
+
+ key = aunit->Params().Eval(astepdescrprm.ToCString(),Standard_True);
+
+ if(key.IsNull())
+ {
+ return result;
+ }
+
+ Standard_Character ctlchar;
+ Standard_Boolean checked = Standard_False;
+ Standard_Boolean hidden = Standard_False;
+ Standard_Boolean meta = Standard_False;
+
+ Standard_Integer begin = 1, end;
+
+ // Carateres de controle en debut d'etape
+ while(!IsAlphabetic((ctlchar=key->Value(begin))))
+ {
+ switch(ctlchar)
+ {
+ case '*':
+ checked = Standard_True;
+ begin++;
+ break;
+ case '.':
+ hidden = Standard_True;
+ begin++;
+ break;
+ case '#':
+ meta = Standard_True;
+ begin++;
+ break;
+ case ' ':
+ case '\t':
+ begin++;
+ break;
+ default:
+ ErrorMsg << "WOKMake_StepDescrExplorer" << "Bad WOKMake Step ctl Character in : " << key << endm;
+ Standard_ProgramError::Raise("WOKMake_StepDescrExplorer");
+ }
+ }
+
+ Handle(TCollection_HAsciiString) steprec;
+ Handle(TColStd_HSequenceOfHAsciiString) precseq;
+ Standard_Integer precbegin, precend;
+ // A t'elle des etapes precedente
+ if((precbegin = key->Location(1,'(', begin, key->Length())) == 0 )
+ {
+ end = key->Length();
+ precseq.Nullify();
+ }
+ else
+ {
+ end = precbegin-1;
+ precbegin++;
+ precend = key->Location(1, ')', precbegin, key->Length());
+
+ if(precend == 0)
+ {
+ ErrorMsg << "WOKMake_StepBuilder::GetStep" << "Bad WOKMake Step format : " << key << endm;
+ Standard_ProgramError::Raise("WOKMake_StepBuilder::GetStep");
+ }
+
+ precend--;
+ steprec = key->SubString(precbegin, precend);
+
+ precseq = new TColStd_HSequenceOfHAsciiString;
+
+ Standard_Integer precind =1;
+
+ Handle(TCollection_HAsciiString) curstepprec = steprec->Token(",",precind);
+
+ while(!curstepprec->IsEmpty())
+ {
+ Handle(TCollection_HAsciiString) precname = WOKMake_Step::UniqueName(aunit, curstepprec, Handle(TCollection_HAsciiString)());
+
+ precseq->Append(precname);
+ precind++;
+ curstepprec = steprec->Token(",",precind);
+ }
+ }
+
+ Handle(TCollection_HAsciiString) stepdef = key->SubString(begin,end);
+
+ result = BuildStep(aprocess,stepdef, aunit, acode, checked, hidden);
+
+ if(meta && asubcode.IsNull())
+ {
+ Handle(WOKMake_MetaStep) astep = new WOKMake_MetaStep(aprocess, aunit,
+ acode, checked, hidden);
+ astep->SetAdmFileType(result->AdmFileType());
+ astep->SetOutputDirTypeName(result->OutputDirTypeName());
+ result = astep;
+ }
+
+ if(!result.IsNull())
+ {
+ result->SetPrecedenceSteps(precseq);
+ }
+ return result;
+}
--- /dev/null
+// File: WOKMake_StepConstructPtr.hxx
+// Created: Thu Jun 27 14:01:54 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKMake_StepConstructPtr_HeaderFile
+#define WOKMake_StepConstrucPtr_HeaderFile
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKernel_DevUnit.hxx>
+
+#include <WOKMake_Step.hxx>
+
+
+typedef Handle(WOKMake_Step) (*WOKMake_StepConstructPtr) (const Handle(WOKMake_BuildProcess)&,
+ const Handle(WOKernel_DevUnit)&,
+ const Handle(TCollection_HAsciiString)&,
+ Standard_Boolean , Standard_Boolean );
+
+
+#endif
--- /dev/null
+-- File: WOKMake_StepFile.cdl
+-- Created: Mon Jun 17 15:40:38 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+deferred class StepFile from WOKMake
+inherits TShared from MMgt
+ ---Purpose:
+
+uses
+ FileStatus from WOKMake,
+ File from WOKernel,
+ Entity from WOKBuilder,
+ Path from WOKUtils,
+ HAsciiString from TCollection
+
+is
+
+ Initialize;
+
+ Initialize(anid : HAsciiString from TCollection;
+ afile : File from WOKernel;
+ abuildent : Entity from WOKBuilder;
+ aoldpath : Path from WOKUtils);
+
+ SetFile(me:mutable; afile : File from WOKernel);
+ File(me)
+ ---C++: return const &
+ ---C++: inline
+ returns File from WOKernel;
+
+ SetBuilderEntity(me:mutable; aent : Entity from WOKBuilder);
+ BuilderEntity(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Entity from WOKBuilder;
+
+ SetID(me:mutable; aname : HAsciiString from TCollection);
+ ID(me)
+ ---C++: return const &
+ ---C++: inline
+ returns HAsciiString from TCollection;
+
+ SetLastPath(me:mutable; apath : Path from WOKUtils);
+ LastPath(me)
+ ---C++: return const &
+ ---C++: inline
+ returns Path from WOKUtils;
+
+ SetStatus(me:mutable; astatus : FileStatus from WOKMake);
+ Status(me)
+ ---C++: inline
+ returns FileStatus from WOKMake;
+
+ SetLocateFlag(me:mutable; aflg : Boolean from Standard);
+ IsLocateAble(me)
+ ---Purpose: True if File is Known to be in WOK Entity
+ -- False if File is not in WOK (ex: .:.:/usr/include/stream.h)
+ ---C++: inline
+ returns Boolean from Standard;
+
+ SetPhysicFlag(me:mutable; aflag : Boolean from Standard);
+ IsPhysic(me)
+ ---C++: inline
+ returns Boolean from Standard;
+
+ SetStepID(me:mutable; aflag : Boolean from Standard);
+ IsStepID(me)
+ ---C++: inline
+ returns Boolean from Standard;
+
+fields
+
+ myfile : File from WOKernel;
+ myid : HAsciiString from TCollection;
+ myent : Entity from WOKBuilder;
+ mylastpath : Path from WOKUtils;
+ myattr : Integer from Standard is protected;
+ mystatus : FileStatus from WOKMake;
+
+end StepFile;
--- /dev/null
+// File: WOKMake_StepFile.cxx
+// Created: Tue Jun 18 10:08:26 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#include <WOKMake_StepFile.ixx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_StepFile
+//purpose :
+//=======================================================================
+WOKMake_StepFile::WOKMake_StepFile()
+ : mystatus(WOKMake_Undetermined), myattr(0)
+{
+ SetPhysicFlag(Standard_True);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : WOKMake_StepFile
+//purpose :
+//=======================================================================
+WOKMake_StepFile::WOKMake_StepFile(const Handle(TCollection_HAsciiString)& anid,
+ const Handle(WOKernel_File)& afile,
+ const Handle(WOKBuilder_Entity)& abuildent,
+ const Handle(WOKUtils_Path)& aoldpath)
+ : myid(anid), myfile(afile), myent(abuildent), mylastpath(aoldpath), mystatus(WOKMake_Undetermined), myattr(0)
+{
+ SetPhysicFlag(Standard_True);
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetID
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetID(const Handle(TCollection_HAsciiString)& anid)
+{
+ myid = anid;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetFile
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetFile(const Handle(WOKernel_File)& afile)
+{
+ myfile = afile;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetBuilderEntity
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetBuilderEntity(const Handle(WOKBuilder_Entity)& anent)
+{
+ myent = anent;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetLastPath
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetLastPath(const Handle(WOKUtils_Path)& apath)
+{
+ mylastpath = apath;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetLocateFlag
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetLocateFlag(const Standard_Boolean aflag)
+{
+ if(aflag)
+ myattr |= STEPFILE_LOCATE;
+ else
+ myattr &= (STEPFILE_LOCATE ^ myattr);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetStatus
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetStatus(const WOKMake_FileStatus astatus)
+{
+ mystatus = astatus;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetPhysicFlag
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetPhysicFlag(const Standard_Boolean aflag)
+{
+ if(aflag)
+ myattr |= STEPFILE_PHYSIC;
+ else
+ myattr &= (STEPFILE_PHYSIC ^ myattr);
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetStepID
+//purpose :
+//=======================================================================
+void WOKMake_StepFile::SetStepID(const Standard_Boolean aflag)
+{
+ if(aflag)
+ myattr |= STEPFILE_STEPID;
+ else
+ myattr &= (STEPFILE_STEPID ^ myattr);
+}
+
--- /dev/null
+// File: WOKMake_StepFile.lxx
+// Created: Tue Jun 18 13:44:56 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+// BASE CLASS STEPFILE defines
+#define STEPFILE_PHYSIC 0x01
+#define STEPFILE_LOCATE 0x02
+#define STEPFILE_STEPID 0x04
+
+// INPUT FILES defines
+
+#define STEPFILE_DIRECT 0x08
+
+// OUTPUT FILES defines
+
+#define STEPFILE_REFPROD 0x10
+#define STEPFILE_MEMBEXT 0x20
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : ID
+//purpose :
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKMake_StepFile::ID() const
+{
+ return myid;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : File
+//purpose :
+//=======================================================================
+const Handle(WOKernel_File)& WOKMake_StepFile::File() const
+{
+ return myfile;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : BuilderEntity
+//purpose :
+//=======================================================================
+const Handle(WOKBuilder_Entity)& WOKMake_StepFile::BuilderEntity() const
+{
+ return myent;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : LastPath
+//purpose :
+//=======================================================================
+const Handle(WOKUtils_Path)& WOKMake_StepFile::LastPath() const
+{
+ return mylastpath;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Status
+//purpose :
+//=======================================================================
+WOKMake_FileStatus WOKMake_StepFile::Status() const
+{
+ return mystatus;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsLocateAble
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_StepFile::IsLocateAble() const
+{
+ if(myattr & STEPFILE_LOCATE) return Standard_True;
+ else return Standard_False;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsPhysic
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_StepFile::IsPhysic() const
+{
+ if(myattr & STEPFILE_PHYSIC) return Standard_True;
+ else return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsXStep
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_StepFile::IsStepID() const
+{
+ if(myattr & STEPFILE_STEPID) return Standard_True;
+ else return Standard_False;
+}
+
--- /dev/null
+// File: WOKMake_Step_1.cxx
+// Created: Mon Dec 4 18:26:15 1995
+// Author: Jean GAUTIER
+// <jga@cobrax>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKernel_FileType.hxx>
+
+#include <WOKMake_Step.jxx>
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : InLocator
+//purpose :
+//=======================================================================
+Handle(WOKernel_Locator) WOKMake_Step::InLocator() const
+{
+ return myprocess->Locator();
+}
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutLocator
+//purpose :
+//=======================================================================
+Handle(WOKernel_Locator) WOKMake_Step::OutLocator() const
+{
+ return myprocess->Locator();
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : StepOutputID
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::StepOutputID(const Handle(TCollection_HAsciiString)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Handle(TCollection_HAsciiString)& asubcode)
+{
+ Handle(TCollection_HAsciiString) id = new TCollection_HAsciiString(aunit);
+ id->AssignCat(":");
+ id->AssignCat(acode);
+ if(!asubcode.IsNull())
+ {
+ id->AssignCat(":");
+ id->AssignCat(asubcode);
+ }
+ return id;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : StepOutputID
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::StepOutputID(const Handle(TCollection_HAsciiString)& aunit,
+ const Handle(TCollection_HAsciiString)& acode)
+{
+ Handle(TCollection_HAsciiString) id = new TCollection_HAsciiString(aunit);
+ id->AssignCat(":");
+ id->AssignCat(acode);
+ return id;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : StepOutputID
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::StepOutputID() const
+{
+ return WOKMake_Step::StepOutputID(Unit()->Name(), Code(), SubCode());
+}
+
+//=======================================================================
+//function : InputFilesFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::InputFilesFileName() const
+{
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(Unit()->Name());
+ Handle(TCollection_HAsciiString) stepcode = new TCollection_HAsciiString(Code());
+
+ stepcode->ChangeAll('.', '_');
+
+ astr->AssignCat("_");
+ astr->AssignCat(stepcode);
+
+ if(!SubCode().IsNull())
+ {
+ Handle(TCollection_HAsciiString) subcode = new TCollection_HAsciiString(SubCode());
+ subcode->ChangeAll('.', '_');
+
+ astr->AssignCat("_");
+ astr->AssignCat(subcode);
+ }
+ astr->AssignCat(".In");
+ return astr;
+}
+
+//=======================================================================
+//function : DepItemsFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::DepItemsFileName() const
+{
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(Unit()->Name());
+ Handle(TCollection_HAsciiString) stepcode = new TCollection_HAsciiString(Code());
+
+ stepcode->ChangeAll('.', '_');
+ astr->AssignCat("_");
+ astr->AssignCat(stepcode);
+
+ if(!SubCode().IsNull())
+ {
+ Handle(TCollection_HAsciiString) subcode = new TCollection_HAsciiString(SubCode());
+ subcode->ChangeAll('.', '_');
+
+ astr->AssignCat("_");
+ astr->AssignCat(subcode);
+ }
+
+ astr->AssignCat(".Dep");
+ return astr;
+}
+
+//=======================================================================
+//function : OutputFilesFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::OutputFilesFileName() const
+{
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(Unit()->Name());
+ Handle(TCollection_HAsciiString) stepcode = new TCollection_HAsciiString(Code());
+
+ stepcode->ChangeAll('.', '_');
+ astr->AssignCat("_");
+ astr->AssignCat(stepcode);
+
+ if(!SubCode().IsNull())
+ {
+ Handle(TCollection_HAsciiString) subcode = new TCollection_HAsciiString(SubCode());
+ subcode->ChangeAll('.', '_');
+
+ astr->AssignCat("_");
+ astr->AssignCat(subcode);
+ }
+
+ astr->AssignCat(".Out");
+ return astr;
+}
+
+//=======================================================================
+//function : LogFileName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::LogFileName() const
+{
+ Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(Unit()->Name());
+ Handle(TCollection_HAsciiString) stepcode = new TCollection_HAsciiString(Code());
+
+ stepcode->ChangeAll('.', '_');
+ astr->AssignCat("_");
+ astr->AssignCat(stepcode);
+
+ if(!SubCode().IsNull())
+ {
+ Handle(TCollection_HAsciiString) subcode = new TCollection_HAsciiString(SubCode());
+ subcode->ChangeAll('.', '_');
+
+ astr->AssignCat("_");
+ astr->AssignCat(subcode);
+ }
+
+ astr->AssignCat(".Log");
+
+ return astr;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AdmFile
+//purpose :
+//=======================================================================
+Handle(WOKernel_File) WOKMake_Step::AdmFile(const Handle(TCollection_HAsciiString)& aname) const
+{
+ Handle(WOKernel_File) result;
+
+ result = new WOKernel_File(aname, Unit(), Unit()->GetFileType(AdmFileType()));
+ result->GetPath();
+ return result;
+}
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : LocateAdmFile
+//purpose :
+//=======================================================================
+Handle(WOKernel_File) WOKMake_Step::LocateAdmFile(const Handle(WOKernel_Locator)& aloc,
+ const Handle(TCollection_HAsciiString)& aname) const
+{
+ Handle(WOKernel_File) result;
+
+ if(!aloc.IsNull())
+ {
+ result = aloc->Locate(Unit()->Name(), AdmFileType(), aname);
+ }
+ return result;
+}
+
+
+//=======================================================================
+//function : IsOrIsSubStepOf
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsOrIsSubStepOf(const Handle(TCollection_HAsciiString)& acode) const
+{
+ Handle(TCollection_HAsciiString) astr;
+
+ if(Code()->IsSameString(acode))
+ {
+ return Standard_True;
+ }
+ astr = new TCollection_HAsciiString(acode);
+ astr->AssignCat(".");
+
+ if(Code()->Search(astr) == 1)
+ {
+ // le nom d'etape commence par acode.
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : UniqueName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::UniqueName(const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Handle(TCollection_HAsciiString)& asubcode)
+{
+ Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString(aunit->Name());
+
+ result->AssignCat(":");
+ result->AssignCat(acode);
+ if(!asubcode.IsNull())
+ {
+ result->AssignCat(":");
+ result->AssignCat(asubcode);
+ }
+ return result;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : UniqueName
+//purpose :
+//=======================================================================
+void WOKMake_Step::SplitUniqueName(const Handle(TCollection_HAsciiString)& anid,
+ Handle(TCollection_HAsciiString)& auname,
+ Handle(TCollection_HAsciiString)& acode,
+ Handle(TCollection_HAsciiString)& asubcode)
+{
+ auname = anid->Token(":",1);
+ acode = anid->Token(":",2);
+ asubcode = anid->Token(":",3);
+
+ if(auname->IsEmpty()) auname.Nullify();
+ if(acode->IsEmpty()) acode.Nullify();
+ if(asubcode->IsEmpty()) asubcode.Nullify();
+ return;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : UniqueName
+//purpose :
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKMake_Step::UniqueName()
+{
+ if( !myunique.IsNull() ) return myunique;
+ return (myunique = WOKMake_Step::UniqueName(Unit(), Code(), SubCode()));
+}
+
+//=======================================================================
+//function : Code
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::Code() const
+{
+ return mycode;
+}
+
+//=======================================================================
+//function : IsHidden
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsHidden() const
+{
+ return myhidden;
+}
+//=======================================================================
+//function : IsChecked
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsChecked() const
+{
+ return mycheck;
+}
+
+//=======================================================================
+//function : SubCode
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_Step::SubCode() const
+{
+ return mysubcode;
+}
+
+//=======================================================================
+//function : SetSubCode
+//purpose :
+//=======================================================================
+void WOKMake_Step::SetSubCode(const Handle(TCollection_HAsciiString)& acode)
+{
+ mysubcode = acode;
+}
+
+//=======================================================================
+//function : Status
+//purpose :
+//=======================================================================
+WOKMake_Status WOKMake_Step::Status() const
+{
+ return mystatus;
+}
+
+void WOKMake_Step::SetUptodate() {mystatus = WOKMake_Uptodate;}
+void WOKMake_Step::SetSucceeded() {mystatus = WOKMake_Success;}
+void WOKMake_Step::SetIncomplete() {mystatus = WOKMake_Incomplete;}
+void WOKMake_Step::SetFailed() {mystatus = WOKMake_Failed;}
+void WOKMake_Step::SetUnprocessed() {mystatus = WOKMake_Unprocessed;}
+void WOKMake_Step::SetStatus(const WOKMake_Status astatus) {mystatus = astatus;}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetOutputDir
+//purpose :
+//=======================================================================
+void WOKMake_Step::SetOutputDir(const Handle(WOKUtils_Path)& apath) {myoutputdir = apath;}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutputDir
+//purpose :
+//=======================================================================
+Handle(WOKUtils_Path) WOKMake_Step::OutputDir()
+{
+ if(myoutputdir.IsNull())
+ {
+ Handle(WOKernel_File) afile = new WOKernel_File(Unit(), Unit()->GetFileType(OutputDirTypeName()));
+ afile->GetPath();
+
+ myoutputdir = afile->Path();
+ }
+ return myoutputdir;
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsDBMSDependent
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsDBMSDependent() const
+{
+ Handle(TCollection_HAsciiString) admtype = AdmFileType();
+ Handle(WOKernel_FileType) atype = Unit()->GetFileType(admtype);
+
+ if(atype.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_Step::IsDBMSDependent");
+ }
+
+ return atype->IsDBMSDependent();
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : IsStationDependent
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsStationDependent() const
+{
+ Handle(TCollection_HAsciiString) admtype = AdmFileType();
+ Handle(WOKernel_FileType) atype = Unit()->GetFileType(admtype);
+
+ if(atype.IsNull())
+ {
+ Standard_ProgramError::Raise("WOKMake_Step::IsStationDependent");
+ }
+
+ return atype->IsStationDependent();
+
+}
+
+//=======================================================================
+//function : PrecedenceSteps
+//purpose :
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKMake_Step::PrecedenceSteps() const
+{
+ return myprecsteps;
+}
+
+//=======================================================================
+//function : SetPrecedenceSteps
+//purpose :
+//=======================================================================
+void WOKMake_Step::SetPrecedenceSteps(const Handle(TColStd_HSequenceOfHAsciiString)& steps)
+{
+ myprecsteps = steps;
+}
+
+//=======================================================================
+//function : SetOptions
+//purpose :
+//=======================================================================
+void WOKMake_Step::SetOptions(const Handle(WOKMake_HSequenceOfStepOption)& opts)
+{
+ myoptions = opts;
+}
+Handle(WOKMake_HSequenceOfStepOption) WOKMake_Step::Options() const {return myoptions;}
+
+
+//=======================================================================
+//function : SetTargets
+//purpose :
+//=======================================================================
+void WOKMake_Step::SetTargets(const Handle(TColStd_HSequenceOfHAsciiString)& targets)
+{
+ mytargets = targets;
+}
+Handle(TColStd_HSequenceOfHAsciiString) WOKMake_Step::Targets() const {return mytargets;}
+
+
+
+//=======================================================================
+//function : IsToExecute
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_Step::IsToExecute() const {return myexecflag;}
+void WOKMake_Step::DoExecute() {myexecflag = Standard_True;}
+void WOKMake_Step::DontExecute() {myexecflag = Standard_False;}
--- /dev/null
+-- File: WOKMake_TriggerStep.cdl
+-- Created: Tue Oct 8 14:22:59 1996
+-- Author: Jean GAUTIER
+-- <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright: Matra Datavision 1996
+
+
+class TriggerStep from WOKMake
+inherits Step from WOKMake
+ ---Purpose:
+
+uses
+
+ BuildProcess from WOKMake,
+ HSequenceOfInputFile from WOKMake,
+ InputFile from WOKMake,
+ OutputFile from WOKMake,
+ Status from WOKMake,
+ DevUnit from WOKernel,
+ HAsciiString from TCollection,
+ Boolean from Standard
+
+is
+
+ Create(aprocess : BuildProcess from WOKMake;
+ aunit : DevUnit from WOKernel;
+ acode : HAsciiString from TCollection;
+ checked, hidden : Boolean from Standard)
+ returns mutable TriggerStep from WOKMake;
+
+ CurrentTriggerStep(myclass)
+ ---C++: return &
+ returns TriggerStep from WOKMake;
+
+ SetName(me:mutable; aname : HAsciiString from TCollection);
+ Name(me)
+ returns HAsciiString from TCollection;
+
+ AdmFileType(me)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ OutputDirTypeName(me)
+ returns HAsciiString from TCollection
+ is redefined protected;
+
+ HandleInputFile(me:mutable; anitem : InputFile from WOKMake)
+ returns Boolean from Standard
+ is redefined protected;
+
+ Init(me:mutable)
+ is redefined protected;
+
+ AddInputFile(me:mutable; inputfile : InputFile from WOKMake);
+
+ GetInputFile(me; anid : HAsciiString from TCollection)
+ returns InputFile from WOKMake;
+
+ AddOutputFile(me:mutable; Outputfile : OutputFile from WOKMake);
+
+ GetOutputFile(me; anid : HAsciiString from TCollection)
+ returns OutputFile from WOKMake;
+
+ Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake)
+ ---Purpose: Executes step
+ -- Computes output files
+ is redefined private;
+
+ Terminate(me:mutable)
+ is redefined protected;
+
+
+fields
+
+ myname : HAsciiString from TCollection;
+end TriggerStep;
--- /dev/null
+// File: WOKMake_TriggerStep.cxx
+// Created: Tue Oct 8 14:24:59 1996
+// Author: Jean GAUTIER
+// <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_StringValue.hxx>
+#include <WOKTools_ReturnType.hxx>
+
+#include <WOKUtils_Triggers.hxx>
+
+#include <WOKernel_File.hxx>
+
+
+#include <WOKMake_AdmFileTypes.hxx>
+
+#include <WOKMake_TriggerStep.ixx>
+
+
+//=======================================================================
+//function : WOKMake_TriggerStep
+//purpose :
+//=======================================================================
+WOKMake_TriggerStep::WOKMake_TriggerStep(const Handle(WOKMake_BuildProcess)& aprocess,
+ const Handle(WOKernel_DevUnit)& aunit,
+ const Handle(TCollection_HAsciiString)& acode,
+ const Standard_Boolean checked,
+ const Standard_Boolean hidden)
+ : WOKMake_Step(aprocess,aunit, acode, checked, hidden)
+{
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : CurrentTriggerStep
+//purpose :
+//=======================================================================
+Handle(WOKMake_TriggerStep)& WOKMake_TriggerStep::CurrentTriggerStep()
+{
+ static Handle(WOKMake_TriggerStep) TheCurStep;
+ return TheCurStep;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : SetName
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+ myname = aname;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Name
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_TriggerStep::Name() const
+{
+ return myname;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AdmFileType
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_TriggerStep::AdmFileType() const
+{
+ Handle(TCollection_HAsciiString) result;
+ Handle(TCollection_HAsciiString) trigname = new TCollection_HAsciiString(Name());
+
+ trigname->AssignCat("::AdmFileType");
+
+ WOKUtils_Trigger execute;
+
+ execute(trigname) << endt >> result;
+
+ switch(execute.Status())
+ {
+ case WOKUtils_Unknown:
+ case WOKUtils_NotSetted:
+ {
+ static Handle(TCollection_HAsciiString) sresult = new TCollection_HAsciiString((char*)STADMFILE);
+ result = sresult;
+ }
+ break;
+ case WOKUtils_Succeeded:
+ break;
+ case WOKUtils_Failed:
+ //SetFailed();
+ break;
+ }
+
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : OutputDirTypeName
+//purpose :
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKMake_TriggerStep::OutputDirTypeName() const
+{
+ Handle(TCollection_HAsciiString) result;
+ Handle(TCollection_HAsciiString) trigname = new TCollection_HAsciiString(Name());
+
+ trigname->AssignCat("::OutputDirTypeName");
+
+ WOKUtils_Trigger execute;
+
+ execute(trigname) << endt >> result;
+
+ switch(execute.Status())
+ {
+ case WOKUtils_Unknown:
+ case WOKUtils_NotSetted:
+ {
+ static Handle(TCollection_HAsciiString) sresult = new TCollection_HAsciiString((char*)STTMPDIR);
+ result = sresult;
+ }
+ break;
+ case WOKUtils_Succeeded:
+ break;
+ case WOKUtils_Failed:
+ //SetFailed();
+ break;
+ }
+
+ return result;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : HandleInputFile
+//purpose :
+//=======================================================================
+Standard_Boolean WOKMake_TriggerStep::HandleInputFile(const Handle(WOKMake_InputFile)& infile)
+{
+ WOKUtils_Trigger execute;
+ Standard_Boolean b=Standard_False;
+
+ Handle(TCollection_HAsciiString) trigname = new TCollection_HAsciiString(Name());
+
+ trigname->AssignCat("::HandleInputFile");
+
+ execute(trigname) << infile->ID() << endt >> b;
+
+ switch ( execute.Status())
+ {
+ case WOKUtils_Succeeded:
+ if(b)
+ {
+ infile->SetBuilderEntity(BuilderEntity(infile->File()));
+ }
+ break;
+ case WOKUtils_Unknown:
+ case WOKUtils_Failed:
+ case WOKUtils_NotSetted:
+ break;
+ }
+
+ return b;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::Init()
+{
+
+ CurrentTriggerStep() = Handle(WOKMake_TriggerStep)(this);
+
+ WOKUtils_Trigger execute;
+
+ // for Tcl8.0
+ // execute("namespace") << "eval" << Name() << "{}" << endt;
+
+
+ Handle(TCollection_HAsciiString) trigfile = new TCollection_HAsciiString(Name());
+ trigfile->AssignCat(".tcl");
+
+ Handle(WOKUtils_Path) apath = Unit()->Params().SearchFile(trigfile);
+
+ if(apath.IsNull())
+ {
+ WarningMsg << "WOKMake_TriggerStep::Init"
+ << "Could not find file associated with trigger step " << Name() << endm;
+ WarningMsg << "WOKMake_TriggerStep::Init"
+ << "Nothing done" << endm;
+ }
+
+ execute(trigfile, Unit()->Params(), WOKTools_TclInterp) << endt;
+
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AddInputFile
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::AddInputFile(const Handle(WOKMake_InputFile)& infile)
+{
+ if(infile.IsNull())
+ Standard_ProgramError::Raise("WOKMake_TriggerStep::AddInputFile : Null Input");
+
+ myinflow.Add(infile->ID(), infile);
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetInputFile
+//purpose :
+//=======================================================================
+Handle(WOKMake_InputFile) WOKMake_TriggerStep::GetInputFile(const Handle(TCollection_HAsciiString)& anid) const
+{
+ Handle(WOKMake_InputFile) nullhandle;
+
+ if(myinflow.Contains(anid))
+ return myinflow.FindFromKey(anid);
+ return nullhandle;
+}
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : AddOutputFile
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::AddOutputFile(const Handle(WOKMake_OutputFile)& outfile)
+{
+ if(outfile.IsNull())
+ Standard_ProgramError::Raise("WOKMake_TriggerStep::AddOutputFile : Null Input");
+
+ myoutflow.Add(outfile->ID(), outfile);
+}
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : GetoutputFile
+//purpose :
+//=======================================================================
+Handle(WOKMake_OutputFile) WOKMake_TriggerStep::GetOutputFile(const Handle(TCollection_HAsciiString)& anid) const
+{
+ Handle(WOKMake_OutputFile) nullhandle;
+
+ if(myoutflow.Contains(anid))
+ return myoutflow.FindFromKey(anid);
+ return nullhandle;
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::Execute(const Handle(WOKMake_HSequenceOfInputFile)& execlist)
+{
+ Standard_Integer i;
+ Standard_Boolean status;
+ WOKUtils_Trigger execute;
+
+ Handle(TCollection_HAsciiString) trigname = new TCollection_HAsciiString(Name());
+ trigname->AssignCat("::Execute");
+
+ execute(trigname) << Unit()->UserPathName();
+
+ for(i=1; i<=execlist->Length(); i++)
+ {
+ execute << execlist->Value(i)->ID();
+ }
+
+ execute << endt >> status;
+
+ switch(execute.Status())
+ {
+ case WOKUtils_Failed:
+ SetFailed();
+ break;
+ case WOKUtils_Succeeded:
+ if(status)
+ SetFailed();
+ else
+ SetSucceeded();
+ break;
+ case WOKUtils_NotSetted:
+ SetUnprocessed();
+ break;
+ default:
+ break;
+ }
+ return;
+}
+
+
+
+
+//=======================================================================
+//Author : Jean Gautier (jga)
+//function : Init
+//purpose :
+//=======================================================================
+void WOKMake_TriggerStep::Terminate()
+{
+ WOKMake_TriggerStep::CurrentTriggerStep() = Handle(WOKMake_TriggerStep)();
+}
+