From 3295b40ab907e6a8d4a5f62a88804270a5821ea8 Mon Sep 17 00:00:00 2001 From: cas Date: Fri, 22 Oct 1999 18:05:40 +0000 Subject: [PATCH] Initial revision --- src/WOKDeliv/DELIVERY.lex | 84 +++ src/WOKDeliv/DELIVERY.yacc | 103 ++++ src/WOKDeliv/FILES | 10 + src/WOKDeliv/WOKDeliv.cdl | 77 +++ src/WOKDeliv/WOKDeliv_CMPLRS.edl | 13 + src/WOKDeliv/WOKDeliv_CODEGEN.edl | 29 ++ src/WOKDeliv/WOKDeliv_DelivBuildArchive.cdl | 45 ++ src/WOKDeliv/WOKDeliv_DelivBuildArchive.cxx | 214 ++++++++ src/WOKDeliv/WOKDeliv_DelivBuildExec.cdl | 46 ++ src/WOKDeliv/WOKDeliv_DelivBuildExec.cxx | 266 ++++++++++ src/WOKDeliv/WOKDeliv_DelivBuildSource.cdl | 35 ++ src/WOKDeliv/WOKDeliv_DelivBuildSource.cxx | 114 +++++ src/WOKDeliv/WOKDeliv_DelivExecSource.tcl | 4 + src/WOKDeliv/WOKDeliv_DeliveryArchive.cdl | 40 ++ src/WOKDeliv/WOKDeliv_DeliveryArchive.cxx | 49 ++ src/WOKDeliv/WOKDeliv_DeliveryBase.cdl | 53 ++ src/WOKDeliv/WOKDeliv_DeliveryBase.cxx | 509 +++++++++++++++++++ src/WOKDeliv/WOKDeliv_DeliveryCopy.cdl | 41 ++ src/WOKDeliv/WOKDeliv_DeliveryCopy.cxx | 142 ++++++ src/WOKDeliv/WOKDeliv_DeliveryDATA.cdl | 45 ++ src/WOKDeliv/WOKDeliv_DeliveryDATA.cxx | 274 ++++++++++ src/WOKDeliv/WOKDeliv_DeliveryExecList.cdl | 66 +++ src/WOKDeliv/WOKDeliv_DeliveryExecList.cxx | 361 +++++++++++++ src/WOKDeliv/WOKDeliv_DeliveryFiles.cdl | 47 ++ src/WOKDeliv/WOKDeliv_DeliveryFiles.cxx | 168 ++++++ src/WOKDeliv/WOKDeliv_DeliveryGET.cdl | 38 ++ src/WOKDeliv/WOKDeliv_DeliveryGET.cxx | 171 +++++++ src/WOKDeliv/WOKDeliv_DeliveryLIB.cdl | 58 +++ src/WOKDeliv/WOKDeliv_DeliveryLIB.cxx | 282 ++++++++++ src/WOKDeliv/WOKDeliv_DeliveryList.cdl | 78 +++ src/WOKDeliv/WOKDeliv_DeliveryList.cxx | 47 ++ src/WOKDeliv/WOKDeliv_DeliveryList.lxx | 35 ++ src/WOKDeliv/WOKDeliv_DeliveryListShared.cdl | 30 ++ src/WOKDeliv/WOKDeliv_DeliveryListShared.cxx | 108 ++++ src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cdl | 69 +++ src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cxx | 142 ++++++ src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cdl | 37 ++ src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cxx | 120 +++++ src/WOKDeliv/WOKDeliv_DeliverySOURCES.cdl | 46 ++ src/WOKDeliv/WOKDeliv_DeliverySOURCES.cxx | 178 +++++++ src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cdl | 37 ++ src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cxx | 175 +++++++ src/WOKDeliv/WOKDeliv_DeliveryShared.cdl | 40 ++ src/WOKDeliv/WOKDeliv_DeliveryShared.cxx | 108 ++++ src/WOKDeliv/WOKDeliv_DeliverySource.cdl | 24 + src/WOKDeliv/WOKDeliv_DeliverySource.cxx | 16 + src/WOKDeliv/WOKDeliv_DeliveryStep.cdl | 101 ++++ src/WOKDeliv/WOKDeliv_DeliveryStep.cxx | 430 ++++++++++++++++ src/WOKDeliv/WOKDeliv_DeliveryStepList.cdl | 46 ++ src/WOKDeliv/WOKDeliv_DeliveryStepList.cxx | 196 +++++++ src/WOKDeliv/WOKDeliv_FRONTALSCRIPT.edl | 303 +++++++++++ src/WOKDeliv/WOKDeliv_LDSCRIPT.edl | 86 ++++ src/WOKDeliv/WOKDeliv_ParseDelivery.cxx | 262 ++++++++++ src/WOKDeliv/WOKDeliv_ParseDelivery.h | 26 + src/WOKDeliv/WOKDeliv_ParseDelivery.hxx | 17 + 55 files changed, 6141 insertions(+) create mode 100755 src/WOKDeliv/DELIVERY.lex create mode 100755 src/WOKDeliv/DELIVERY.yacc create mode 100755 src/WOKDeliv/FILES create mode 100755 src/WOKDeliv/WOKDeliv.cdl create mode 100755 src/WOKDeliv/WOKDeliv_CMPLRS.edl create mode 100755 src/WOKDeliv/WOKDeliv_CODEGEN.edl create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildArchive.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildArchive.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildExec.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildExec.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildSource.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DelivBuildSource.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DelivExecSource.tcl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryArchive.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryArchive.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryBase.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryBase.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryCopy.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryCopy.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryDATA.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryDATA.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryExecList.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryExecList.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryFiles.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryFiles.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryGET.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryGET.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryLIB.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryLIB.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryList.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryList.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryList.lxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryListShared.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryListShared.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySOURCES.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySOURCES.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryShared.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryShared.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySource.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliverySource.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryStep.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryStep.cxx create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryStepList.cdl create mode 100755 src/WOKDeliv/WOKDeliv_DeliveryStepList.cxx create mode 100755 src/WOKDeliv/WOKDeliv_FRONTALSCRIPT.edl create mode 100755 src/WOKDeliv/WOKDeliv_LDSCRIPT.edl create mode 100755 src/WOKDeliv/WOKDeliv_ParseDelivery.cxx create mode 100755 src/WOKDeliv/WOKDeliv_ParseDelivery.h create mode 100755 src/WOKDeliv/WOKDeliv_ParseDelivery.hxx diff --git a/src/WOKDeliv/DELIVERY.lex b/src/WOKDeliv/DELIVERY.lex new file mode 100755 index 0000000..c56a8f8 --- /dev/null +++ b/src/WOKDeliv/DELIVERY.lex @@ -0,0 +1,84 @@ +%option never-interactive +%option yylineno + +%{ +#define yylval DELIVERYlval +#include +#include + +void lookup(tok) +int tok; +{ + TheToken = tok; + if (tok == T_ALPHA) { + TheText = strdup(yytext); + } +} + +#define Token(x) lookup(x);return x +%} + +%s NAME ATTRIBUTES +DEUXPOINT "::" +TROISPOINT ":::" +%% + +"/*""/"*([^*/]|[^*]"/"[^/])*"*"*"*/" ; + +"Put"[ \t]+"path" {BEGIN INITIAL;Token(T_PUTPATH);} +"Put"[ \t]+"include" {BEGIN INITIAL;Token(T_PUTINCLUDE);} +"Put"[ \t]+"lib" {BEGIN INITIAL;Token(T_PUTLIB);} +"Requires" {BEGIN NAME;Token(T_REQUIRES);} +"Get" {BEGIN NAME;Token(T_GET);} +"Name" {BEGIN NAME;Token(T_NAME);} +"#ifdef" {BEGIN NAME;Token(T_IFDEF);} +"#endif" {BEGIN INITIAL;Token(T_ENDIF);} + + +DevUnit {BEGIN NAME;Token(T_DEVUNIT);} +Package {BEGIN NAME;Token(T_PACKAGE);} +Nocdlpack {BEGIN NAME;Token(T_NOCDLPACK);} +Executable {BEGIN NAME;Token(T_EXECUTABLE);} +Interface {BEGIN NAME;Token(T_INTERFACE);} +Engine {BEGIN NAME;Token(T_ENGINE);} +Client {BEGIN NAME;Token(T_CLIENT);} +Schema {BEGIN NAME;Token(T_SCHEMA);} +Toolkit {BEGIN NAME;Token(T_TOOLKIT);} +Ccl {BEGIN NAME;Token(T_CCL);} +Frontal {BEGIN NAME;Token(T_FRONTAL);} +Resource {BEGIN NAME;Token(T_RESOURCE);} +Documentation {BEGIN NAME;Token(T_RESOURCE);} + +LIBRARY {Token(T_LIBRARY);} +SHARED {Token(T_SHARED);} +ARCHIVE {Token(T_ARCHIVE);} +DATAOBJECT {Token(T_DATAOBJECT);} +CDL {Token(T_CDL);} +INCLUDES {Token(T_INCLUDES);} +SOURCES {Token(T_SOURCES);} +STATIC {Token(T_STATIC);} +DYNAMIC {Token(T_DYNAMIC);} +STUB_SERVER {Token(T_STUB_SERVER);} +STUB_CLIENT {Token(T_STUB_CLIENT);} +FDDB {Token(T_FDDB);} +GET {Token(T_GETRES);} +DDL {Token(T_DDL);} + +{DEUXPOINT} {BEGIN NAME;Token(T_SEPARATOR);} +{TROISPOINT} {BEGIN NAME;Token(T_SEPARATOR);} + + +[a-zA-Z\/\-\_\.0-9]+ {BEGIN ATTRIBUTES; Token(T_ALPHA);} + +[ \t]* {Token(T_WSPACE);} +[ \t]*\n {BEGIN INITIAL; Token(T_NEWLINE);} + +. {Token(T_INVALID);} + + + + +%% + + + diff --git a/src/WOKDeliv/DELIVERY.yacc b/src/WOKDeliv/DELIVERY.yacc new file mode 100755 index 0000000..174e2ed --- /dev/null +++ b/src/WOKDeliv/DELIVERY.yacc @@ -0,0 +1,103 @@ + +%{ +#include + +#define yyv DELIVERYv + +%} + + +%token T_REQUIRES, T_PUTPATH, T_PUTINCLUDE, T_PUTLIB, T_GET, T_NAME, T_IFDEF, T_ENDIF, T_INVALID + +%token T_DEVUNIT, T_PACKAGE, T_NOCDLPACK, T_EXECUTABLE, T_INTERFACE, T_ENGINE, T_CLIENT, T_SCHEMA, T_TOOLKIT, T_CCL, T_FRONTAL, T_OLH, T_RESOURCE + +%token T_LIBRARY, T_SHARED, T_ARCHIVE, T_DATAOBJECT, T_CDL, T_INCLUDES, T_STATIC, T_DYNAMIC, T_GETRES +%token T_STUB_CLIENT, T_STUB_SERVER, T_FDDB, T_SOURCES, T_DDL + +%token T_ALPHA, T_SEPARATOR + +%token T_WSPACE, T_NEWLINE + +%% + + +components: + component + | components component + ; + +component: + parceldescription + | unitdeclaration + | parcelifdef + | T_NEWLINE + ; + +parceldescription: + T_PUTPATH T_NEWLINE + { Traite_PutPath(); } + | T_PUTINCLUDE T_NEWLINE + { Traite_PutInclude(); } + | T_PUTLIB T_NEWLINE + { Traite_PutLib(); } + | T_GET T_WSPACE T_ALPHA { Traite_GetUnit(TheText); } T_SEPARATOR T_ALPHA { Traite_GetType(TheText); } T_SEPARATOR T_ALPHA { Traite_GetFile(TheText); } T_NEWLINE + | T_NAME T_WSPACE T_ALPHA T_NEWLINE + { Traite_Name(TheText); } + | T_REQUIRES T_WSPACE T_ALPHA T_NEWLINE + { Traite_Requires(TheText); } + ; + +parcelifdef: + T_IFDEF T_WSPACE T_ALPHA T_NEWLINE + { Traite_Ifdef(TheText); } + | T_ENDIF T_NEWLINE + {Traite_Endif(); } + ; + +unitdeclaration : + typeunit T_WSPACE T_ALPHA T_NEWLINE + { + ClasseElt_DeliverFormatAll(TheType,TheText); + } + | typeunit T_WSPACE T_ALPHA {ClasseElt_DeliverFormatBase(TheType,TheText);} T_WSPACE attrs T_NEWLINE + +; + +typeunit : T_DEVUNIT {TheType = T_DEVUNIT;} + | T_PACKAGE {TheType = T_PACKAGE;} + | T_NOCDLPACK {TheType = T_NOCDLPACK;} + | T_EXECUTABLE {TheType = T_EXECUTABLE;} + | T_INTERFACE {TheType = T_INTERFACE;} + | T_ENGINE {TheType = T_ENGINE;} + | T_CLIENT {TheType = T_CLIENT;} + | T_SCHEMA {TheType = T_SCHEMA;} + | T_TOOLKIT {TheType = T_TOOLKIT;} + | T_CCL {TheType = T_CCL;} + | T_FRONTAL {TheType = T_FRONTAL ;} + | T_RESOURCE {TheType = T_RESOURCE;} + +; + +attr : + T_ARCHIVE { TheAttrib = T_ARCHIVE;} + | T_CDL { TheAttrib = T_CDL;} + | T_DATAOBJECT { TheAttrib = T_DATAOBJECT;} + | T_DDL { TheAttrib = T_DDL;} + | T_DYNAMIC { TheAttrib = T_DYNAMIC;} + | T_FDDB { TheAttrib = T_FDDB;} + | T_GETRES { TheAttrib = T_GETRES;} + | T_INCLUDES { TheAttrib = T_INCLUDES;} + | T_LIBRARY { TheAttrib = T_LIBRARY;} + | T_SHARED { TheAttrib = T_SHARED;} + | T_SOURCES { TheAttrib = T_SOURCES;} + | T_STATIC { TheAttrib = T_STATIC;} + | T_STUB_CLIENT { TheAttrib = T_STUB_CLIENT;} + | T_STUB_SERVER { TheAttrib = T_STUB_SERVER;} +; + +attrs : + attr {ClasseElt_DeliverFormat(TheAttrib);ClasseElt_EndDeliverFormat();} + | attr {ClasseElt_DeliverFormat(TheAttrib);} T_WSPACE attrs + ; + + diff --git a/src/WOKDeliv/FILES b/src/WOKDeliv/FILES new file mode 100755 index 0000000..92459bc --- /dev/null +++ b/src/WOKDeliv/FILES @@ -0,0 +1,10 @@ +WOKDeliv_CMPLRS.edl +DELIVERY.lex +DELIVERY.yacc +WOKDeliv_CODEGEN.edl +WOKDeliv_ParseDelivery.h +WOKDeliv_ParseDelivery.hxx +WOKDeliv_ParseDelivery.cxx +WOKDeliv_DelivExecSource.tcl +WOKDeliv_FRONTALSCRIPT.edl +WOKDeliv_LDSCRIPT.edl diff --git a/src/WOKDeliv/WOKDeliv.cdl b/src/WOKDeliv/WOKDeliv.cdl new file mode 100755 index 0000000..1f4a57d --- /dev/null +++ b/src/WOKDeliv/WOKDeliv.cdl @@ -0,0 +1,77 @@ +-- File: WOKDeliv.cdl +-- Created: Mon Jul 29 16:46:32 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +package WOKDeliv + + ---Purpose: Describes steps for building delivery units + +uses WOKMake, + WOKStep, + WOKernel, + WOKUtils, + WOKTools, + WOKBuilder, + TColStd, + TCollection + +is + + + class DeliveryList; + + deferred class DeliveryStep; + + class DeliverySource; + + class DeliveryBase; + + class DeliveryGET; + + class DeliveryCopy; + + class DelivBuildSource; + + class DelivBuildArchive; + + class DelivBuildExec; + + class DeliveryOBJSSchema; + + class DeliveryFiles; + + class DeliveryStepList; + + class DeliveryListShared; + + deferred class DeliveryMetaStep; + + class DeliverySOURCES; + + deferred class DeliveryLIB; + + class DeliveryShared; + + class DeliveryArchive; + + class DeliverySTUBClient; + + class DeliveryExecList; + + class DeliveryDATA; + + class DataMapOfParcel instantiates + DataMap from WOKTools(HAsciiString from TCollection, + Parcel from WOKernel, + HAsciiStringHasher from WOKTools); + + + class DataMapOfFiles instantiates + DataMap from WOKTools(HAsciiString from TCollection, + HSequenceOfHAsciiString from TColStd, + HAsciiStringHasher from WOKTools); + +end WOKDeliv; diff --git a/src/WOKDeliv/WOKDeliv_CMPLRS.edl b/src/WOKDeliv/WOKDeliv_CMPLRS.edl new file mode 100755 index 0000000..64ebe2d --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_CMPLRS.edl @@ -0,0 +1,13 @@ +-- File: WOKDeliv_CMPLRS.edl +-- Author: Prestataire Pascal BABIN +-- History: Wed Jan 22 09:26:33 1997 Prestataire Pascal BABIN Creation +-- Copyright: Matra Datavision 1997 + +@ifnotdefined ( %WOKDeliv_CMPLRS_EDL) then +@set %WOKDeliv_CMPLRS_EDL = ""; + +@if ( %Station == "hp" ) then + @string %CMPLRS_C_Options = %CMPLRS_C_Options " -Ae"; +@endif; + +@endif; diff --git a/src/WOKDeliv/WOKDeliv_CODEGEN.edl b/src/WOKDeliv/WOKDeliv_CODEGEN.edl new file mode 100755 index 0000000..c930a7f --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_CODEGEN.edl @@ -0,0 +1,29 @@ +@ifnotdefined ( %WOKDeliv_CODEGEN_EDL) then +@set %WOKDeliv_CODEGEN_EDL = ""; + +@if ( %Station != "wnt" ) then + +@template CODEGEN_LEX_OptLine (%CODEGEN_FlexBisHome) is +$%CODEGEN_FlexBisHome/bin/flex -P -L -8 +@end; + +@template CODEGEN_LEX_CmdLine ( %CODEGEN_FlexBisHome, %Source, %BaseName, %OutputDir ) is +$cd %OutputDir; +$%CODEGEN_FlexBisHome/bin/flex -P%BaseName -L -8 %Source; +@end; + +@else + +@template CODEGEN_LEX_CmdLine ( %Source, %BaseName, %OutputDir ) is +$cd %OutputDir; +$%WOKHOME%/lib/wnt/flex -P%BaseName -L -8 %Source +@end; + +@template CODEGEN_YACC_CmdLine ( %Source, %BaseName, %OutputDir ) is +$cd %OutputDir; +$%WOKHOME%/lib/wnt/bison -d -b %BaseName -p %BaseName %Source +@end; + +@endif; + +@endif; diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cdl b/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cdl new file mode 100755 index 0000000..18259a9 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cdl @@ -0,0 +1,45 @@ +-- File: WOKDeliv_DelivBuildArchive.cdl +-- Created: Wed Aug 14 13:10:53 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DelivBuildArchive from WOKDeliv inherits DeliveryCopy from WOKDeliv + + ---Purpose: Produces archives from deliveries + +uses DevUnit from WOKernel, + Parcel from WOKernel, + File from WOKernel, + Status from WOKMake, + InputFile from WOKMake, + BuildProcess from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DelivBuildArchive from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is redefined protected; + + BuildArchive(me: mutable; aparcel : Parcel from WOKernel; + aunit : DevUnit from WOKernel; + execlist : HSequenceOfInputFile from WOKMake) + returns Boolean + is private; + + CompleteExecList(me:mutable; anexeclist : HSequenceOfInputFile from WOKMake) + is redefined protected; + + +end DelivBuildArchive; diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cxx b/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cxx new file mode 100755 index 0000000..10deafe --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildArchive.cxx @@ -0,0 +1,214 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DelivBuildArchive.cxx +// Created: Wed Aug 14 13:11:49 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +WOKDeliv_DelivBuildArchive::WOKDeliv_DelivBuildArchive(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryCopy(aprocess,aunit,acode,checked,hidden) +{ +} + + +void WOKDeliv_DelivBuildArchive::Execute(const Handle(WOKMake_HSequenceOfInputFile)& infiles) +{ + Handle(WOKernel_DevUnit) thesourceunit; + if (myList.IsNull()) { + myList = ParseCOMPONENTS(T_ARCHIVE); + } + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + Standard_Boolean okexec = Standard_False; + + // SetOutputDir + Handle(WOKernel_DevUnit) parcelunit = GetParcelUnit(Unit(),theParcel,Unit()); + Handle(WOKernel_File) afile = new WOKernel_File(parcelunit, parcelunit->GetFileType(OutputDirTypeName())); + afile->GetPath(); + SetOutputDir(afile->Path()); + + if (!theParcel.IsNull()) { + thesourceunit = Locator()->LocateDevUnit(SubCode()); + okexec = BuildArchive(theParcel,thesourceunit,infiles); + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + + +Standard_Boolean WOKDeliv_DelivBuildArchive::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKBuilder_Entity) result; + Handle(WOKUtils_Path) apath; + + if(!infile->File().IsNull()) + { + apath = infile->File()->Path(); + switch(apath->Extension()) + { + case WOKUtils_ObjectFile: result = new WOKBuilder_ObjectFile(apath); break; + case WOKUtils_ArchiveFile: result = new WOKBuilder_ArchiveLibrary(apath); break; + default: + return Standard_False; + } + + infile->SetBuilderEntity(result); + infile->SetDirectFlag(Standard_True); + return Standard_True; + } + return Standard_False; +} + + + +Standard_Boolean WOKDeliv_DelivBuildArchive::BuildArchive +(const Handle(WOKernel_Parcel)& theParcel, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(WOKMake_HSequenceOfInputFile)& execlist) +{ + Handle(WOKBuilder_HSequenceOfObjectFile) aseq = new WOKBuilder_HSequenceOfObjectFile; + Handle(WOKBuilder_Entity) anent; + Handle(WOKBuilder_ObjectFile) anobject; + Handle(WOKernel_File) libpath; + Handle(WOKernel_File) tmppath; + Handle(TCollection_HAsciiString) libname; + Handle(TCollection_HAsciiString) bidname; + Handle(WOKernel_DevUnit) destunit = GetParcelUnit(Unit(),theParcel,aunit); + if (destunit.IsNull()) return Standard_False; + + Handle(WOKernel_FileType) libtype = destunit->FileTypeBase()->Type("library"); + + Standard_Integer i,j; + + Handle(WOKBuilder_Archiver) ar = new WOKBuilder_Archiver(aunit->Params()); + Handle(WOKUtils_Shell) ashell = Shell(); + + ar->SetShell(ashell); + ashell->Lock(); + + ar->SetOutputDir(OutputDir()); + + for(j=1; j<=execlist->Length(); j++) + { + anobject = Handle(WOKBuilder_ObjectFile)::DownCast(execlist->Value(j)->BuilderEntity()); + if (!anobject.IsNull()) { + aseq->Append(anobject); + } + } + + ar->SetObjectList(aseq); + ar->SetTargetName(aunit->Name()); + + // calcul de la librairie + + switch(ar->Execute()) + { + case WOKBuilder_Success: + ashell->UnLock(); + for(i=1; i<=ar->Produces()->Length(); i++) + { + Handle(WOKBuilder_Entity) outent = ar->Produces()->Value(i); + Handle(WOKMake_OutputFile) outfile; + Handle(WOKUtils_Path) comppath; + Handle(WOKBuilder_Entity) bidon; + + if (outent->Path()->Extension() == WOKUtils_ArchiveFile) { + + Handle(TCollection_HAsciiString) thecomname = new TCollection_HAsciiString("COMMAND"); + Handle(WOKBuilder_Command) comcomp + = new WOKBuilder_Command(thecomname, + aunit->Params()); + + comcomp->SetShell(ashell); + if (comcomp->Compress(outent->Path()) == WOKBuilder_Success) { + aunit->Params().Set("%File",outent->Path()->Name()->ToCString()); + Handle(TCollection_HAsciiString) namecomp = aunit->Params().Eval("COMMAND_CompressName"); + if (!namecomp.IsNull()) { + comppath = new WOKUtils_Path(namecomp); + libpath = new WOKernel_File(comppath->FileName(), destunit, libtype); + + libpath->GetPath(); + + comppath->MoveTo(libpath->Path()); + outfile = new WOKMake_OutputFile(libpath->LocatorName(), libpath,bidon , libpath->Path()); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + outfile->SetProduction(); + + for(j=1; j<=execlist->Length(); j++) { + AddExecDepItem(execlist->Value(j), outfile, Standard_True); + } + } + else { + return Standard_False; + } + } + } + + } + break; + case WOKBuilder_Failed: + ashell->UnLock(); + ErrorMsg << "WOKStep_ArchiveLibrary" + << "Failed : " << libpath->Name() << endm; + return Standard_False; + } + + return Standard_True; +} + +void WOKDeliv_DelivBuildArchive::CompleteExecList(const Handle(WOKMake_HSequenceOfInputFile)& execlist) +{ + if((execlist->Length() != 0) && (myinflow.Extent() > execlist->Length()) && (!mydepmatrix.IsNull())) + { + WOKTools_MapOfHAsciiString amap; + Standard_Integer i; + + for(i=1; i<=execlist->Length();i++) + { + amap.Add(execlist->Value(i)->ID()); + } + + Standard_Boolean found = Standard_False; + for(i=1; i<=myinflow.Extent() && !found; i++) + { + if(!amap.Contains(myinflow(i)->ID())) + { + execlist->Append(myinflow(i)); + found = Standard_True; + } + } + } + + WOKDeliv_DeliveryCopy::CompleteExecList(execlist); +} + diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildExec.cdl b/src/WOKDeliv/WOKDeliv_DelivBuildExec.cdl new file mode 100755 index 0000000..1ad312c --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildExec.cdl @@ -0,0 +1,46 @@ +-- File: WOKDeliv_DelivBuildExec.cdl +-- Created: Tue Oct 29 14:54:50 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DelivBuildExec from WOKDeliv inherits DeliveryCopy from WOKDeliv + + ---Purpose: Produces executables from deliveries + +uses DevUnit from WOKernel, + Parcel from WOKernel, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + BuildProcess from WOKMake, + 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) + returns mutable DelivBuildExec from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is redefined protected; + + MakeldFile(me: mutable; aparcel : Parcel from WOKernel; + asourceunit : DevUnit from WOKernel; + adestunit : DevUnit from WOKernel; + namexec : HAsciiString from TCollection; + execlist : HSequenceOfInputFile from WOKMake) + returns Boolean + is private; + + + VisibleParcels(me) + returns HSequenceOfHAsciiString from TColStd; + +end DelivBuildExec; diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildExec.cxx b/src/WOKDeliv/WOKDeliv_DelivBuildExec.cxx new file mode 100755 index 0000000..7502064 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildExec.cxx @@ -0,0 +1,266 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DelivBuildExec.cxx +// Created: Tue Oct 29 14:56:11 1996 +// Author: Arnaud BOUZY +// + + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +WOKDeliv_DelivBuildExec::WOKDeliv_DelivBuildExec(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryCopy(aprocess,aunit,acode,checked,hidden) +{ +} + + +void WOKDeliv_DelivBuildExec::Execute(const Handle(WOKMake_HSequenceOfInputFile)& infiles) +{ + WOKDeliv_DeliveryCopy::Execute(infiles); + Handle(WOKernel_DevUnit) thesourceunit; + if (myList.IsNull()) { + myList = ParseCOMPONENTS(T_DYNAMIC); + } + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + Standard_Boolean okexec = Standard_False; + + if (!theParcel.IsNull()) { + // SetOutputDir + Handle(WOKernel_DevUnit) parcelunit = GetParcelUnit(Unit(),theParcel,Unit()); + Handle(WOKernel_File) afile = new WOKernel_File(parcelunit, parcelunit->GetFileType(OutputDirTypeName())); + afile->GetPath(); + SetOutputDir(afile->Path()); + + Handle(TCollection_HAsciiString) nameunit = SubCode()->Token("_",1); + Handle(TCollection_HAsciiString) nameexec = SubCode()->Token("_",2); + thesourceunit = Locator()->LocateDevUnit(nameunit); + if (nameexec->IsEmpty()) { // Engine + nameexec = thesourceunit->Name(); + Handle(WOKernel_DevUnit) destunit = GetParcelUnit(Unit(),theParcel,thesourceunit); + okexec = MakeldFile(theParcel,thesourceunit,destunit,nameexec,infiles); + } + else { + okexec = Standard_True; + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } + } +} + + + +Standard_Boolean WOKDeliv_DelivBuildExec::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + if(!infile->File().IsNull()) { + return Standard_True; + } + return Standard_False; +} + + + +Standard_Boolean WOKDeliv_DelivBuildExec::MakeldFile +(const Handle(WOKernel_Parcel)& theParcel, + const Handle(WOKernel_DevUnit)& thesourceunit, + const Handle(WOKernel_DevUnit)& thedestunit, + const Handle(TCollection_HAsciiString)& nameexec, + const Handle(WOKMake_HSequenceOfInputFile)& infiles) +{ + Standard_Boolean okexec = Standard_True; + Handle(WOKBuilder_Entity) bidon; + + // Find all parcels involved + + Handle(TColStd_HSequenceOfHAsciiString) thevisib = VisibleParcels(); + + // Locate resulting file + + Handle(TCollection_HAsciiString) ldname = new TCollection_HAsciiString(nameexec); + ldname->AssignCat(".ldt"); + Handle(WOKernel_File) resfileld = new WOKernel_File(ldname, + thedestunit, + thedestunit->GetFileType("library")); + resfileld->GetPath(); + + // Write template file + + Handle(TCollection_HAsciiString) nameedl = new TCollection_HAsciiString("WOKDeliv_LDSCRIPT.edl"); + Unit()->Params().LoadFile(nameedl); + + Handle(EDL_API) anapi = new EDL_API(); + if (anapi->OpenFile("MYFILE",resfileld->Path()->Name()->ToCString()) != EDL_NORMAL) { + ErrorMsg << "WOKDeliv_DelivBuilExec::Execute" + << "Cannot open file " << resfileld->Path()->Name() << endm; + okexec = Standard_False; + } + else { + Unit()->Params().Set("%EngineName",thedestunit->Name()->ToCString()); + + Handle(TCollection_HAsciiString) curval = Unit()->Params().Eval("WOKDeliv_LDInit"); + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + Handle(TCollection_HAsciiString) curhome; + + Handle(TCollection_HAsciiString) apref = thesourceunit->Params().Eval("%ENV_EngineLoadPath"); + if (!apref.IsNull()) { + Unit()->Params().Set("%Value",apref->ToCString()); + Handle(TCollection_HAsciiString) prevld = Unit()->Params().Eval("WOKDeliv_AddingValue"); + anapi->AddVariable("%MYVAR",prevld->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + } + curval = Unit()->Params().Eval("WOKDeliv_MAKELDInit"); + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + Standard_Integer i; + for (i=1; i<= thevisib->Length(); i++) { + Unit()->Params().Set("%UlName",thevisib->Value(i)->ToCString()); + if (i == 1) { + curval = Unit()->Params().Eval("WOKDeliv_FirstValue"); + } + else { + Unit()->Params().Set("%PreviousVal",curval->ToCString()); + curval = Unit()->Params().Eval("WOKDeliv_NextValue"); + } + curhome = Unit()->Params().Eval("WOKDeliv_DeclHome"); + anapi->AddVariable("%MYVAR",curhome->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + } + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + curval = Unit()->Params().Eval("WOKDeliv_LDEnd"); + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + + curval = Unit()->Params().Eval("WOKDeliv_MAKELDList"); + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + for (i=1; i<= thevisib->Length(); i++) { + Unit()->Params().Set("%UlName",thevisib->Value(i)->ToCString()); + curhome = Unit()->Params().Eval("WOKDeliv_AddULList"); + anapi->AddVariable("%MYVAR",curhome->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + } + curval = Unit()->Params().Eval("WOKDeliv_EndLDList"); + anapi->AddVariable("%MYVAR",curval->ToCString()); + anapi->WriteFile("MYFILE","%MYVAR"); + + + anapi->CloseFile("MYFILE"); + + + Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(resfileld->LocatorName(), + resfileld, + bidon, + resfileld->Path()); + outfile->SetProduction(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + for (i=1; i <= infiles->Length(); i++) { + AddExecDepItem(infiles->Value(i),outfile,Standard_True); + } + + } + return okexec; +} + + + +Handle(TColStd_HSequenceOfHAsciiString) WOKDeliv_DelivBuildExec::VisibleParcels() const +{ + Handle(TColStd_HSequenceOfHAsciiString) thevisib = new TColStd_HSequenceOfHAsciiString(); + if (myList.IsNull()) return thevisib; + Handle(WOKernel_Session) theSession = Unit()->Session(); + + Handle(TCollection_HAsciiString) thename; + + Handle(TCollection_HAsciiString) thewb = Unit()->Nesting(); + + Handle(TCollection_HAsciiString) thews = theSession->GetWorkbench(thewb)->Nesting(); + + Handle(TCollection_HAsciiString) thef = theSession->GetWorkshop(thews)->Nesting(); + Handle(TCollection_HAsciiString) thewh = theSession->GetFactory(thef)->Warehouse(); + Handle(WOKernel_Warehouse) theWarehouse = theSession->GetWarehouse(thewh); + + WOKDeliv_DataMapOfParcel parcelmap; + Handle(TColStd_HSequenceOfHAsciiString) theparcs = theWarehouse->Parcels(); + for (Standard_Integer i=1; i<= theparcs->Length(); i++) { + Handle(WOKernel_Parcel) theparcel = theSession->GetParcel(theparcs->Value(i)); + if (!theparcel.IsNull()) { + parcelmap.Bind(theparcel->Name(),theparcel); + } + } + + Handle(WOKernel_Parcel) theparcel; + + WOKTools_MapOfHAsciiString tofind,found; + tofind.Add(myList->GetName()); + while (!tofind.IsEmpty()) { + WOKTools_MapIteratorOfMapOfHAsciiString it(tofind); + thename = it.Key(); + tofind.Remove(thename); + if (parcelmap.IsBound(thename)) { + theparcel = parcelmap(thename); + theparcel->Open(); + thevisib->Append(theparcel->Name()); + found.Add(thename); + Handle(TCollection_HAsciiString) deliv = theparcel->Delivery(); + Handle(WOKernel_DevUnit) thedeliv = theSession->GetDevUnit(theparcel->NestedUniqueName(deliv)); + if (!thedeliv.IsNull()) { + thedeliv->Open(); + Handle(TCollection_HAsciiString) allreq = thedeliv->EvalParameter("AllRequisites",Standard_False); + if (allreq.IsNull()) { + WarningMsg << "WOKDeliv_DelivBuildExec::VisibleParcels" + << "Unable to get dependencies from parcel : << theparcel->Name()->ToCString()" << endm; + WarningMsg << "WOKDeliv_DelivBuildExec::VisibleParcels" + << "Missing parameter AllRequisites" << endm; + } + else { + Standard_Integer ind=1; + thename = allreq; + while (!thename->IsEmpty()) { + thename = allreq->Token(" ",ind); + ind++; + if (!thename->IsEmpty()) { + if (!found.Contains(thename)) { + tofind.Add(thename); + } + } + } + } + } + else { + ErrorMsg << "WOKDeliv_DelivBuildExec::VisibleParcels" + << " Unable to get delivery " << deliv + << " from parcel " << theparcel->Name() << endm; + } + } + } + return thevisib; +} + diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildSource.cdl b/src/WOKDeliv/WOKDeliv_DelivBuildSource.cdl new file mode 100755 index 0000000..6540da4 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildSource.cdl @@ -0,0 +1,35 @@ +-- File: WOKDeliv_DelivBuildSource.cdl +-- Created: Tue Dec 31 13:14:55 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DelivBuildSource from WOKDeliv inherits DeliveryCopy from WOKDeliv + + ---Purpose: Produces Sources for a unit + +uses DevUnit from WOKernel, + Parcel from WOKernel, + File from WOKernel, + Status from WOKMake, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DelivBuildSource from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined private; + + AdmFileType(me) + returns HAsciiString from TCollection + is redefined; + +end DelivBuildSource; diff --git a/src/WOKDeliv/WOKDeliv_DelivBuildSource.cxx b/src/WOKDeliv/WOKDeliv_DelivBuildSource.cxx new file mode 100755 index 0000000..6169917 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivBuildSource.cxx @@ -0,0 +1,114 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DelivBuildSource.cxx +// Created: Tue Dec 31 13:17:24 1996 +// Author: Arnaud BOUZY +// + + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +WOKDeliv_DelivBuildSource::WOKDeliv_DelivBuildSource(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryCopy(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DelivBuildSource::Execute(const Handle(WOKMake_HSequenceOfInputFile)& infiles) +{ + Handle(TCollection_HAsciiString) unitname = SubCode(); + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(unitname); + if (thesourceunit.IsNull()) { + ErrorMsg << "WOKDeliv_DelivBuildSource" + << "Enable to locate unit " << unitname << endm; + SetFailed(); + } + else { + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + Handle(TCollection_HAsciiString) typunit = thesourceunit->Type(); + Handle(WOKernel_DevUnit) thedestunit = GetParcelUnit(Unit(),theParcel,thesourceunit); + if (!thedestunit.IsNull()) { + Handle(TCollection_HAsciiString) filename = new TCollection_HAsciiString(unitname->ToCString()); + filename->AssignCat("."); + filename->AssignCat(typunit); + Handle(WOKernel_File) basefile = new WOKernel_File(filename, + thedestunit, + thedestunit->GetFileType("source")); + basefile->GetPath(); + Handle(TCollection_HAsciiString) cmdname = new TCollection_HAsciiString("WOKDeliv_DelivExecSource::Process"); + WOKUtils_Trigger execute; + Handle(TCollection_HAsciiString) tclfilename = new TCollection_HAsciiString("WOKDeliv_DelivExecSource.tcl"); + + execute(tclfilename, Unit()->Params(), WOKTools_TclInterp) << endt; + + Handle(TCollection_HAsciiString) result; + execute(cmdname) << thesourceunit->UserPathName() + << basefile->Path()->Name() + << endt >> result; + switch(execute.Status()) { + case WOKUtils_Unknown: + case WOKUtils_NotSetted: + { + ErrorMsg << "WOKDeliv_DelivBuildSource::Execute" + << "Unable to execute source on unit " << unitname << endm; + SetFailed(); + } + break; + case WOKUtils_Succeeded: + { + WOK_TRACE { + VerboseMsg("WOK_DELIV") << "WOKDeliv_DelivBuildSource::Execute" + << "File " << result << " created." << endm; + } + Handle(WOKUtils_Path) pathres = new WOKUtils_Path(result); + Handle(WOKernel_File) fileres = new WOKernel_File(pathres->FileName(), + thedestunit, + thedestunit->GetFileType("source")); + fileres->GetPath(); + Handle(WOKBuilder_Entity) bidon; + Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(fileres->LocatorName(), + fileres, + bidon, + fileres->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + for (Standard_Integer i=1; i<= infiles->Length(); i++ ) { + AddExecDepItem(infiles->Value(i),outfile,Standard_True); + } + SetSucceeded(); + } + break; + case WOKUtils_Failed: + ErrorMsg << "WOKDeliv_DelivBuildSource::Execute" + << "Failed to execute source on unit " << unitname << endm; + SetFailed(); + break; + } + } + } + } + } +} + +Handle(TCollection_HAsciiString) WOKDeliv_DelivBuildSource::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) adm = new TCollection_HAsciiString((char*)ADMFILE); + return adm; +} diff --git a/src/WOKDeliv/WOKDeliv_DelivExecSource.tcl b/src/WOKDeliv/WOKDeliv_DelivExecSource.tcl new file mode 100755 index 0000000..4c24f11 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DelivExecSource.tcl @@ -0,0 +1,4 @@ +proc WOKDeliv_DelivExecSource::Process {unitname destination} { + upack -c $unitname -o $destination -t source + return $destination.Z +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryArchive.cdl b/src/WOKDeliv/WOKDeliv_DeliveryArchive.cdl new file mode 100755 index 0000000..4a45cda --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryArchive.cdl @@ -0,0 +1,40 @@ +-- File: WOKDeliv_DeliveryArchive.cdl +-- Created: Tue Aug 13 14:30:42 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliveryArchive from WOKDeliv inherits DeliveryLIB from WOKDeliv + + ---Purpose: Process Archives for delivery units + +uses DevUnit from WOKernel, + Step from WOKMake, + BuildProcess from WOKMake, + InputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryArchive from WOKDeliv; + + SetList(me:mutable); + + NeedsObjects(me) + returns Boolean; + + CreateSubStep(me; asource : DevUnit from WOKernel; needobj : Boolean) + returns Step from WOKMake; + + ComputeOutputLIB(me: mutable; asource : DevUnit from WOKernel; + inComp : InputFile from WOKMake); + + IsAvailable(me; asource : DevUnit from WOKernel) + returns Boolean; + +end DeliveryArchive; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryArchive.cxx b/src/WOKDeliv/WOKDeliv_DeliveryArchive.cxx new file mode 100755 index 0000000..7513297 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryArchive.cxx @@ -0,0 +1,49 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryArchive.cxx +// Created: Tue Aug 13 14:33:27 1996 +// Author: Arnaud BOUZY +// + + +#include +#include +#include +#include +#include +#include +#include +#include + +WOKDeliv_DeliveryArchive::WOKDeliv_DeliveryArchive(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) + : WOKDeliv_DeliveryLIB(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryArchive::SetList() +{ + myList = ParseCOMPONENTS(T_ARCHIVE); +} + +Standard_Boolean WOKDeliv_DeliveryArchive::NeedsObjects() const +{ + return Standard_True; +} + + +void WOKDeliv_DeliveryArchive::ComputeOutputLIB(const Handle(WOKernel_DevUnit)& thesourceunit, + const Handle(WOKMake_InputFile)& inCOMP) +{ +} + + +Standard_Boolean WOKDeliv_DeliveryArchive::IsAvailable(const Handle(WOKernel_DevUnit)& asource) const +{ + if (WOKernel_IsPackage(asource)) return Standard_True; + if (WOKernel_IsNocdlpack(asource)) return Standard_True; + if (WOKernel_IsSchema(asource)) return Standard_True; + return Standard_False; +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryBase.cdl b/src/WOKDeliv/WOKDeliv_DeliveryBase.cdl new file mode 100755 index 0000000..d344608 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryBase.cdl @@ -0,0 +1,53 @@ +-- File: WOKDeliv_DeliveryBase.cdl +-- Created: Tue Mar 26 15:36:09 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliveryBase from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process base for delivery units + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + Status from WOKMake, + Param from WOKUtils, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection, + MapOfHAsciiString from WOKTools + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryBase from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + GetRequisites(me; totreat,treated : in out MapOfHAsciiString from WOKTools; + params : in out Param from WOKUtils) + returns Boolean + is private; + + GetVersionFromParcel(me; deliveryname : HAsciiString from TCollection; + parcelname : HAsciiString from TCollection) + returns HAsciiString from TCollection + is private; + + Make(me:mutable) + returns Status from WOKMake is redefined; + +end DeliveryBase; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryBase.cxx b/src/WOKDeliv/WOKDeliv_DeliveryBase.cxx new file mode 100755 index 0000000..deff086 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryBase.cxx @@ -0,0 +1,509 @@ +// File: WOKDeliv_DeliveryBase.cxx +// Created: Tue Mar 26 16:12:47 1996 +// Author: Arnaud BOUZY +// + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + + +WOKDeliv_DeliveryBase::WOKDeliv_DeliveryBase(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) + : WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryBase::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + + Standard_Boolean okexec = Standard_True; + if (!myList.IsNull()) { + InfoMsg << "WOKDeliv_DeliveryBase" << "Process UL : " << myList->GetName()->ToCString() << endm; + Handle(TCollection_HAsciiString) thename = myList->GetName(); + Handle(WOKernel_Warehouse) theWarehouse; + Handle(WOKernel_Session) theSession = Unit()->Session(); + + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),thename); + if (!theParcel.IsNull()) { + InfoMsg << "WOKDeliv_DeliveryBase" << "Parcel already created : update" << endm; + theParcel->Open(); + theWarehouse = theSession->GetWarehouse(theParcel->Nesting()); + } + else { + // creation of parcel tree + Handle(TCollection_HAsciiString) thewb = Unit()->Nesting(); + Handle(WOKernel_Workbench) theworkbench = theSession->GetWorkbench(thewb); + Handle(TCollection_HAsciiString) thews = theworkbench->Nesting(); + Handle(WOKernel_Workshop) theworkshop = theSession->GetWorkshop(thews); + Handle(TCollection_HAsciiString) thef = theworkshop->Nesting(); + Handle(WOKernel_Factory) thefactory = theSession->GetFactory(thef); + Handle(TCollection_HAsciiString) thewh = thefactory->Warehouse(); + theWarehouse = theSession->GetWarehouse(thewh); + theParcel = new WOKernel_Parcel(thename, + theWarehouse); + Handle(WOKUtils_HSequenceOfParamItem) params = new WOKUtils_HSequenceOfParamItem(); + + + + // Set Home parameter + Handle(TCollection_HAsciiString) defaulthome = theWarehouse->EvalParameter("Home"); + Handle(WOKUtils_Path) homepath = new WOKUtils_Path(defaulthome,thename); + Handle(TCollection_HAsciiString) namehome = new TCollection_HAsciiString("%"); + namehome->AssignCat(thename); + namehome->AssignCat("_Home"); + WOKUtils_ParamItem itemhome(namehome,homepath->Name()); + params->Append(itemhome); + + // Set Delivery parameter + + Handle(TCollection_HAsciiString) namedel = new TCollection_HAsciiString("%"); + namedel->AssignCat(thename); + namedel->AssignCat("_Delivery"); + WOKUtils_ParamItem itemdel(namedel,Unit()->Name()); + params->Append(itemdel); + + Handle(WOKUtils_HSequenceOfParamItem) buildpars = theParcel->BuildParameters(params,Standard_True); + + theParcel->Build(buildpars); + theWarehouse->Close(); + theWarehouse->Open(); + theWarehouse->AddParcel(theParcel); + } + + + // base creation + // File DELIVERIES + + Handle(WOKernel_DevUnit) parcelunit = GetParcelUnit(Unit(),theParcel,Unit()); + + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + if (infileCOMPONENTS.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryBase::Execute" + << "Missing File COMPONENTS, Check file FILES" << endm; + SetFailed(); + return; + } + + WOKUtils_Param parcelparam = theParcel->Params(); + + Handle(WOKBuilder_Entity) bidon; + Handle(WOKMake_InputFile) infile; + Handle(WOKMake_OutputFile) outfile; + + Handle(WOKernel_File) DELIVERIESFile = new WOKernel_File(new TCollection_HAsciiString("DELIVERIES"),parcelunit,parcelunit->GetFileType("DELIVERIES")); + DELIVERIESFile->GetPath(); + Handle(TCollection_HAsciiString) delivfilename = DELIVERIESFile->Path()->Name(); + ofstream delstream(delivfilename->ToCString(), ios::out); + if (!delstream) { + ErrorMsg << "WOKDeliv_DeliveryBase::Execute" << "Could not open " << delivfilename->ToCString() << endm; + SetFailed(); + okexec = Standard_False; + } + else { + delstream << Unit()->Name()->ToCString() << endl; + delstream.close(); + outfile = new WOKMake_OutputFile(DELIVERIESFile->LocatorName(), + DELIVERIESFile, + bidon, + DELIVERIESFile->Path()); + outfile->SetProduction(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + // Copying files COMPONENTS, [Patchs], [ReleaseNotes] + + for (Standard_Integer i=1; i<= myinflow.Extent(); i++) { + infile = myinflow(i); + Handle(WOKernel_File) thefile = infile->File(); + if (!strcmp(thefile->Name()->ToCString(),"COMPONENTS")) { + Handle(WOKernel_File) COMPONENTSFile = new WOKernel_File(new TCollection_HAsciiString("COMPONENTS"),parcelunit,parcelunit->GetFileType("COMPONENTSFile")); + COMPONENTSFile->GetPath(); + outfile = new WOKMake_OutputFile(COMPONENTSFile->LocatorName(), + COMPONENTSFile, + bidon, + COMPONENTSFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infile,outfile,Standard_True); + if (!CopyAFile(Unit(),thefile,COMPONENTSFile)) okexec = Standard_False; + } + else if (!strcmp(thefile->Name()->ToCString(),"Patchs")) { + Handle(WOKernel_File) PatchsFile = new WOKernel_File(new TCollection_HAsciiString("Patchs"),parcelunit,parcelunit->GetFileType("patchs")); + PatchsFile->GetPath(); + outfile = new WOKMake_OutputFile(PatchsFile->LocatorName(), + PatchsFile, + bidon, + PatchsFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infile,outfile,Standard_True); + if (!CopyAFile(Unit(),thefile,PatchsFile)) okexec = Standard_False; + } + if (!strcmp(thefile->Name()->ToCString(),"ReleaseNotes")) { + Handle(WOKernel_File) ReleaseFile = new WOKernel_File(new TCollection_HAsciiString("ReleaseNotes"),parcelunit,parcelunit->GetFileType("releasenote")); + ReleaseFile->GetPath(); + outfile = new WOKMake_OutputFile(ReleaseFile->LocatorName(), + ReleaseFile, + bidon, + ReleaseFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infile,outfile,Standard_True); + if (!CopyAFile(Unit(),thefile,ReleaseFile)) okexec = Standard_False; + + } + } + + // creation of Define file and depul File + + + Handle(WOKernel_File) DefineFile = new WOKernel_File(new TCollection_HAsciiString("DEFINE"),parcelunit,parcelunit->GetFileType("DefineFile")); + DefineFile->GetPath(); + Handle(WOKUtils_Path) pathreq = DefineFile->Path(); + WOKTools_MapOfHAsciiString totreat,allreqmap; + + Handle(WOKernel_File) depulFile = new WOKernel_File(parcelunit,parcelunit->GetFileType("DepULFile")); + depulFile->GetPath(); + Handle(TCollection_HAsciiString) namedepulfilename = depulFile->Path()->Name(); + ofstream depulstream(namedepulfilename->ToCString(), ios::out); + if (!depulstream) { + ErrorMsg << "WOKDeliv_DeliveryBase::Execute" << "Could not open " << namedepulfilename->ToCString() << endm; + SetFailed(); + okexec = Standard_False; + } + + + WOKTools_MapIteratorOfMapOfHAsciiString itreq(myList->GetRequireMap()); + TCollection_AsciiString thereqstr; + while (itreq.More()) { + thereqstr += itreq.Key()->ToCString(); + thereqstr += " "; + Handle(TCollection_HAsciiString) fullname = GetFullParcelName(itreq.Key()); + if (!fullname.IsNull()) { + totreat.Add(fullname); + if (depulstream) { + Handle(TCollection_HAsciiString) versparcel = GetVersionFromParcel(itreq.Key(),fullname); + depulstream << versparcel->ToCString() << endl; + } + } + else { + okexec = Standard_False; + } + itreq.Next(); + } + if (depulstream) { + depulstream.close(); + outfile = new WOKMake_OutputFile(depulFile->LocatorName(), + depulFile, + bidon, + depulFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + WOKUtils_Param thepars = Unit()->Params(); + Handle(TCollection_HAsciiString) thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_Requires"); + thepars.Set(thenamevar->ToCString(),thereqstr.ToCString()); + + Handle(TColStd_HSequenceOfHAsciiString) thevars = new TColStd_HSequenceOfHAsciiString(); + thevars->Append(thenamevar); + + WOKUtils_Param par; + par.SetSearchDirectories(theParcel->Params().SearchDirectories()); + while (!totreat.IsEmpty()) { + okexec = okexec && GetRequisites(totreat,allreqmap,par); + } + TCollection_AsciiString theallreqstr; + WOKTools_MapIteratorOfMapOfHAsciiString itallreq(allreqmap); + while (itallreq.More()) { + theallreqstr += itallreq.Key()->ToCString(); + theallreqstr += " "; + itallreq.Next(); + } + thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_AllRequisites"); + thepars.Set(thenamevar->ToCString(),theallreqstr.ToCString()); + + thevars->Append(thenamevar); + + thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_Parcel"); + thepars.Set(thenamevar->ToCString(),theParcel->Name()->ToCString()); + + thevars->Append(thenamevar); + + // Treat Put Path/Lib/Include + thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_PutPath"); + if (myList->IsPutPath()) { + thepars.Set(thenamevar->ToCString(),"yes"); + } + else { + thepars.Set(thenamevar->ToCString(),"no"); + } + thevars->Append(thenamevar); + + + thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_PutLib"); + if (myList->IsPutLib()) { + thepars.Set(thenamevar->ToCString(),"yes"); + } + else { + thepars.Set(thenamevar->ToCString(),"no"); + } + thevars->Append(thenamevar); + + thenamevar = new TCollection_HAsciiString("%"); + thenamevar->AssignCat(Unit()->Name()); + thenamevar->AssignCat("_PutInclude"); + if (myList->IsPutInclude()) { + thepars.Set(thenamevar->ToCString(),"yes"); + } + else { + thepars.Set(thenamevar->ToCString(),"no"); + } + thevars->Append(thenamevar); + + + thepars.Write(pathreq,thevars); + + outfile = new WOKMake_OutputFile(DefineFile->LocatorName(), + DefineFile, + bidon, + DefineFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + + + + // creation of file .NAME + + Handle(WOKernel_File) NAMEFile = new WOKernel_File(new TCollection_HAsciiString("NAME"),parcelunit,parcelunit->GetFileType("NameFile")); + NAMEFile->GetPath(); + Handle(TCollection_HAsciiString) namefilename = NAMEFile->Path()->Name(); + ofstream namestream(namefilename->ToCString(), ios::out); + if (!namestream) { + ErrorMsg << "WOKDeliv_DeliveryBase::Execute" << "Could not open " << namefilename->ToCString() << endm; + SetFailed(); + okexec = Standard_False; + } + else { + namestream << myList->GetName()->ToCString() << endl; + namestream.close(); + outfile = new WOKMake_OutputFile(NAMEFile->LocatorName(), + NAMEFile, + bidon, + NAMEFile->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + // creation of file .allcomponents + + Handle(TCollection_HAsciiString) allcmpname = new TCollection_HAsciiString(Unit()->Name()); + allcmpname->AssignCat(parcelparam.Eval("%FILENAME_AllComponentsSuffix")); + Handle(WOKernel_File) allcomps = new WOKernel_File(allcmpname, theParcel, theParcel->GetFileType("UnitListFile")); + allcomps->GetPath(); + ofstream cmpstream(allcomps->Path()->Name()->ToCString(), ios::out); + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryBase::Execute" << "cannot locate unit : " << itpck.Key()->ToCString() << endm; + SetFailed(); + okexec = Standard_False; + } + else { + cmpstream << thesourceunit->TypeCode() << " " << itpck.Key()->ToCString() << "\n"; + } + itpck.Next(); + } + // add delivery unit itself + cmpstream << Unit()->TypeCode() << " " << Unit()->Name()->ToCString() << "\n"; + + cmpstream.close(); + + outfile = new WOKMake_OutputFile(allcomps->LocatorName(), + allcomps, + bidon, + allcomps->Path()); + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + + + theParcel->Close(); + theParcel->Open(); + + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } + + } + else { + SetFailed(); + } +} + + +Standard_Boolean WOKDeliv_DeliveryBase::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->TypeName()->ToCString(), "source")) { + return Standard_True; + } + + return Standard_False; + +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryBase::GetVersionFromParcel(const Handle(TCollection_HAsciiString)& delivname, const Handle(TCollection_HAsciiString)& parcelname) const +{ + Handle(WOKernel_Parcel) theparcel = GetParcel(Unit(),parcelname); + if (!theparcel.IsNull()) { + theparcel->Open(); + Handle(WOKernel_DevUnit) thedeliv; + Handle(WOKernel_Session) theSession = Unit()->Session(); + Handle(TColStd_HSequenceOfHAsciiString) thenames = theparcel->Units(); + for (Standard_Integer i=1; (i<= thenames->Length()) && thedeliv.IsNull(); i++) { + thedeliv = theSession->GetDevUnit(thenames->Value(i)); + if (!thedeliv->Name()->IsSameString(delivname)) { + thedeliv.Nullify(); + } + } + + if (!thedeliv.IsNull()) { + Handle(WOKernel_File) VersionFile = new WOKernel_File(new TCollection_HAsciiString("bidon"),thedeliv,thedeliv->GetFileType("VersionFile")); + VersionFile->GetPath(); + Handle(TCollection_HAsciiString) nameversionfilename = VersionFile->Path()->Name(); + ifstream versionstream(nameversionfilename->ToCString(), ios::in); + if (versionstream) { + char fullname[200]; + versionstream >> fullname; + Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString(fullname); + versionstream.close(); + return res; + } + } + } + return parcelname; +} + + +Standard_Boolean WOKDeliv_DeliveryBase::GetRequisites(WOKTools_MapOfHAsciiString& totreat, + WOKTools_MapOfHAsciiString& treated, + WOKUtils_Param& thepar) const +{ + Standard_Boolean okexec = Standard_True; + WOKTools_MapIteratorOfMapOfHAsciiString it(totreat); + if (it.More()) { + Handle(TCollection_HAsciiString) current = it.Key(); + Handle(WOKernel_Parcel) theparcel = GetParcel(Unit(),current); + totreat.Remove(current); + if (!theparcel.IsNull()) { + theparcel->Open(); + treated.Add(current); + TCollection_AsciiString namevar = "%"; + namevar += theparcel->EvalParameter("Delivery")->ToCString(); + namevar += "_AllRequisites"; + Handle(TColStd_HSequenceOfAsciiString) searchdir = new TColStd_HSequenceOfAsciiString(); + for (Standard_Integer i=1; i<=thepar.SearchDirectories()->Length(); i++) { + searchdir->Append(thepar.SearchDirectories()->Value(i)); + } + searchdir->Append(theparcel->Params().SearchDirectories()); + thepar.SetSearchDirectories(searchdir); + Handle(TCollection_HAsciiString) allreq = thepar.Eval(namevar.ToCString()); + if (!allreq.IsNull()) { + Handle(TCollection_HAsciiString) current; + Standard_Boolean finished = allreq->IsEmpty(); + Standard_Integer ntok = 1; + while (!finished) { + current = allreq->Token(" ",ntok); + ntok++; + if (current->IsEmpty()) { + finished = Standard_True; + } + else { + treated.Add(current); + } + } + } + } + else { + okexec = Standard_False; + } + } + return okexec; +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryBase::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)ADMFILE); + return result; +} + +WOKMake_Status WOKDeliv_DeliveryBase::Make() +{ + if (IsToExecute()) { + if (myOutLocator.IsNull()) { + if (myList.IsNull()) { + myList = ParseCOMPONENTS(T_BASE); + DefineOutLocator(); + } + } + } + return WOKMake_Step::Make(); +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryCopy.cdl b/src/WOKDeliv/WOKDeliv_DeliveryCopy.cdl new file mode 100755 index 0000000..79e9e42 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryCopy.cdl @@ -0,0 +1,41 @@ +-- File: WOKDeliv_DeliveryCopy.cdl +-- Created: Tue Aug 6 11:20:10 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DeliveryCopy from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process cdl for delivery units + +uses DevUnit from WOKernel, + File from WOKernel, + Status from WOKMake, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryCopy from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is protected; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + Make(me:mutable) + returns Status from WOKMake is redefined; + + +end DeliveryCopy; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryCopy.cxx b/src/WOKDeliv/WOKDeliv_DeliveryCopy.cxx new file mode 100755 index 0000000..fb5ab63 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryCopy.cxx @@ -0,0 +1,142 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryCopy.cxx +// Created: Tue Aug 6 11:22:00 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +WOKDeliv_DeliveryCopy::WOKDeliv_DeliveryCopy(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryCopy::Execute(const Handle(WOKMake_HSequenceOfInputFile)& infiles) { + if (myList.IsNull()) { + myList = ParseCOMPONENTS(T_BASE); + } + Standard_Boolean okexec = Standard_False; + Handle(WOKBuilder_Entity) bidon; + Handle(WOKMake_OutputFile) outfile; + Handle(WOKernel_File) fileout; + + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + Handle(WOKernel_Session) theSession = Unit()->Session(); + for (Standard_Integer i=1; i<= infiles->Length(); i++) { + Handle(WOKernel_File) theinfile = infiles->Value(i)->File(); + Handle(TCollection_HAsciiString) nest = theinfile->Nesting(); + Handle(WOKernel_DevUnit) thesourceunit = theSession->GetDevUnit(nest); + if (!thesourceunit.IsNull()) { + Handle(WOKernel_DevUnit) thedestunit = GetParcelUnit(Unit(),theParcel,thesourceunit); + if (!thedestunit.IsNull()) { + Handle(WOKernel_FileType) outtype = thedestunit->FileTypeBase()->Type(theinfile->TypeName()->ToCString()); + if (theinfile->Type()->IsFileDependent()) { + fileout = new WOKernel_File(theinfile->Name(), + thedestunit, + outtype); + } + else { + fileout = new WOKernel_File(thedestunit, + outtype); + } + fileout->GetPath(); + outfile = + new WOKMake_OutputFile(fileout->LocatorName(), + fileout, + bidon, + fileout->Path()); + outfile->SetProduction(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infiles->Value(i),outfile,Standard_True); + okexec = okexec && CopyAFile(Unit(),theinfile,fileout); + } + } + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryCopy::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + } + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + +//======================================================================= +//function : HandleInputFile +//purpose : +//======================================================================= +Standard_Boolean WOKDeliv_DeliveryCopy::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + const Handle(WOKernel_File)& file = infile->File(); + if(file.IsNull()) return Standard_False; + + Standard_CString atypename = file->TypeName()->ToCString(); + Standard_Boolean isadm = Standard_False; + + if(!strcmp(atypename, "stadmfile")) isadm = Standard_True; + if(!isadm) if(!strcmp(atypename, "dbadmfile")) isadm = Standard_True; + if(!isadm) if(!strcmp(atypename, "admfile")) isadm = Standard_True; + + if(isadm) + { + Handle(TCollection_HAsciiString) extens = file->Path()->ExtensionName(); + Standard_CString anext = extens->ToCString(); + if(!strcmp(anext, ".In")) return Standard_False; + if(!strcmp(anext, ".Out")) return Standard_False; + if(!strcmp(anext, ".Dep")) return Standard_False; + } + + return Standard_True; +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryCopy::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) adm = new TCollection_HAsciiString((char*)ADMFILE); + static Handle(TCollection_HAsciiString) dbadm = new TCollection_HAsciiString((char*)DBADMFILE); + static Handle(TCollection_HAsciiString) stadm = new TCollection_HAsciiString((char*)STADMFILE); + + if (!strcmp(Code()->ToCString(),"cdl.copy")) return adm; + if (!strcmp(Code()->ToCString(),"inc.copy")) return dbadm; + return stadm; +} + +WOKMake_Status WOKDeliv_DeliveryCopy::Make() +{ + if (IsToExecute()) { + if (myOutLocator.IsNull()) { + if (myList.IsNull()) { + myList = ParseCOMPONENTS(T_BASE); + } + DefineOutLocator(); + } + } + return WOKMake_Step::Make(); +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryDATA.cdl b/src/WOKDeliv/WOKDeliv_DeliveryDATA.cdl new file mode 100755 index 0000000..d1160ec --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryDATA.cdl @@ -0,0 +1,45 @@ +-- File: WOKDeliv_DeliveryDATA.cdl +-- Created: Wed Feb 5 14:38:16 1997 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1997 + +class DeliveryDATA from WOKDeliv inherits DeliveryMetaStep from WOKDeliv + + ---Purpose: Process listing for step source in Delivery + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + Step from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryDATA from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + ExecuteMetaStep(me:mutable) + returns Boolean + is private; + + ExecuteSubStep(me:mutable) + returns Boolean + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + +end DeliveryDATA; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryDATA.cxx b/src/WOKDeliv/WOKDeliv_DeliveryDATA.cxx new file mode 100755 index 0000000..721a3fd --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryDATA.cxx @@ -0,0 +1,274 @@ +// Copyright: Matra-Datavision 1997 +// File: WOKDeliv_DeliveryDATA.cxx +// Created: Wed Feb 5 14:39:14 1997 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +WOKDeliv_DeliveryDATA::WOKDeliv_DeliveryDATA(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryMetaStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryDATA::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + Standard_Boolean okexec = Standard_False; + myList = ParseCOMPONENTS(T_DATAOBJECT); + if (myList.IsNull()) { + SetFailed(); + } + else { + if (SubCode().IsNull()) { // Meta Step + okexec = ExecuteMetaStep(); + } + else { + okexec = ExecuteSubStep(); + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } + } +} + +Standard_Boolean WOKDeliv_DeliveryDATA::ExecuteMetaStep() +{ + Standard_Boolean okexec = Standard_True; + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryDATA::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + } + else { + if (WOKernel_IsFrontal(thesourceunit)) { + thesourceunit->Open(); + + Handle(TCollection_HAsciiString) id = WOKMake_Step::StepOutputID(Unit()->Name(), + Code(), + thesourceunit->Name()); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(id, + Handle(WOKernel_File)(), + Handle(WOKBuilder_Entity)(), + Handle(WOKUtils_Path)()); + + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetPhysicFlag(Standard_False); + outfile->SetStepID(Standard_True); + + Handle(WOKMake_Step) astep = BuildProcess()->GetAndAddStep(Unit(), + Code(), + thesourceunit->Name()); + astep->DoExecute(); + astep->SetPrecedenceSteps(PrecedenceSteps()); + astep->SetTargets(Targets()); + astep->SetOptions(Options()); + + switch(astep->Make()) + { + case WOKMake_Failed: + case WOKMake_Unprocessed: + okexec = Standard_False; + break; + } + AddExecDepItem(GetInFileCOMPONENTS(),outfile, Standard_True); + } + } + itpck.Next(); + } + return okexec; +} + + +Standard_Boolean WOKDeliv_DeliveryDATA::ExecuteSubStep() +{ + Standard_Boolean okexec = Standard_True; + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(SubCode()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryDATA::Execute" + << "Cannot locate unit : " << SubCode() << endm; + } + else { + Handle(WOKBuilder_Entity) bidon; + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + // Process script file + TCollection_AsciiString namehome(Unit()->Name()->ToCString()); + namehome.UpperCase(); + namehome += "HOME"; + Unit()->Params().Set("%DeliveryHomeName",namehome.ToCString()); + Unit()->Params().Set("%UnitName",thesourceunit->Name()->ToCString()); + Handle(TCollection_HAsciiString) nameedl = new TCollection_HAsciiString("WOKDeliv_FRONTALSCRIPT.edl"); + Unit()->Params().LoadFile(nameedl); + Handle(TCollection_HAsciiString) reseval = Unit()->Params().Eval("WOKDeliv_FrontalScript"); + + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + Handle(WOKernel_DevUnit) parcelunit = WOKDeliv_DeliveryStep::GetParcelUnit(thesourceunit, + theParcel, + Unit()); + Handle(WOKernel_File) filescript = new WOKernel_File(SubCode(), + parcelunit, + parcelunit->GetFileType("executable")); + + filescript->GetPath(); + + Handle(EDL_API) anapi = new EDL_API(); + anapi->AddVariable("%MYVAR",reseval->ToCString()); + if (anapi->OpenFile("MYFILE",filescript->Path()->Name()->ToCString()) != EDL_NORMAL) { + ErrorMsg << "WOKDeliv_DeliveryDATA::Execute" + << "Cannot open file " << filescript->Path()->Name() << endm; + okexec = Standard_False; + } + else { + + anapi->WriteFile("MYFILE","%MYVAR"); + anapi->CloseFile("MYFILE"); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(filescript->LocatorName(), + filescript, + bidon, + filescript->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + + // Home made CCLinterpretor (ADN 18/9/98) + + Handle(TCollection_HAsciiString) namenewscript = new TCollection_HAsciiString("CCL"); + namenewscript->AssignCat(SubCode()->ToCString()); + +#ifdef WNT + + namenewscript->AssignCat(".cmd"); + +#endif + + filescript = new WOKernel_File(namenewscript, + parcelunit, + parcelunit->GetFileType("executable")); + + filescript->GetPath(); + + + reseval = Unit()->Params().Eval("WOKDeliv_CCLScript"); + + anapi->AddVariable("%MYVAR",reseval->ToCString()); + + if (anapi->OpenFile("MYFILECCL",filescript->Path()->Name()->ToCString()) != EDL_NORMAL) { + ErrorMsg << "WOKDeliv_DeliveryDATA::Execute" + << "Cannot open file " << filescript->Path()->Name() << endm; + okexec = Standard_False; + } + else { + + anapi->WriteFile("MYFILECCL","%MYVAR"); + anapi->CloseFile("MYFILECCL"); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(filescript->LocatorName(), + filescript, + bidon, + filescript->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + + + // get frontal unit production + Handle(TCollection_HAsciiString) namestep = new TCollection_HAsciiString("frontal"); + Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namestep, + Handle(TCollection_HAsciiString) ()); + if (thestep.IsNull()) { + okexec = Standard_False; + } + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryDATA::Execute" + << "Step " << namestep << " not done for unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (!theinfile.IsNull()) { + if (!theinfile->Name()->IsSameString(thesourceunit->Name()) + && !theinfile->Name()->IsSameString(namenewscript)) { // avoid scripts + Handle(WOKernel_FileType) outtype = parcelunit->FileTypeBase()->Type(theinfile->TypeName()->ToCString()); + + Handle(WOKernel_File) theoutfile = new WOKernel_File(theinfile->Name(), + parcelunit, + outtype); + theoutfile->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theoutfile->LocatorName(), + theoutfile, + bidon, + theoutfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + if (!WOKDeliv_DeliveryStep::CopyAFile(thesourceunit,theinfile,theoutfile)) okexec = Standard_False; + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + return okexec; +} + + + +Standard_Boolean WOKDeliv_DeliveryDATA::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryDATA::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryExecList.cdl b/src/WOKDeliv/WOKDeliv_DeliveryExecList.cdl new file mode 100755 index 0000000..3651414 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryExecList.cdl @@ -0,0 +1,66 @@ +-- File: WOKDeliv_DeliveryExecList.cdl +-- Created: Tue Sep 17 09:28:50 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliveryExecList from WOKDeliv inherits DeliveryMetaStep from WOKDeliv + + ---Purpose: List contents of executable to produce for delivery + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + Step from WOKMake, + HSequenceOfInputFile from WOKMake, + Locator from WOKernel, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryExecList from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + ExecuteMetaStep(me:mutable) + returns Boolean + is private; + + ExploreMetaStep(me:mutable; aunit : DevUnit from WOKernel; + infileCOMP : InputFile from WOKMake) + returns Boolean + is private; + + ExploreStep(me:mutable; astep : Step from WOKMake; + aunit : DevUnit from WOKernel; + infileCOMP : InputFile from WOKMake) + returns Boolean + is private; + + TreatDynamic(me:mutable) + returns Boolean + is private; + + CompleteEngine(me:mutable) + returns Boolean + is private; + + IsAvailable(me;aunit : DevUnit from WOKernel) + returns Boolean + is private; + +end DeliveryExecList; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryExecList.cxx b/src/WOKDeliv/WOKDeliv_DeliveryExecList.cxx new file mode 100755 index 0000000..8fd6577 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryExecList.cxx @@ -0,0 +1,361 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryExecList.cxx +// Created: Tue Sep 17 14:38:00 1996 +// Author: Arnaud BOUZY +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +WOKDeliv_DeliveryExecList::WOKDeliv_DeliveryExecList(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryMetaStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryExecList::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + Standard_Boolean okexec = Standard_False; + if (SubCode().IsNull()) { // Meta Step + myList = ParseCOMPONENTS(T_DYNAMIC); + okexec = ExecuteMetaStep(); + } + else { + myList = ParseCOMPONENTS(T_BASE); + okexec = TreatDynamic(); + okexec = okexec && CompleteEngine(); + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + +Standard_Boolean WOKDeliv_DeliveryExecList::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryExecList::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} + + +Standard_Boolean WOKDeliv_DeliveryExecList::ExecuteMetaStep() +{ + // Listing for MetaStep the list of dynamic executable to produce + + Standard_Boolean okexec = Standard_False; + + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + if (!theParcel.IsNull()) { + okexec = Standard_True; + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + } + else { + if (IsAvailable(thesourceunit)) { + thesourceunit->Open(); + okexec = okexec && ExploreMetaStep(thesourceunit,infileCOMPONENTS); + } + } + itpck.Next(); + } + } + } + return okexec; +} + + +Standard_Boolean WOKDeliv_DeliveryExecList::TreatDynamic() +{ + + + Handle(TCollection_HAsciiString) namelnk = new TCollection_HAsciiString("exec.link"); + Handle(TCollection_HAsciiString) nameunit = SubCode()->Token("_",1); + + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(nameunit); + + if (thesourceunit.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Cannot locate DevUnit : " << nameunit << endm; + return Standard_False; + } + thesourceunit->Open(); + Handle(TCollection_HAsciiString) name = SubCode()->Token("_",2); + WOK_TRACE { + VerboseMsg("WOK_DELIV") << "WOKDeliv_DeliveryExecList" + << "Treating : " << nameunit << " exec : " << name << endm; + } + + BuildProcess()->ComputeSteps(thesourceunit); + Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesourceunit, + namelnk, + Handle(TCollection_HAsciiString) ()); + if (!name->IsEmpty()) { + Handle(TColStd_HSequenceOfHAsciiString) theusteps = Handle(WOKMake_MetaStep)::DownCast(thestep)->UnderlyingSteps(); + thestep.Nullify(); + for (Standard_Integer k=1; k<=theusteps->Length(); k++) { + const Handle(WOKMake_Step)& substep = BuildProcess()->Find(theusteps->Value(k)); + if (substep->SubCode()->IsSameString(name)) { + thestep = substep; + } + } + } + + if (thestep.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::TreatDynamic" + << "Enable to find linking step for unit : " << nameunit; + if (!name.IsNull()) { + ErrorMsg << " for executable : " << name; + } + ErrorMsg << endm; + return Standard_False; + } + + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + + static Handle(TCollection_HAsciiString) stadmfname = new TCollection_HAsciiString("stadmfile"); + Handle(WOKBuilder_Entity) bidon; + for (Standard_Integer j=1; j<= thefiles->Length(); j++) { + Handle(WOKernel_File) theinfile = thefiles->Value(j)->File(); + if (!theinfile.IsNull()) { + if (!theinfile->TypeName()->IsSameString(stadmfname)) { + theinfile->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + return Standard_True; +} + + +Standard_Boolean WOKDeliv_DeliveryExecList::CompleteEngine() +{ + Handle(TCollection_HAsciiString) nameunit = SubCode()->Token("_",1); + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(nameunit); + if (thesourceunit.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Cannot locate DevUnit : " << nameunit << endm; + return Standard_False; + } + if (!WOKernel_IsEngine(thesourceunit)) return Standard_True; + thesourceunit->Open(); + Handle(WOKBuilder_Entity) bidon; + Handle(TCollection_HAsciiString) namedat = new TCollection_HAsciiString("exec.dat"); + Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namedat, + Handle(TCollection_HAsciiString) ()); + if (thestep.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Step " << namedat << " not done for unit " << nameunit << endm; + return Standard_False; + } + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Step " << namedat << " unprocessed for unit " << nameunit << endm; + return Standard_False; + } + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + Standard_Integer i; + for (i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (!theinfile.IsNull()) { + theinfile->GetPath(); + if (theinfile->Path()->Extension() == WOKUtils_DATFile) { + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + + Handle(TCollection_HAsciiString) namell = new TCollection_HAsciiString("xcpp.eng"); + thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namell, + Handle(TCollection_HAsciiString) ()); + if (thestep.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Step " << namell << " not done for unit " << nameunit << endm; + return Standard_False; + } + thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Step " << namell << " unprocessed for unit " << nameunit << endm; + return Standard_False; + } + for (i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (!theinfile.IsNull()) { + theinfile->GetPath(); + if (theinfile->Path()->Extension() == WOKUtils_LispFile) { + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + return Standard_True; +} + + + +Standard_Boolean WOKDeliv_DeliveryExecList::IsAvailable(const Handle(WOKernel_DevUnit)& aunit) const +{ + if (WOKernel_IsExecutable(aunit)) return Standard_True; + if (WOKernel_IsEngine(aunit)) return Standard_True; + return Standard_False; +} + + +Standard_Boolean WOKDeliv_DeliveryExecList::ExploreMetaStep(const Handle(WOKernel_DevUnit)& thesourceunit, const Handle(WOKMake_InputFile)& infileCOMPONENTS) +{ + Standard_Boolean okexec = Standard_True; + static Handle(TCollection_HAsciiString) namesexec = new TCollection_HAsciiString("exec.tks"); + + if (WOKernel_IsExecutable(thesourceunit)) { + BuildProcess()->ComputeSteps(thesourceunit); + Handle(WOKMake_Step) themstep = BuildProcess()->Find(thesourceunit, + namesexec, + Handle(TCollection_HAsciiString) ()); + if (themstep.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Cannot find linking step for DevUnit : " << thesourceunit->Name() << endm; + return Standard_False; + } + + Handle(WOKMake_MetaStep) themetastep = Handle(WOKMake_MetaStep)::DownCast(themstep); + Handle(TColStd_HSequenceOfHAsciiString) theundersteps = themetastep->UnderlyingSteps(); + for (Standard_Integer i=1; i<= theundersteps->Length(); i++) { + const Handle(WOKMake_Step)& substep = BuildProcess()->Find(theundersteps->Value(i)); + okexec = okexec && ExploreStep(substep,thesourceunit,infileCOMPONENTS); + } + } + else { + Handle(WOKMake_Step) theexecstep = BuildProcess()->GetAndAddStep(thesourceunit, + namesexec, + Handle(TCollection_HAsciiString) ()); + if (theexecstep.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryExecList::Execute" + << "Cannot find linking step for DevUnit : " << thesourceunit->Name() << endm; + return Standard_False; + } + okexec = okexec && ExploreStep(theexecstep,thesourceunit,infileCOMPONENTS); + } + return okexec; +} + +Standard_Boolean WOKDeliv_DeliveryExecList::ExploreStep(const Handle(WOKMake_Step)& thestep, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(WOKMake_InputFile)& infileCOMPONENTS) +{ + Standard_Boolean okexec = Standard_True; + Handle(TCollection_HAsciiString) namesubcode = new TCollection_HAsciiString(aunit->Name()); + if (!thestep->SubCode().IsNull()) { + namesubcode->AssignCat("_"); + namesubcode->AssignCat(thestep->SubCode()->ToCString()); + } + Handle(TCollection_HAsciiString) id = WOKMake_Step::StepOutputID(Unit()->Name(), + Code(), + namesubcode); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(id, + Handle(WOKernel_File)(), + Handle(WOKBuilder_Entity)(), + Handle(WOKUtils_Path)()); + + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetPhysicFlag(Standard_False); + outfile->SetStepID(Standard_True); + + Handle(WOKDeliv_DeliveryExecList) astep = + Handle(WOKDeliv_DeliveryExecList)::DownCast(BuildProcess()->GetAndAddStep(Unit(), + Code(), + namesubcode)); + astep->DoExecute(); + astep->SetPrecedenceSteps(PrecedenceSteps()); + astep->SetTargets(Targets()); + astep->SetOptions(Options()); + + switch(astep->Make()) + { + case WOKMake_Failed: + case WOKMake_Unprocessed: + okexec = Standard_False; + break; + } + AddExecDepItem(infileCOMPONENTS,outfile, Standard_True); + return okexec; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryFiles.cdl b/src/WOKDeliv/WOKDeliv_DeliveryFiles.cdl new file mode 100755 index 0000000..bc23b62 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryFiles.cdl @@ -0,0 +1,47 @@ +-- File: WOKDeliv_DeliveryFiles.cdl +-- Created: Mon Jan 6 15:35:21 1997 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1997 + +class DeliveryFiles from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process construction of file lists of parcel + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + DataMapOfFiles from WOKDeliv, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection, + HSequenceOfHAsciiString from TColStd + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryFiles from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + + ReadAnOutputFile(me; anout : File from WOKernel; + amap : in out DataMapOfFiles from WOKDeliv) + is private; + + AddFileListFiles(myclass; anoutunit : DevUnit from WOKernel; + aSeq : HSequenceOfHAsciiString from TColStd) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + +end DeliveryFiles; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryFiles.cxx b/src/WOKDeliv/WOKDeliv_DeliveryFiles.cxx new file mode 100755 index 0000000..c4073ac --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryFiles.cxx @@ -0,0 +1,168 @@ +// Copyright: Matra-Datavision 1997 +// File: WOKDeliv_DeliveryFiles.cxx +// Created: Mon Jan 6 15:37:18 1997 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +WOKDeliv_DeliveryFiles::WOKDeliv_DeliveryFiles(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryFiles::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + myList = ParseCOMPONENTS(T_BASE); + Standard_Boolean okexec = Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + + WOKDeliv_DataMapOfFiles mapfiles; + + Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString(); + + mapfiles.Bind(Unit()->Name(),aseq); + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + aseq = new TColStd_HSequenceOfHAsciiString(); + mapfiles.Bind(itpck.Key(),aseq); + itpck.Next(); + } + + DefineOutLocator(); + + // Recuperation des steps de la delivery + BuildProcess()->ComputeSteps(Unit()); + const TColStd_SequenceOfHAsciiString& thesteps = BuildProcess()->GetUnitSteps(Unit()->Name()); + for (Standard_Integer i=1; i<= thesteps.Length(); i++) { + Handle(WOKMake_Step) astep = BuildProcess()->Find(thesteps.Value(i)); + if (!astep->IsKind(STANDARD_TYPE(WOKMake_MetaStep))) { + Handle(WOKernel_File) anout = astep->LocateAdmFile(OutLocator(),astep->OutputFilesFileName()); + if (!anout.IsNull()) { + ReadAnOutputFile(anout,mapfiles); + } + } + else { + Handle(TColStd_HSequenceOfHAsciiString) substeps = Handle(WOKMake_MetaStep)::DownCast(astep)->UnderlyingSteps(); + for (Standard_Integer j=1; j<= substeps->Length(); j++) { + Handle(WOKMake_Step) substep = BuildProcess()->Find(substeps->Value(j)); + Handle(WOKernel_File) anout = + substep->LocateAdmFile(OutLocator(),substep->OutputFilesFileName()); + if (!anout.IsNull()) { + ReadAnOutputFile(anout,mapfiles); + } + } + } + } + + WOKDeliv_DataMapIteratorOfDataMapOfFiles it(mapfiles); + while (it.More()) { + Handle(WOKernel_DevUnit) unit = OutLocator()->LocateDevUnit(it.Key()); + if (!unit.IsNull()) { + AddFileListFiles(unit,it.Value()); + unit->SetFileList(it.Value()); + unit->DumpFileList(OutLocator()); + } + it.Next(); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryFiles::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + } + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + +void WOKDeliv_DeliveryFiles::ReadAnOutputFile(const Handle(WOKernel_File)& anout, + WOKDeliv_DataMapOfFiles& mapfiles) const +{ + + anout->GetPath(); + WOKMake_IndexedDataMapOfHAsciiStringOfOutputFile outfilemap; + WOKMake_OutputFile::ReadFile(anout->Path(),OutLocator(),outfilemap); + for (Standard_Integer i=1; i<= outfilemap.Extent(); i++) { + Handle(WOKMake_OutputFile) anoutfile = outfilemap(i); + if (anoutfile->IsProduction() && + anoutfile->IsPhysic()) { + Handle(TCollection_HAsciiString) unitname = anoutfile->ID()->Token(":",1); + if (mapfiles.IsBound(unitname)) { + mapfiles(unitname)->Append(anoutfile->ID()); + } + else { + mapfiles(Unit()->Name())->Append(anoutfile->ID()); + } + } + } + // Add outfile itself + mapfiles(Unit()->Name())->Append(anout->LocatorName()); +} + +void WOKDeliv_DeliveryFiles::AddFileListFiles(const Handle(WOKernel_DevUnit)& anoutunit, + const Handle(TColStd_HSequenceOfHAsciiString)& aSeq) +{ + Handle(TCollection_HAsciiString) afilelistfile; + Handle(WOKernel_File) admfile, dbadmfile, stadmfile; + + afilelistfile = new TCollection_HAsciiString(anoutunit->Name()); + afilelistfile->AssignCat(anoutunit->Params().Eval("%FILENAME_FILELIST_EXT")); + + admfile = new WOKernel_File(afilelistfile, anoutunit, anoutunit->GetFileType("admfile")); + + dbadmfile = new WOKernel_File(afilelistfile, anoutunit, anoutunit->GetFileType("dbadmfile")); + + stadmfile = new WOKernel_File(afilelistfile, anoutunit, anoutunit->GetFileType("stadmfile")); + + aSeq->Append(admfile->LocatorName()); + aSeq->Append(dbadmfile->LocatorName()); + aSeq->Append(stadmfile->LocatorName()); + +} + +Standard_Boolean WOKDeliv_DeliveryFiles::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryFiles::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)ADMFILE); + return result; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryGET.cdl b/src/WOKDeliv/WOKDeliv_DeliveryGET.cdl new file mode 100755 index 0000000..ca29e8f --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryGET.cdl @@ -0,0 +1,38 @@ +-- File: WOKDeliv_DeliveryGET.cdl +-- Created: Fri Mar 29 16:51:49 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DeliveryGET from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process get for delivery units + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + DeliveryList from WOKDeliv, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryGET from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + +end DeliveryGET; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryGET.cxx b/src/WOKDeliv/WOKDeliv_DeliveryGET.cxx new file mode 100755 index 0000000..a4dc1f0 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryGET.cxx @@ -0,0 +1,171 @@ +// File: WOKDeliv_DeliveryGET.cxx +// Created: Fri Mar 29 16:55:57 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +WOKDeliv_DeliveryGET::WOKDeliv_DeliveryGET(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryGET::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + + myList = ParseCOMPONENTS(T_GET); + Standard_Boolean okexec = Standard_False; + Handle(WOKBuilder_Entity) bidon; + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + if (!myList.IsNull()) { + // Get from COMPONENTS + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + + WOKTools_MapIteratorOfMapOfHAsciiString itget(myList->GetMap()); + Handle(TCollection_HAsciiString) aname; + Handle(TCollection_HAsciiString) atypename; + Handle(TCollection_HAsciiString) aunitname; + Handle(WOKernel_DevUnit) aunit; + Handle(WOKernel_FileType) atype; + while (itget.More()) { + Handle(WOKernel_File) thefile = Locator()->Locate(itget.Key()); + if (thefile.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryGET::Execute" + << "cannot locate file " << itget.Key() << endm; + okexec = Standard_False; + } + else { + thefile->GetPath(); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(thefile->LocatorName(), + thefile, + bidon, + thefile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + itget.Next(); + } + } + } + myList = ParseCOMPONENTS(T_GETRES); + // Resource or Documentation Units + if (!myList.IsNull()) { + WOKTools_MapIteratorOfMapOfHAsciiString itget(myList->GetMap()); + while (itget.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itget.Key()); + if (WOKernel_IsResource(thesourceunit) || WOKernel_IsDocumentation(thesourceunit)) { + Handle(WOKernel_Workbench) abench = thesourceunit->Session()->GetWorkbench(thesourceunit->Nesting()); + Handle(WOKernel_Locator) alocator = new WOKernel_Locator(abench); + Handle(TCollection_HAsciiString) theFILEStype = new TCollection_HAsciiString("source"); + Handle(TCollection_HAsciiString) theFILESname = new TCollection_HAsciiString("FILES"); + Handle(WOKernel_File) theFILES = alocator->Locate(thesourceunit->Name(),theFILEStype,theFILESname); + if (!theFILES.IsNull()) { + theFILES->GetPath(); + WOKUtils_AdmFile afiles(theFILES->Path()); + Handle(TColStd_HSequenceOfHAsciiString) aasciiseq; + Handle(TCollection_HAsciiString) astr; + + aasciiseq = afiles.Read(); + + if(!aasciiseq.IsNull()) { + for(Standard_Integer i=1; i<=aasciiseq->Length(); i++) { + astr = aasciiseq->Value(i); + + astr->LeftAdjust(); + astr->RightAdjust(); + + Standard_Integer first = astr->Search(":::"); + + if (first <= 1) { + Handle(TCollection_HAsciiString) filenameFILES = thesourceunit->Params().Eval("%FILENAME_FILES"); + if (strcmp(filenameFILES->ToCString(),astr->ToCString())) { + ErrorMsg << "WOKDeliv_DeliveryGET::Execute" + << "No type specified for file " << astr << " in unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + } + else { + Handle(TCollection_HAsciiString) type = astr->SubString(1,first-1); + Handle(TCollection_HAsciiString) name = astr->SubString(first+3, astr->Length()); + + Handle(WOKernel_File) thefile = Locator()->Locate(thesourceunit->Name(),type,name); + if (thefile.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryGET::Execute" + << "cannot locate file " << name << endm; + okexec = Standard_False; + } + else { + thefile->GetPath(); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(thefile->LocatorName(), + thefile, + bidon, + thefile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryGET::Execute" << "cannot find file FILES in resource unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + } + itget.Next(); + } + } + if (okexec) SetSucceeded(); +} + + + +Standard_Boolean WOKDeliv_DeliveryGET::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryGET::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryLIB.cdl b/src/WOKDeliv/WOKDeliv_DeliveryLIB.cdl new file mode 100755 index 0000000..71da2b0 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryLIB.cdl @@ -0,0 +1,58 @@ +-- File: WOKDeliv_DeliveryLIB.cdl +-- Created: Fri Mar 29 16:55:01 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +deferred class DeliveryLIB from WOKDeliv inherits DeliveryMetaStep from WOKDeliv + + ---Purpose: Process lib step for delivery units + +uses DevUnit from WOKernel, + File from WOKernel, + Step from WOKMake, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection, + DeliveryList from WOKDeliv + +is + + Initialize(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard); + + + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined private; + + TreatStep(me: mutable; astep : Step from WOKMake; + infileCOMP : InputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + SetList(me:mutable) + is deferred; + + NeedsObjects(me) + returns Boolean + is deferred; + + ComputeOutputLIB(me: mutable; asource : DevUnit from WOKernel; + inComp : InputFile from WOKMake) + is deferred; + + IsAvailable(me; asource : DevUnit from WOKernel) + returns Boolean + is deferred; + +end DeliveryLIB; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryLIB.cxx b/src/WOKDeliv/WOKDeliv_DeliveryLIB.cxx new file mode 100755 index 0000000..b756529 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryLIB.cxx @@ -0,0 +1,282 @@ +// File: WOKMake_DeliveryLIB.cxx +// Created: Fri Mar 29 17:04:00 1996 +// Author: Arnaud BOUZY +// + + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include + + +WOKDeliv_DeliveryLIB::WOKDeliv_DeliveryLIB(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryMetaStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryLIB::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + SetList(); + Standard_Boolean okexec=Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + if (!theParcel.IsNull()) { + okexec = Standard_True; + Standard_Boolean needobj = NeedsObjects(); + if (SubCode().IsNull()) { // Meta Step + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + } + else { + if (IsAvailable(thesourceunit)) { + thesourceunit->Open(); + + Handle(TCollection_HAsciiString) id = WOKMake_Step::StepOutputID(Unit()->Name(), + Code(), + thesourceunit->Name()); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(id, + Handle(WOKernel_File)(), + Handle(WOKBuilder_Entity)(), + Handle(WOKUtils_Path)()); + + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetPhysicFlag(Standard_False); + outfile->SetStepID(Standard_True); + + Handle(WOKMake_Step) astep = BuildProcess()->GetAndAddStep(Unit(), + Code(), + thesourceunit->Name()); + astep->DoExecute(); + astep->SetPrecedenceSteps(PrecedenceSteps()); + astep->SetTargets(Targets()); + astep->SetOptions(Options()); + + switch(astep->Make()) + { + case WOKMake_Failed: + case WOKMake_Unprocessed: + okexec = Standard_False; + break; + } + AddExecDepItem(infileCOMPONENTS,outfile, Standard_True); + } + } + itpck.Next(); + } + } + else { // Execute a step list + Handle(WOKBuilder_Entity) bidon; + + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(SubCode()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" << "Cannot locate unit : " << SubCode() << endm; + } + else { + // Find file ImplDep + Handle(TCollection_HAsciiString) nameidep = new TCollection_HAsciiString(thesourceunit->Name()); + nameidep->AssignCat("."); + nameidep->AssignCat(thesourceunit->Params().Eval("%FILENAME_IMPLDEP")); + + Handle(WOKernel_File) idep = Locator()->Locate(thesourceunit->Name(), + new TCollection_HAsciiString("stadmfile"), + nameidep); + if (!idep.IsNull()) { + idep->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(idep->LocatorName(), + idep, + bidon, + idep->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + if (WOKernel_IsToolkit(thesourceunit)) { + // Find file PACKAGES + Handle(TCollection_HAsciiString) pkgstype = new TCollection_HAsciiString("PACKAGES"); + Handle(TCollection_HAsciiString) PACKAGESname = thesourceunit->Params().Eval("%FILENAME_PACKAGES"); + Handle(WOKernel_File) filepack = Locator()->Locate(thesourceunit->Name(), + pkgstype, + PACKAGESname); + if (filepack.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" + << "Cannot locate file PACKAGES for Toolkit " << thesourceunit->Name() + << endm; + } + else { + filepack->GetPath(); + + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(filepack->LocatorName(), + filepack, + bidon, + filepack->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + +#ifndef WNT + // EXTERNLIB stuff is not needed on NT + // Find file EXTERNLIB + Handle(TCollection_HAsciiString) nameexternlib = new TCollection_HAsciiString("EXTERNLIB"); + Handle(WOKernel_File) extfile = Locator()->Locate(thesourceunit->Name(), + nameexternlib, + nameexternlib); + if (!extfile.IsNull()) { + extfile->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(extfile->LocatorName(), + extfile, + bidon, + extfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } +#endif // WNT + + + // Treat library + + if (needobj) { + Handle(TCollection_HAsciiString) namestep; + if (!WOKernel_IsToolkit(thesourceunit)) { + namestep = new TCollection_HAsciiString("obj.lib"); + } + else { + namestep = new TCollection_HAsciiString("lib.build"); + } + + BuildProcess()->ComputeSteps(thesourceunit); + Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesourceunit, + namestep, + Handle(TCollection_HAsciiString) ()); + if (!thestep.IsNull()) { + Handle(TColStd_HSequenceOfHAsciiString) namprec = thestep->PrecedenceSteps(); + for (Standard_Integer j=1; j<= namprec->Length(); j++) { + Handle(WOKMake_Step) apstep = BuildProcess()->Find(namprec->Value(j)); + TreatStep(apstep,infileCOMPONENTS); + } + } + } + else { + ComputeOutputLIB(thesourceunit,infileCOMPONENTS); + } + } + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryCDL::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + } + } + + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + +Standard_Boolean WOKDeliv_DeliveryLIB::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryLIB::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} + + +void WOKDeliv_DeliveryLIB::TreatStep(const Handle(WOKMake_Step)& thestep, + const Handle(WOKMake_InputFile)& infileCOMPONENTS) +{ + Handle(WOKBuilder_Entity) bidon; + if (!thestep.IsNull()) { + if (thestep->IsKind(STANDARD_TYPE(WOKMake_MetaStep))) { + Handle(TColStd_HSequenceOfHAsciiString) theusteps = Handle(WOKMake_MetaStep)::DownCast(thestep)->UnderlyingSteps(); + for (Standard_Integer i=1; i<= theusteps->Length(); i++) { + const Handle(WOKMake_Step)& substep = BuildProcess()->Find(theusteps->Value(i)); + TreatStep(substep,infileCOMPONENTS); + } + } + else { + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" + << "Step " << thestep->Code() << " unprocessed for unit " + << thestep->Unit()->Name() << endm; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (theinfile.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryLIB::Execute" + << "Null file for output file : " << thefiles->Value(i)->ID() << endm; + } + else { + theinfile->GetPath(); + if ((theinfile->Path()->Extension() == WOKUtils_ObjectFile) || + (theinfile->Path()->Extension() == WOKUtils_ArchiveFile)) { + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + } +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryList.cdl b/src/WOKDeliv/WOKDeliv_DeliveryList.cdl new file mode 100755 index 0000000..d7869ea --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryList.cdl @@ -0,0 +1,78 @@ +-- File: WOKMake_DeliveryList.cdl +-- Created: Thu Mar 28 17:43:06 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliveryList from WOKDeliv inherits TShared from MMgt + + ---Purpose: Describes the content of a delivery for a defined + -- step + + +uses MapOfHAsciiString from WOKTools, + HAsciiString from TCollection + +is + + + Create(aDelivStep : Integer) + returns mutable DeliveryList; + + GetStep(me) + returns Integer; + + SetName(me: mutable; name : CString); + + GetName(me) + returns HAsciiString from TCollection; + + ChangeMap(me:mutable) + ---C++: return & + returns MapOfHAsciiString from WOKTools; + + GetMap(me) + ---C++: return const & + returns MapOfHAsciiString from WOKTools; + + ChangeRequireMap(me:mutable) + ---C++: return & + returns MapOfHAsciiString from WOKTools; + + GetRequireMap(me) + ---C++: return const & + returns MapOfHAsciiString from WOKTools; + + SetPutPath(me:mutable); + ---C++: inline + + IsPutPath(me) + ---C++: inline + returns Boolean; + + SetPutLib(me:mutable); + ---C++: inline + + IsPutLib(me) + ---C++: inline + returns Boolean; + + SetPutInclude(me:mutable); + ---C++: inline + + IsPutInclude(me) + ---C++: inline + returns Boolean; + +fields + + myStep : Integer; + myMap : MapOfHAsciiString from WOKTools; + myReqMap : MapOfHAsciiString from WOKTools; + myName : HAsciiString from TCollection; + myPutPath : Boolean; + myPutLib : Boolean; + myPutInclude : Boolean; + +end DeliveryList; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryList.cxx b/src/WOKDeliv/WOKDeliv_DeliveryList.cxx new file mode 100755 index 0000000..aff7c48 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryList.cxx @@ -0,0 +1,47 @@ +// File: WOKDeliv_DeliveryList.cxx +// Created: Fri Mar 29 11:10:15 1996 +// Author: Arnaud BOUZY +// + + +#include + +WOKDeliv_DeliveryList::WOKDeliv_DeliveryList(const Standard_Integer aDelivStep):myStep(aDelivStep),myPutPath(Standard_False),myPutLib(Standard_False),myPutInclude(Standard_False) +{ +} + +Standard_Integer WOKDeliv_DeliveryList::GetStep() const +{ + return myStep; +} + +WOKTools_MapOfHAsciiString& WOKDeliv_DeliveryList::ChangeMap() +{ + return myMap; +} + +const WOKTools_MapOfHAsciiString& WOKDeliv_DeliveryList::GetMap() const +{ + return myMap; +} + +WOKTools_MapOfHAsciiString& WOKDeliv_DeliveryList::ChangeRequireMap() +{ + return myReqMap; +} + +const WOKTools_MapOfHAsciiString& WOKDeliv_DeliveryList::GetRequireMap() const +{ + return myReqMap; +} + +void WOKDeliv_DeliveryList::SetName(const Standard_CString name) +{ + myName = new TCollection_HAsciiString(name); +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryList::GetName() const +{ + return myName; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryList.lxx b/src/WOKDeliv/WOKDeliv_DeliveryList.lxx new file mode 100755 index 0000000..40e1d51 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryList.lxx @@ -0,0 +1,35 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryList.lxx +// Created: Mon Nov 4 14:14:05 1996 +// Author: Arnaud BOUZY +// + +void WOKDeliv_DeliveryList::SetPutPath() +{ + myPutPath = Standard_True; +} + +Standard_Boolean WOKDeliv_DeliveryList::IsPutPath() const +{ + return myPutPath; +} + +void WOKDeliv_DeliveryList::SetPutLib() +{ + myPutLib = Standard_True; +} + +Standard_Boolean WOKDeliv_DeliveryList::IsPutLib() const +{ + return myPutLib; +} + +void WOKDeliv_DeliveryList::SetPutInclude() +{ + myPutInclude = Standard_True; +} + +Standard_Boolean WOKDeliv_DeliveryList::IsPutInclude() const +{ + return myPutInclude; +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryListShared.cdl b/src/WOKDeliv/WOKDeliv_DeliveryListShared.cdl new file mode 100755 index 0000000..bf291df --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryListShared.cdl @@ -0,0 +1,30 @@ +-- File: WOKDeliv_DeliveryListShared.cdl +-- Created: Thu Jan 29 18:02:31 1998 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1998 + +class DeliveryListShared from WOKDeliv inherits DeliveryStepList from WOKDeliv + + ---Purpose: Process Shared listing + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryListShared from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + +end DeliveryListShared; + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryListShared.cxx b/src/WOKDeliv/WOKDeliv_DeliveryListShared.cxx new file mode 100755 index 0000000..ebd5b76 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryListShared.cxx @@ -0,0 +1,108 @@ +// Copyright: Matra-Datavision 1998 +// File: WOKDeliv_DeliveryListShared.cxx +// Created: Thu Jan 29 18:03:49 1998 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +WOKDeliv_DeliveryListShared::WOKDeliv_DeliveryListShared(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStepList(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryListShared::Execute(const Handle(WOKMake_HSequenceOfInputFile)& bid) +{ + WOKDeliv_DeliveryStepList::Execute(bid); + Standard_Boolean okexec = Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + Handle(WOKBuilder_Entity) bidon; + + while (itpck.More()) { + + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + SetFailed(); + } + else { + thesourceunit->Open(); + + // Find file EXTERNLIB + Handle(TCollection_HAsciiString) nameexternlib = new TCollection_HAsciiString("EXTERNLIB"); + Handle(WOKernel_File) extfile = Locator()->Locate(thesourceunit->Name(), + nameexternlib, + nameexternlib); + if (!extfile.IsNull()) { + extfile->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(extfile->LocatorName(), + extfile, + bidon, + extfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + + + if (WOKernel_IsToolkit(thesourceunit)) { + // Find file PACKAGES + Handle(TCollection_HAsciiString) pkgstype = new TCollection_HAsciiString("PACKAGES"); + Handle(TCollection_HAsciiString) PACKAGESname = thesourceunit->Params().Eval("%FILENAME_PACKAGES"); + Handle(WOKernel_File) filepack = Locator()->Locate(thesourceunit->Name(), + pkgstype, + PACKAGESname); + if (filepack.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryListShared::Execute" + << "Cannot locate file PACKAGES for Toolkit " << thesourceunit->Name() + << endm; + } + else { + filepack->GetPath(); + + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(filepack->LocatorName(), + filepack, + bidon, + filepack->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + itpck.Next(); + } + } + } + if (!okexec) { + SetFailed(); + } +} + + + + + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cdl b/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cdl new file mode 100755 index 0000000..0fdf00b --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cdl @@ -0,0 +1,69 @@ +-- File: WOKDeliv_DeliveryMetaStep.cdl +-- Created: Wed Sep 4 11:40:29 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +deferred class DeliveryMetaStep from WOKDeliv inherits MetaStep from WOKMake + + ---Purpose: Describes general services for delivery steps + +uses DevUnit from WOKernel, + File from WOKernel, + Parcel from WOKernel, + Locator from WOKernel, + Path from WOKUtils, + HAsciiString from TCollection, + AsciiString from TCollection, + DeliveryList from WOKDeliv, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + OutputFile from WOKMake + + +is + Initialize(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard); + + + AdmFile(me; aname : HAsciiString from TCollection) + returns mutable File from WOKernel + is redefined; + + OutputDirTypeName(me) + returns HAsciiString from TCollection + is protected; + + GetCOMPONENTS(me:mutable) + returns File from WOKernel + is protected; + + ParseCOMPONENTS(me:mutable; aDeliveryStep : Integer) + returns DeliveryList from WOKDeliv + is protected; + + + GetInFileCOMPONENTS(me) + returns InputFile from WOKMake + is protected; + + DefineOutLocator(me:mutable) + is protected; + + OutLocator(me) + returns mutable Locator from WOKernel + is redefined; + + AcquitExecution(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined protected; + + +fields + + myOutLocator : Locator from WOKernel is protected; + myList : DeliveryList from WOKDeliv is protected; + +end DeliveryMetaStep; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cxx b/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cxx new file mode 100755 index 0000000..625be41 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryMetaStep.cxx @@ -0,0 +1,142 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryMetaStep.cxx +// Created: Wed Sep 4 11:41:32 1996 +// Author: Arnaud BOUZY +// + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +WOKDeliv_DeliveryMetaStep::WOKDeliv_DeliveryMetaStep(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) + : WOKMake_MetaStep(aprocess,aunit,acode,checked,hidden) +{ +} + +Handle(WOKernel_File) WOKDeliv_DeliveryMetaStep::AdmFile(const Handle(TCollection_HAsciiString)& aname) const +{ + Handle(WOKernel_File) result; + if (aname->IsSameString(OutputFilesFileName())) { + if (!myOutLocator.IsNull()) { + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + Handle(WOKernel_DevUnit) parcelunit = WOKDeliv_DeliveryStep::GetParcelUnit(Unit(),theParcel,Unit()); + result = new WOKernel_File(aname, parcelunit, parcelunit->GetFileType(AdmFileType())); + result->GetPath(); + return result; + } + } + } + result = new WOKernel_File(aname, Unit(), Unit()->GetFileType(AdmFileType())); + result->GetPath(); + return result; +} + +Handle(WOKernel_File) WOKDeliv_DeliveryMetaStep::GetCOMPONENTS() +{ + // file COMPONENTS + Handle(TCollection_HAsciiString) COMPName = new TCollection_HAsciiString("COMPONENTS"); + Handle(TCollection_HAsciiString) sourcetype = new TCollection_HAsciiString("source"); + return Locator()->Locate(Unit()->Name(), sourcetype, COMPName); +} + +Handle(WOKDeliv_DeliveryList) WOKDeliv_DeliveryMetaStep::ParseCOMPONENTS(const Standard_Integer aStep) +{ + Handle(WOKDeliv_DeliveryList) dlist; + Handle(WOKernel_File) filCOMP = GetCOMPONENTS(); + if (!filCOMP.IsNull()) { + filCOMP->GetPath(); + if (WOKDeliv_Delivery_SetFile(filCOMP->Path()->Name()->ToCString())) { + dlist = WOKDeliv_Delivery_Parse(aStep); + WOKDeliv_Delivery_CloseFile(); + } + else { + ErrorMsg << "WOKDeliv_DeliveryMetaStep::Parse" << "Error getting file COMPONENTS" << endm; + SetFailed(); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryMetaStep::Parse" << "Error locating file COMPONENTS" << endm; + SetFailed(); + } + return dlist; +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryMetaStep::OutputDirTypeName() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STTMPDIR); + return result; +} + + +Handle(WOKMake_InputFile) WOKDeliv_DeliveryMetaStep::GetInFileCOMPONENTS() const +{ + for (Standard_Integer i=1; i<= myinflow.Extent(); i++) { + Handle(WOKernel_File) thefile = myinflow(i)->File(); + if (!strcmp(thefile->Name()->ToCString(),"COMPONENTS")) { + return myinflow(i); + } + } + return 0; +} + +void WOKDeliv_DeliveryMetaStep::DefineOutLocator() +{ + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + Handle(TColStd_HSequenceOfHAsciiString) thevisib = new TColStd_HSequenceOfHAsciiString(); + thevisib->Append(theParcel->FullName()); + myOutLocator = new WOKernel_Locator(Unit()->Session(),thevisib); + } + } +} + + +Handle(WOKernel_Locator) WOKDeliv_DeliveryMetaStep::OutLocator() const +{ + if (myOutLocator.IsNull()) { + return WOKMake_Step::OutLocator(); + } + return myOutLocator; +} + + +void WOKDeliv_DeliveryMetaStep::AcquitExecution(const Handle(WOKMake_HSequenceOfInputFile)& execlist) +{ + WOKMake_MetaStep::AcquitExecution(execlist); + + Handle(WOKernel_File) outfile = AdmFile(OutputFilesFileName()); + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theparcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + Handle(WOKernel_DevUnit) theparcelunit = WOKDeliv_DeliveryStep::GetParcelUnit(Unit(),theparcel,Unit()); + Handle(WOKernel_File) unitoutfile = + new WOKernel_File(OutputFilesFileName(), + theparcelunit, + theparcelunit->GetFileType(AdmFileType())); + WOKDeliv_DeliveryStep::CopyAFile(Unit(),outfile,unitoutfile,Standard_True); + } +} + + diff --git a/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cdl b/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cdl new file mode 100755 index 0000000..d2583ac --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cdl @@ -0,0 +1,37 @@ +-- File: WOKDeliv_DeliveryOBJSSchema.cdl +-- Created: Tue Apr 29 10:25:21 1997 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1997 + +class DeliveryOBJSSchema from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process schema for Object Store + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryOBJSSchema from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + +end DeliveryOBJSSchema; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cxx b/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cxx new file mode 100755 index 0000000..435b9a2 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryOBJSSchema.cxx @@ -0,0 +1,120 @@ +// Copyright: Matra-Datavision 1997 +// File: WOKDeliv_DeliveryOBJSSchema.cxx +// Created: Tue Apr 29 10:28:47 1997 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +WOKDeliv_DeliveryOBJSSchema::WOKDeliv_DeliveryOBJSSchema(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryOBJSSchema::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + myList = ParseCOMPONENTS(T_FDDB); + Standard_Boolean okexec = Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + Handle(WOKBuilder_Entity) bidon; + Handle(TCollection_HAsciiString) namestep= new TCollection_HAsciiString("xcpp.ossg"); + Handle(TCollection_HAsciiString) asdbtype= new TCollection_HAsciiString("library"); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryOBJSSchema::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + SetFailed(); + } + else { + if (WOKernel_IsSchema(thesourceunit)) { + thesourceunit->Open(); + Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namestep, + Handle(TCollection_HAsciiString) ()); + if (!thestep.IsNull()) { + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryOBJSSchema::Execute" + << "Step " << namestep << " not done for unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (theinfile->TypeName()->IsSameString(asdbtype)) { + theinfile->GetPath(); + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + } + itpck.Next(); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryOBJSSchema::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + okexec = Standard_False; + } + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + +Standard_Boolean WOKDeliv_DeliveryOBJSSchema::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryOBJSSchema::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} diff --git a/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cdl b/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cdl new file mode 100755 index 0000000..0e7406f --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cdl @@ -0,0 +1,46 @@ +-- File: WOKDeliv_DeliverySOURCES.cdl +-- Created: Mon Dec 30 16:32:42 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliverySOURCES from WOKDeliv inherits DeliveryMetaStep from WOKDeliv + + ---Purpose: Process listing for step source in Delivery + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + Step from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliverySOURCES from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + ExecuteMetaStep(me:mutable) + returns Boolean + is private; + + ExecuteSubStep(me:mutable) + returns Boolean + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + +end DeliverySOURCES; diff --git a/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cxx b/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cxx new file mode 100755 index 0000000..24111a0 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySOURCES.cxx @@ -0,0 +1,178 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliverySOURCES.cxx +// Created: Mon Dec 30 16:35:29 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +WOKDeliv_DeliverySOURCES::WOKDeliv_DeliverySOURCES(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryMetaStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliverySOURCES::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + Standard_Boolean okexec = Standard_False; + myList = ParseCOMPONENTS(T_BASE); + if (myList.IsNull()) { + SetFailed(); + } + else { + if (SubCode().IsNull()) { // Meta Step + okexec = ExecuteMetaStep(); + } + else { + okexec = ExecuteSubStep(); + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } + } +} + +Standard_Boolean WOKDeliv_DeliverySOURCES::ExecuteMetaStep() +{ + Standard_Boolean okexec = Standard_True; + // Add Delivery sources + myList->ChangeMap().Add(Unit()->Name()); + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliverySOURCE::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + } + else { + thesourceunit->Open(); + + Handle(TCollection_HAsciiString) id = WOKMake_Step::StepOutputID(Unit()->Name(), + Code(), + thesourceunit->Name()); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(id, + Handle(WOKernel_File)(), + Handle(WOKBuilder_Entity)(), + Handle(WOKUtils_Path)()); + + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetPhysicFlag(Standard_False); + outfile->SetStepID(Standard_True); + + Handle(WOKMake_Step) astep = BuildProcess()->GetAndAddStep(Unit(), + Code(), + thesourceunit->Name()); + astep->DoExecute(); + astep->SetPrecedenceSteps(PrecedenceSteps()); + astep->SetTargets(Targets()); + astep->SetOptions(Options()); + + switch(astep->Make()) + { + case WOKMake_Failed: + case WOKMake_Unprocessed: + okexec = Standard_False; + break; + } + AddExecDepItem(GetInFileCOMPONENTS(),outfile, Standard_True); + } + itpck.Next(); + } + return okexec; +} + + +Standard_Boolean WOKDeliv_DeliverySOURCES::ExecuteSubStep() +{ + Standard_Boolean okexec = Standard_True; + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(SubCode()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliverySOURCE::Execute" << "Cannot locate unit : " << SubCode() << endm; + } + else { + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + thesourceunit->ReadFileList(Locator()); + Handle(TColStd_HSequenceOfHAsciiString) filelist = thesourceunit->FileList(); + Handle(WOKernel_File) afile; + Handle(TCollection_HAsciiString) astr; + Handle(TCollection_HAsciiString) aname; + Handle(TCollection_HAsciiString) atype; + Handle(WOKMake_OutputFile) outfile; + Handle(WOKBuilder_Entity) bidon; + Handle(TCollection_HAsciiString) srctype = new TCollection_HAsciiString("source"); + + for(Standard_Integer i=1; i<=filelist->Length();i++) + { + astr = filelist->Value(i); + atype = astr->Token(":", 2); + aname = astr->Token(":", 3); + + if (atype->IsSameString(srctype)) { + afile = Locator()->Locate(thesourceunit->Name(), + atype, + aname); + if (afile.IsNull()) { + ErrorMsg << "WOKDeliv_DeliverySOURCE::Execute" + << "Enable to locate source file " << astr << endm; + okexec = Standard_False; + } + else { + afile->GetPath(); + outfile = new WOKMake_OutputFile(afile->LocatorName(), + afile, + bidon, + afile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + return okexec; +} + + + +Standard_Boolean WOKDeliv_DeliverySOURCES::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliverySOURCES::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)ADMFILE); + return result; +} + diff --git a/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cdl b/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cdl new file mode 100755 index 0000000..2a26a95 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cdl @@ -0,0 +1,37 @@ +-- File: WOKDeliv_DeliverySTUBClient.cdl +-- Created: Mon Aug 19 11:37:28 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + +class DeliverySTUBClient from WOKDeliv inherits DeliveryMetaStep from WOKDeliv + + ---Purpose: Process interfaces for delivery units (client stub) + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(abp : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliverySTUBClient from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is private; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + +end DeliverySTUBClient; diff --git a/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cxx b/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cxx new file mode 100755 index 0000000..b6779fd --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySTUBClient.cxx @@ -0,0 +1,175 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliverySTUBClient.cxx +// Created: Mon Aug 19 14:50:32 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +WOKDeliv_DeliverySTUBClient::WOKDeliv_DeliverySTUBClient(const Handle(WOKMake_BuildProcess)& abp, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryMetaStep(abp,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliverySTUBClient::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + myList = ParseCOMPONENTS(T_STUB_CLIENT); + Standard_Boolean okexec = Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = WOKDeliv_DeliveryStep::GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + if (SubCode().IsNull()) { // Meta Step + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliverySTUBClient::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + } + else { + if (WOKernel_IsClient(thesourceunit)) { + thesourceunit->Open(); + + Handle(TCollection_HAsciiString) id = WOKMake_Step::StepOutputID(Unit()->Name(), + Code(), + thesourceunit->Name()); + Handle(WOKMake_OutputFile) outfile + = new WOKMake_OutputFile(id, + Handle(WOKernel_File)(), + Handle(WOKBuilder_Entity)(), + Handle(WOKUtils_Path)()); + + outfile->SetProduction(); + outfile->SetLocateFlag(Standard_True); + outfile->SetPhysicFlag(Standard_False); + outfile->SetStepID(Standard_True); + + Handle(WOKMake_Step) astep = BuildProcess()->GetAndAddStep(Unit(), Code(), thesourceunit->Name()); + astep->DoExecute(); + //astep->SetPrecedenceSteps(PrecedenceSteps()); + astep->SetTargets(Targets()); + astep->SetOptions(Options()); + + switch(astep->Make()) + { + case WOKMake_Failed: + case WOKMake_Unprocessed: + okexec = Standard_False; + break; + } + AddExecDepItem(infileCOMPONENTS,outfile, Standard_True); + } + } + itpck.Next(); + } + } + else { // Execute a step list + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(SubCode()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryClient::Execute" << "Cannot locate unit : " << SubCode() << endm; + } + else { + Handle(WOKBuilder_Entity) bidon; + Handle(TCollection_HAsciiString) namestep; + WOKUtils_Extension theext; + Standard_Boolean mustbuild = Standard_True; + + Handle(TCollection_HAsciiString) thestat = Unit()->Params().Eval("%Station"); + if ((!strcmp(thestat->ToCString(),"sun")) || + (!strcmp(thestat->ToCString(),"hp"))) { + mustbuild = Standard_False; + } + + if (mustbuild) { + namestep = new TCollection_HAsciiString("obj.comp"); + theext = WOKUtils_ObjectFile; + } + else { + namestep = new TCollection_HAsciiString("obj.lib"); + theext = WOKUtils_DSOFile; + } + thesourceunit->Open(); + Handle(WOKMake_Step) thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namestep, + Handle(TCollection_HAsciiString)()); + if (!thestep.IsNull()) { + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliverySTUBClient::Execute" + << "Step " << namestep << " not done for unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + theinfile->GetPath(); + if (theinfile->Path()->Extension() == theext) { + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + } + } + else { + ErrorMsg << "WOKDeliv_DeliverySTUBClient::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + okexec = Standard_False; + } + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + +Standard_Boolean WOKDeliv_DeliverySTUBClient::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliverySTUBClient::AdmFileType() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STADMFILE); + return result; +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryShared.cdl b/src/WOKDeliv/WOKDeliv_DeliveryShared.cdl new file mode 100755 index 0000000..95095ac --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryShared.cdl @@ -0,0 +1,40 @@ +-- File: WOKDeliv_DeliveryShared.cdl +-- Created: Tue Aug 13 14:30:42 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliveryShared from WOKDeliv inherits DeliveryLIB from WOKDeliv + + ---Purpose: Process Shared Libraries for delivery units + +uses DevUnit from WOKernel, + Step from WOKMake, + BuildProcess from WOKMake, + InputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryShared from WOKDeliv; + + SetList(me:mutable); + + NeedsObjects(me) + returns Boolean; + + CreateSubStep(me; asource : DevUnit from WOKernel; needobj : Boolean) + returns Step from WOKMake; + + ComputeOutputLIB(me: mutable; asource : DevUnit from WOKernel; + inComp : InputFile from WOKMake); + + IsAvailable(me; asource : DevUnit from WOKernel) + returns Boolean; + +end DeliveryShared; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryShared.cxx b/src/WOKDeliv/WOKDeliv_DeliveryShared.cxx new file mode 100755 index 0000000..30d6641 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryShared.cxx @@ -0,0 +1,108 @@ +// Copyright: Matra-Datavision 1996 +// File: WOKDeliv_DeliveryShared.cxx +// Created: Tue Aug 13 14:33:27 1996 +// Author: Arnaud BOUZY +// + + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifdef WNT +# include +#endif // WNT + +WOKDeliv_DeliveryShared::WOKDeliv_DeliveryShared(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) + : WOKDeliv_DeliveryLIB(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryShared::SetList() +{ + myList = ParseCOMPONENTS(T_SHARED); +} + +Standard_Boolean WOKDeliv_DeliveryShared::NeedsObjects() const +{ + return Standard_False; +} + + +void WOKDeliv_DeliveryShared::ComputeOutputLIB(const Handle(WOKernel_DevUnit)& thesourceunit, + const Handle(WOKMake_InputFile)& inCOMP) +{ + static Handle(TCollection_HAsciiString) namestep = new TCollection_HAsciiString("obj.lib"); + static Handle(TCollection_HAsciiString) namesteptk = new TCollection_HAsciiString("lib.build"); + Handle(WOKBuilder_Entity) bidon; +#ifdef WNT + WOKUtils_Extension ext; +#endif // WNT + + + Handle(WOKMake_Step) thestep; + if (WOKernel_IsToolkit(thesourceunit)) { + thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namesteptk, + Handle(TCollection_HAsciiString) ()); + } + else { + thestep = BuildProcess()->GetAndAddStep(thesourceunit, + namestep, + Handle(TCollection_HAsciiString) ()); + } + if (!thestep.IsNull()) { + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryShared::Execute" + << "Step " << thestep->Code() << " unprocessed for unit " + << thesourceunit->Name() << endm; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + theinfile->GetPath(); +#ifndef WNT + if (theinfile->Path()->Extension() == WOKUtils_DSOFile) { +#else + ext = theinfile -> Path () -> Extension (); + + if ( ext == WOKUtils_LIBFile || ext == WOKUtils_DLLFile || + ext == WOKUtils_PDBFile || ext == WOKUtils_EXEFile + ) { +#endif // WNT + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetLocateFlag(Standard_True); + outfile->SetExtern(); + AddExecDepItem(inCOMP,outfile,Standard_True); + } + } + } + } +} + +Standard_Boolean WOKDeliv_DeliveryShared::IsAvailable(const Handle(WOKernel_DevUnit)& asource) const +{ + if (WOKernel_IsPackage(asource)) return Standard_True; + if (WOKernel_IsNocdlpack(asource)) return Standard_True; + if (WOKernel_IsToolkit(asource)) return Standard_True; + if (WOKernel_IsSchema(asource)) return Standard_True; + return Standard_False; +} diff --git a/src/WOKDeliv/WOKDeliv_DeliverySource.cdl b/src/WOKDeliv/WOKDeliv_DeliverySource.cdl new file mode 100755 index 0000000..d84f850 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySource.cdl @@ -0,0 +1,24 @@ +-- File: WOKDeliv_DeliverySource.cdl +-- Created: Wed Mar 20 16:36:48 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +class DeliverySource from WOKDeliv inherits Source from WOKStep + + ---Purpose: Computes a DeliverySource File List + +uses BuildProcess from WOKMake, + DevUnit from WOKernel, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliverySource from WOKDeliv; + +end DeliverySource; diff --git a/src/WOKDeliv/WOKDeliv_DeliverySource.cxx b/src/WOKDeliv/WOKDeliv_DeliverySource.cxx new file mode 100755 index 0000000..e0d296b --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliverySource.cxx @@ -0,0 +1,16 @@ +// File: WOKDeliv_DeliverySource.cxx +// Created: Wed Mar 20 16:43:50 1996 +// Author: Arnaud BOUZY +// + + +#include + +WOKDeliv_DeliverySource::WOKDeliv_DeliverySource(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden ) + : WOKStep_Source(aprocess,aunit,acode,checked,hidden) +{ +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryStep.cdl b/src/WOKDeliv/WOKDeliv_DeliveryStep.cdl new file mode 100755 index 0000000..8a46066 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryStep.cdl @@ -0,0 +1,101 @@ +-- File: WOKMake_DeliveryStep.cdl +-- Created: Fri Mar 29 13:50:52 1996 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1996 + + +deferred class DeliveryStep from WOKDeliv inherits Step from WOKMake + + ---Purpose: Describes general services for delivery steps + +uses DevUnit from WOKernel, + File from WOKernel, + Parcel from WOKernel, + Locator from WOKernel, + Path from WOKUtils, + HAsciiString from TCollection, + AsciiString from TCollection, + DeliveryList from WOKDeliv, + InputFile from WOKMake, + BuildProcess from WOKMake, + HSequenceOfInputFile from WOKMake, + OutputFile from WOKMake + + +is + Initialize(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard); + + + AdmFile(me; aname : HAsciiString from TCollection) + returns mutable File from WOKernel + is redefined; + + OutputDirTypeName(me) + returns HAsciiString from TCollection + is protected; + + GetCOMPONENTS(me:mutable) + returns File from WOKernel + is protected; + + ParseCOMPONENTS(me:mutable; aDeliveryStep : Integer) + returns DeliveryList from WOKDeliv + is protected; + + + CopyAFile(myclass; delivunit : DevUnit from WOKernel; + fromFile,toFile : File from WOKernel; + silent : Boolean = Standard_False) + returns Boolean; + + + GetParcel(myclass; delivunit : DevUnit from WOKernel; + name : HAsciiString from TCollection) + returns Parcel from WOKernel; + + GetParcelUnit(myclass; delivunit : DevUnit from WOKernel; + parcel : Parcel from WOKernel ; + aUnit : DevUnit from WOKernel) + returns DevUnit from WOKernel; + + GetFullParcelName(me: mutable; aParcelUnitName : HAsciiString from TCollection) + returns HAsciiString from TCollection + is protected; + + DefineLocator(me: mutable) + returns Locator from WOKernel + is private; + + GetInFileCOMPONENTS(me) + returns InputFile from WOKMake + is protected; + + DefineOutLocator(me:mutable) + is protected; + + OutLocator(me) + returns mutable Locator from WOKernel + is redefined; + + HandleOutputFile(me:mutable; anfile : OutputFile from WOKMake) + ---Purpose: Handles Output file new/same/disappereread + returns Boolean from Standard + is redefined protected; + + AcquitExecution(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is redefined protected; + + +fields + + myOutLocator : Locator from WOKernel is protected; + myList : DeliveryList from WOKDeliv is protected; + + myParcelLocator : Locator from WOKernel is protected; + + +end DeliveryStep; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryStep.cxx b/src/WOKDeliv/WOKDeliv_DeliveryStep.cxx new file mode 100755 index 0000000..21f5542 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryStep.cxx @@ -0,0 +1,430 @@ +// File: WOKDeliv_DeliveryStep.cxx +// Created: Fri Mar 29 13:55:59 1996 +// Author: Arnaud BOUZY +// + + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +WOKDeliv_DeliveryStep::WOKDeliv_DeliveryStep(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) +{ +} + +Handle(WOKernel_File) WOKDeliv_DeliveryStep::AdmFile(const Handle(TCollection_HAsciiString)& aname) const +{ + Handle(WOKernel_File) result; + if (aname->IsSameString(OutputFilesFileName())) { + if (!myOutLocator.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + Handle(WOKernel_DevUnit) parcelunit = GetParcelUnit(Unit(),theParcel,Unit()); + result = new WOKernel_File(aname, parcelunit, parcelunit->GetFileType(AdmFileType())); + result->GetPath(); + return result; + } + } + } + result = new WOKernel_File(aname, Unit(), Unit()->GetFileType(AdmFileType())); + result->GetPath(); + return result; +} + + +Handle(WOKernel_File) WOKDeliv_DeliveryStep::GetCOMPONENTS() +{ + // file COMPONENTS + Handle(TCollection_HAsciiString) COMPName = new TCollection_HAsciiString("COMPONENTS"); + Handle(TCollection_HAsciiString) sourcetype = new TCollection_HAsciiString("source"); + return Locator()->Locate(Unit()->Name(), sourcetype, COMPName); +} + +Handle(WOKDeliv_DeliveryList) WOKDeliv_DeliveryStep::ParseCOMPONENTS(const Standard_Integer aStep) +{ + Handle(WOKDeliv_DeliveryList) dlist; + Handle(WOKernel_File) filCOMP = GetCOMPONENTS(); + if (!filCOMP.IsNull()) { + filCOMP->GetPath(); + if (WOKDeliv_Delivery_SetFile(filCOMP->Path()->Name()->ToCString())) { + dlist = WOKDeliv_Delivery_Parse(aStep); + WOKDeliv_Delivery_CloseFile(); + } + else { + ErrorMsg << "WOKDeliv_DeliveryStep::Parse" << "Error getting file COMPONENTS" << endm; + SetFailed(); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryStep::Parse" << "Error locating file COMPONENTS" << endm; + SetFailed(); + } + return dlist; +} + +Standard_Boolean WOKDeliv_DeliveryStep::CopyAFile(const Handle(WOKernel_DevUnit)& delivunit, + const Handle(WOKernel_File)& fromFile, + const Handle(WOKernel_File)& toFile, + const Standard_Boolean silent) +{ + static Handle(TCollection_HAsciiString) theshellscripttype = new TCollection_HAsciiString("shellscript"); + fromFile->GetPath(); + toFile->GetPath(); + Handle(WOKUtils_Path) fromP = fromFile->Path(); + Handle(WOKUtils_Path) toP = toFile->Path(); + Standard_Boolean tocopy = Standard_True; + if (toP->Exists()) { + if (!fromP->IsNewer(toP)) { + tocopy = !fromP->IsSameFile(toP); + if (!tocopy && !silent) { + WOK_TRACE { + VerboseMsg("WOK_DELIV") << "WOKDeliv_DeliveryStep::CopyAFile" + << "Identical file : " << fromP->Name() << " not copied." << endm; + } + } + } + } + if (tocopy) { + Handle(WOKUtils_Shell) ashell = WOKUtils_ShellManager::GetShell(); + if(!ashell->IsLaunched()) ashell->Launch(); + ashell->ClearOutput(); + delivunit->ChangeParams().Set("%Source",fromP->Name()->ToCString()); + + Handle(TCollection_HAsciiString) thecomm; + if (!fromP->IsDirectory()) { + delivunit->ChangeParams().Set("%Dest",toP->Name()->ToCString()); + if (fromFile->TypeName()->IsSameString(theshellscripttype)) { + thecomm = delivunit->ChangeParams().Eval("COMMAND_PreserveCopyAndChmodExecute"); + } + else { + thecomm = delivunit->ChangeParams().Eval("COMMAND_PreserveCopyAndChmod"); + } + } + else { + delivunit->ChangeParams().Set("%Dest",toP->DirName()->ToCString()); + thecomm = delivunit->ChangeParams().Eval("COMMAND_CopyAndChmodRecursive"); + } + + ashell->Execute(thecomm); + if (ashell->Status() == 0) { + if (!silent) { + InfoMsg << "WOKDeliv_DeliveryStep::CopyAFile" + << fromP->Name() << " copied to " << toP->Name() << endm; + } + ashell->ClearOutput(); + return Standard_True; + } + ErrorMsg << "WOKDeliv_DeliveryStep::CopyAFile" + << "Error occured in shell while copying " << fromP->Name() << " to " << toP->Name() << endm; + Handle(TColStd_HSequenceOfHAsciiString) aseq = ashell->Errors(); + for(Standard_Integer i=1; i<= aseq->Length(); i++) { + ErrorMsg << "WOKDeliv_DeliveryStep::CopyAFile" + << aseq->Value(i) << endm; + } + ashell->ClearOutput(); + return Standard_False; + } + return Standard_True; +} + +Handle(WOKernel_Parcel) WOKDeliv_DeliveryStep::GetParcel(const Handle(WOKernel_DevUnit)& delivunit, const Handle(TCollection_HAsciiString)& thename) +{ + Handle(WOKernel_Session) theSession = delivunit->Session(); + Handle(TCollection_HAsciiString) thewb = delivunit->Nesting(); + + Handle(TCollection_HAsciiString) thews = theSession->GetWorkbench(thewb)->Nesting(); + + Handle(TCollection_HAsciiString) thef = theSession->GetWorkshop(thews)->Nesting(); + Handle(TCollection_HAsciiString) thewh = theSession->GetFactory(thef)->Warehouse(); + Handle(WOKernel_Warehouse) theWarehouse = theSession->GetWarehouse(thewh); + + Handle(TColStd_HSequenceOfHAsciiString) theparcs = theWarehouse->Parcels(); + for (Standard_Integer i=1; i<= theparcs->Length(); i++) { + Handle(WOKernel_Parcel) theparcel = theSession->GetParcel(theparcs->Value(i)); + if (theparcel->Name()->IsSameString(thename)) { + return theparcel; + } + } + return 0; +} + +Handle(WOKernel_DevUnit) WOKDeliv_DeliveryStep::GetParcelUnit(const Handle(WOKernel_DevUnit)& delivunit, + const Handle(WOKernel_Parcel)& theParcel, + const Handle(WOKernel_DevUnit)& aUnit) +{ + Handle(WOKernel_DevUnit) theunit; + + if (!theParcel.IsNull()) { + theParcel->Open(); + Handle(WOKernel_Session) theSession = delivunit->Session(); + Handle(TColStd_HSequenceOfHAsciiString) thenames = theParcel->Units(); + + for (Standard_Integer i=1; i<= thenames->Length(); i++) { + theunit = theSession->GetDevUnit(thenames->Value(i)); + if (theunit->Name()->IsSameString(aUnit->Name())) { + theunit->Open(); + return theunit; + } + } + + + theunit = theParcel->GetDevUnit(aUnit->Type(),aUnit->Name()); + Handle(WOKUtils_HSequenceOfParamItem) params = new WOKUtils_HSequenceOfParamItem(); + Handle(WOKUtils_HSequenceOfParamItem) buildpars = theunit->BuildParameters(params,Standard_True); + theunit->Build(buildpars); + theunit->Open(); + theParcel->AddUnit(theunit); + } + return theunit; +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryStep::GetFullParcelName(const Handle(TCollection_HAsciiString)& aname) +{ + if (myList.IsNull()) return 0; + if (aname->IsSameString(Unit()->Name())) { + return myList->GetName(); + } + Handle(WOKernel_Locator) theloc = DefineLocator(); + Handle(WOKernel_DevUnit) theunit = theloc->LocateDevUnit(aname); + if (theunit.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryStep::GetFullParcelName" << "cannot locate delivery " << aname->ToCString() << endm; + return 0; + } + Handle(WOKernel_UnitNesting) theNesting = Unit()->Session()->GetUnitNesting(theunit->Nesting()); + return theNesting->Name(); +} + +Handle(WOKernel_Locator) WOKDeliv_DeliveryStep::DefineLocator() +{ + if (myList.IsNull()) return myParcelLocator; + if (myParcelLocator.IsNull()) { + Handle(WOKernel_Session) theSession = Unit()->Session(); + Handle(TColStd_HSequenceOfHAsciiString) thevisib = new TColStd_HSequenceOfHAsciiString(); + Handle(TCollection_HAsciiString) thename; + // Contains current parcel + thename = GetParcel(Unit(),myList->GetName())->FullName(); + thevisib->Append(thename); + WOKTools_MapIteratorOfMapOfHAsciiString itreq(myList->GetRequireMap()); + while (itreq.More()) { + + Handle(WOKernel_DevUnit) theunit = Locator()->LocateDevUnit(itreq.Key()); + if (!theunit.IsNull()) { + Handle(WOKernel_UnitNesting) theNesting = Unit()->Session()->GetUnitNesting(theunit->Nesting()); + if (!theNesting->IsKind(STANDARD_TYPE(WOKernel_Workbench))) { + thevisib->Append(theNesting->FullName()); + } + else { + Handle(TCollection_HAsciiString) COMPName = new TCollection_HAsciiString("COMPONENTS"); + Handle(TCollection_HAsciiString) TypeName = new TCollection_HAsciiString("source"); + Handle(WOKernel_File) theCOMPFile = Locator()->Locate(theunit->Name(),TypeName,COMPName); + if (!theCOMPFile.IsNull()) { + theCOMPFile->GetPath(); + if (WOKDeliv_Delivery_SetFile(theCOMPFile->Path()->Name()->ToCString())) { + Handle(WOKDeliv_DeliveryList) alist = WOKDeliv_Delivery_Parse(T_BASE); + WOKDeliv_Delivery_CloseFile(); + if (!alist.IsNull()) { + Handle(WOKernel_Parcel) theparcel = GetParcel(Unit(),alist->GetName()); + if (!theparcel.IsNull()) { + thevisib->Append(theparcel->FullName()); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryStep::DefineLocator" << "Error while parsing file COMPONENTS for unit " << theunit->Name()->ToCString() << endm; + } + } + } + } + } + itreq.Next(); + } + myParcelLocator = new WOKernel_Locator(theSession,thevisib); + // a constituer + } + return myParcelLocator; +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryStep::OutputDirTypeName() const +{ + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)STTMPDIR); + return result; +} + + +Handle(WOKMake_InputFile) WOKDeliv_DeliveryStep::GetInFileCOMPONENTS() const +{ + for (Standard_Integer i=1; i<= myinflow.Extent(); i++) { + Handle(WOKernel_File) thefile = myinflow(i)->File(); + if (!strcmp(thefile->Name()->ToCString(),"COMPONENTS")) { + return myinflow(i); + } + } + return 0; +} + +void WOKDeliv_DeliveryStep::DefineOutLocator() +{ + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + Handle(TColStd_HSequenceOfHAsciiString) thevisib = new TColStd_HSequenceOfHAsciiString(); + thevisib->Append(theParcel->FullName()); + myOutLocator = new WOKernel_Locator(Unit()->Session(),thevisib); + } + } +} + + +Handle(WOKernel_Locator) WOKDeliv_DeliveryStep::OutLocator() const +{ + if (myOutLocator.IsNull()) { + return WOKMake_Step::OutLocator(); + } + return myOutLocator; +} + +Standard_Boolean WOKDeliv_DeliveryStep::HandleOutputFile(const Handle(WOKMake_OutputFile)& afile) +{ + if(afile.IsNull()) return Standard_False; + if(afile->IsProduction()) + { + switch(afile->Status()) + { + case WOKMake_Disappeared: + { + if(afile->File().IsNull()) { + Handle(WOKUtils_Path) oldpath = afile->LastPath(); + if (oldpath.IsNull()) return Standard_False; + oldpath->RemoveFile(); + InfoMsg << "WOKDeliv_DeliveryStep" + << "Remove file " << oldpath->Name() << endm; + + return Standard_True; + } + + 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 << "WOKDeliv_DeliveryStep::HandleOutputFile" + << "Could not determine Del action for type : " << afile->File()->TypeName() << endm; + ashell->UnLock(); + return Standard_False; + } + + if(! Unit()->Params().IsSet(atempl->ToCString())) + { + ErrorMsg << "WOKDeliv_DeliveryStep::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 << "WOKDeliv_DeliveryStep::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 << "WOKDeliv_DeliveryStep::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 << "WOKDeliv_DeliveryStep::HandleOutputFile" + << "Disappeared File (" << afile->File()->UserPathName() << ") does not exists " << endm; + } + } + ashell->UnLock(); + + } + } + } + return Standard_False; +} + +void WOKDeliv_DeliveryStep::AcquitExecution(const Handle(WOKMake_HSequenceOfInputFile)& execlist) +{ + WOKMake_Step::AcquitExecution(execlist); + + Handle(WOKernel_File) outfile = AdmFile(OutputFilesFileName()); + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theparcel = GetParcel(Unit(),myList->GetName()); + Handle(WOKernel_DevUnit) theparcelunit = GetParcelUnit(Unit(),theparcel,Unit()); + Handle(WOKernel_File) unitoutfile = + new WOKernel_File(OutputFilesFileName(), + theparcelunit, + theparcelunit->GetFileType(AdmFileType())); + CopyAFile(Unit(),outfile,unitoutfile,Standard_True); + } +} diff --git a/src/WOKDeliv/WOKDeliv_DeliveryStepList.cdl b/src/WOKDeliv/WOKDeliv_DeliveryStepList.cdl new file mode 100755 index 0000000..9a02439 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryStepList.cdl @@ -0,0 +1,46 @@ +-- File: WOKDeliv_DeliveryStepList.cdl +-- Created: Mon Jan 12 10:15:43 1998 +-- Author: Arnaud BOUZY +-- +---Copyright: Matra Datavision 1998 + +class DeliveryStepList from WOKDeliv inherits DeliveryStep from WOKDeliv + + ---Purpose: Process cdl for delivery units + +uses DevUnit from WOKernel, + File from WOKernel, + BuildProcess from WOKMake, + InputFile from WOKMake, + HSequenceOfInputFile from WOKMake, + HAsciiString from TCollection + +is + + Create(aprocess : BuildProcess from WOKMake; + aunit : DevUnit from WOKernel; + acode : HAsciiString from TCollection; + checked, hidden : Boolean from Standard) + returns mutable DeliveryStepList from WOKDeliv; + + Execute(me:mutable; execlist : HSequenceOfInputFile from WOKMake) + is protected; + + HandleInputFile(me:mutable; anitem : InputFile from WOKMake) + returns Boolean from Standard + is protected; + + AdmFileType(me) + returns HAsciiString from TCollection; + + ParameterCodeName(me) + returns HAsciiString from TCollection + is protected; + + IsToCopy(me; afile : File from WOKernel; + types : HAsciiString from TCollection; + extens : HAsciiString from TCollection) + returns Boolean from Standard + is protected; + +end DeliveryStepList; diff --git a/src/WOKDeliv/WOKDeliv_DeliveryStepList.cxx b/src/WOKDeliv/WOKDeliv_DeliveryStepList.cxx new file mode 100755 index 0000000..9f12da5 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_DeliveryStepList.cxx @@ -0,0 +1,196 @@ +// Copyright: Matra-Datavision 1998 +// File: WOKDeliv_DeliveryStepList.cxx +// Created: Mon Jan 12 10:17:15 1998 +// Author: Arnaud BOUZY +// + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +WOKDeliv_DeliveryStepList::WOKDeliv_DeliveryStepList(const Handle(WOKMake_BuildProcess)& aprocess, + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) +: WOKDeliv_DeliveryStep(aprocess,aunit,acode,checked,hidden) +{ +} + +void WOKDeliv_DeliveryStepList::Execute(const Handle(WOKMake_HSequenceOfInputFile)&) +{ + myList = ParseCOMPONENTS(T_BASE); + Standard_Boolean okexec = Standard_False; + if (!myList.IsNull()) { + Handle(WOKernel_Parcel) theParcel = GetParcel(Unit(),myList->GetName()); + if (!theParcel.IsNull()) { + okexec = Standard_True; + + WOKTools_MapIteratorOfMapOfHAsciiString itpck(myList->GetMap()); + Handle(WOKMake_InputFile) infileCOMPONENTS = GetInFileCOMPONENTS(); + Handle(WOKBuilder_Entity) bidon; + + while (itpck.More()) { + Handle(WOKernel_DevUnit) thesourceunit = Locator()->LocateDevUnit(itpck.Key()); + if (thesourceunit.IsNull()) { + okexec = Standard_False; + ErrorMsg << "WOKDeliv_DeliveryStepList::Execute" << "Cannot locate unit : " << itpck.Key()->ToCString() << endm; + SetFailed(); + } + else { + thesourceunit->Open(); + Handle(TCollection_HAsciiString) paramsteps = ParameterCodeName(); + paramsteps->AssignCat("steps"); + Handle(TCollection_HAsciiString) namesteps = thesourceunit->Params().Eval(paramsteps->ToCString()); + if (!namesteps.IsNull()) { + Handle(TCollection_HAsciiString) extcode = ParameterCodeName(); + extcode->AssignCat("extensions"); + Handle(TCollection_HAsciiString) extens = thesourceunit->Params().Eval(extcode->ToCString()); + Handle(TCollection_HAsciiString) typcode = ParameterCodeName(); + typcode->AssignCat("types"); + Handle(TCollection_HAsciiString) goodtypes = thesourceunit->Params().Eval(typcode->ToCString()); + + BuildProcess()->ComputeSteps(thesourceunit); + + Standard_Integer nums = 1; + Handle(TCollection_HAsciiString) namestep = namesteps->Token(" \t",nums); + while (!namestep->IsEmpty()) { + + Handle(WOKMake_Step) thestep = BuildProcess()->Find(thesourceunit, + namestep, + Handle(TCollection_HAsciiString) ()); + if (!thestep.IsNull()) { + thestep->DontExecute(); + thestep->Make(); + Handle(WOKMake_HSequenceOfOutputFile) thefiles = thestep->OutputFileList(); + if (thefiles.IsNull()) { + ErrorMsg << "WOKDeliv_DeliveryStepList::Execute" + << "Step " << namestep << " not done for unit " << thesourceunit->Name() << endm; + okexec = Standard_False; + } + else { + for (Standard_Integer i=1; i<= thefiles->Length(); i++) { + Handle(WOKernel_File) theinfile = thefiles->Value(i)->File(); + if (!theinfile.IsNull()) { + theinfile->GetPath(); + + if (IsToCopy(theinfile,goodtypes,extens)) { + Handle(WOKMake_OutputFile) outfile = + new WOKMake_OutputFile(theinfile->LocatorName(), + theinfile, + bidon, + theinfile->Path()); + outfile->SetReference(); + outfile->SetExtern(); + outfile->SetLocateFlag(Standard_True); + AddExecDepItem(infileCOMPONENTS,outfile,Standard_True); + } + } + } + } + } + nums++; + namestep = namesteps->Token(" \t",nums); + } + } + } + itpck.Next(); + } + } + else { + ErrorMsg << "WOKDeliv_DeliveryStepList::Execute" << "Cannot find delivery : " << myList->GetName()->ToCString() << endm; + } + } + if (okexec) { + SetSucceeded(); + } + else { + SetFailed(); + } +} + + +Standard_Boolean WOKDeliv_DeliveryStepList::HandleInputFile(const Handle(WOKMake_InputFile)& infile) +{ + Handle(WOKernel_File) file = infile->File(); + if (file.IsNull()) return Standard_False; + + if(!strcmp(file->Name()->ToCString(), "COMPONENTS")) { + return Standard_True; + } + + return Standard_False; + +} + + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryStepList::AdmFileType() const +{ + Handle(TCollection_HAsciiString) pcode = ParameterCodeName(); + pcode->AssignCat("admfiletype"); + Handle(TCollection_HAsciiString) admres = Unit()->Params().Eval(pcode->ToCString()); + if (!admres.IsNull()) { + return admres; + } + static Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString((char*)ADMFILE); + return result; +} + +Handle(TCollection_HAsciiString) WOKDeliv_DeliveryStepList::ParameterCodeName() const +{ + Handle(TCollection_HAsciiString) result = new TCollection_HAsciiString("%WOKSteps_"); + result->AssignCat("delivery_"); + Handle(TCollection_HAsciiString) code = new TCollection_HAsciiString(Code()->ToCString()); + code->ChangeAll('.','_'); + result->AssignCat(code); + result->AssignCat("_"); + return result; +} + +Standard_Boolean WOKDeliv_DeliveryStepList::IsToCopy(const Handle(WOKernel_File)& file, + const Handle(TCollection_HAsciiString)& goodtypes, + const Handle(TCollection_HAsciiString)& extens) const +{ + Standard_Integer i; + + if (!goodtypes.IsNull()) { + i = 1; + Handle(TCollection_HAsciiString) atype = goodtypes->Token(" \t",i); + Standard_Boolean found = Standard_False; + while ((!atype->IsEmpty()) && !found) { + found = atype->IsSameString(file->TypeName()); + i++; + atype = goodtypes->Token(" \t",i); + } + if (!found) return Standard_False; + } + + Handle(WOKUtils_Path) thepath = file->Path(); + if (thepath.IsNull()) return Standard_False; + + if (!extens.IsNull()) { + + Handle(TCollection_HAsciiString) fileext = thepath->ExtensionName(); + i = 1; + Handle(TCollection_HAsciiString) atype = extens->Token(" \t",i); + Standard_Boolean found = Standard_False; + while ((!atype->IsEmpty()) && !found) { + found = atype->IsSameString(fileext,Standard_False); + i++; + atype = extens->Token(" \t",i); + } + if (!found) return Standard_False; + } + + return Standard_True; + +} diff --git a/src/WOKDeliv/WOKDeliv_FRONTALSCRIPT.edl b/src/WOKDeliv/WOKDeliv_FRONTALSCRIPT.edl new file mode 100755 index 0000000..67e9860 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_FRONTALSCRIPT.edl @@ -0,0 +1,303 @@ +@template WOKDeliv_FrontalScript(%DeliveryHomeName, %UnitName) is +$#!/bin/csh -f +$## this is a template file for Frontal Building in Deliveries +$## lines added by umake on a delivery : +$# +$set CCL_LELISP = ${CCLHOME}/${STATION}/bin/lelisp.bin +$set CCL_COREFILE = $%DeliveryHomeName/${STATION}/lib/%UnitName.core +$# +$setenv CSF_VERBOSE 0 +$set CCL_DEBUGGER="exec" +$set LOGFILE=0 +$# +$set i = 1 +$while ($i <= $#argv) +$ set c = $argv[$i] +$ set i = `expr $i + 1` +$ if (`expr $c = -h`) then +$ echo "-f " +$ echo "-v : set verbose mode" +$ echo "-w : print stack on error" +$ echo "-d : start a debug session on error" +$ echo "-record : record a session" +$ echo "-play : play a record session" +$ echo "-reference : set reference directory for record session" +$ echo "-result : set result directory for record session" +$ echo "-trace : outputs shareable images loading and diagnostics" +$ echo "-debug : start CCL with debug" +$ echo "-log : outputs in file" +$ exit(0) +$ endif +$ if (`expr $c = -f`) then +$ setenv CCL_FILE $argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -showcode`) then +$ setenv CCL_CODE 1 +$ endif +$ if (`expr $c = -v`) then +$ setenv CCL_VERBOSE 1 +$ endif +$ if (`expr $c = -w`) then +$ setenv CCL_WHERE 1 +$ endif +$ if (`expr $c = -d`) then +$ setenv CCL_DEBUG 1 +$ endif +$ if (`expr $c = -util`) then +$ setenv CCL_UTIL 1 +$ endif +$ if (`expr $c = -trace`) then +$ setenv CSF_VERBOSE 1 +$ endif +$ if (`expr $c = -record`) then +$ setenv TR_Status record +$ setenv TR_File $argv[$i] +$ set i = `expr $i + 1` +$ setenv TR_Comment $argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -play`) then +$ setenv TR_Status play +$ setenv TR_File $argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -reference`) then +$ setenv TR_RefDir $argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -result`) then +$ setenv TR_ResDir $argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -log`) then +$ set LOGFILE=$argv[$i] +$ set i = `expr $i + 1` +$ endif +$ if (`expr $c = -debug`) then +$ set CCL_DEBUGGER="dbx" +$ if (`expr $STATION = ao1` ) then +$ set CCL_DEBUGGER="decladebug" +$ endif +$ if (`expr $STATION = sil` ) then +$ set CCL_DEBUGGER="cvd" +$ setenv TRAP_FPE "UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT" +$ endif +$ if (`expr $STATION = hp` ) then +$ set CCL_DEBUGGER="dde" +$ endif +$ echo "-stack 12 -code 1500 -heap 8192 -number 0 -vector 32 -string 50 -symbol 30 -float 0 -cons 8 -r $CCL_COREFILE" +$ endif +$end +$if (`expr $CCL_DEBUGGER = exec` ) then +$ if (`expr $LOGFILE = 0` ) then +$ exec $CCL_LELISP -stack 12 -code 1500 -heap 8192 -number 0 -vector 32 -string 50 -symbol 30 -float 0 -cons 80 -r $CCL_COREFILE +$ else +$ exec $CCL_LELISP -stack 12 -code 1500 -heap 8192 -number 0 -vector 32 -string 50 -symbol 30 -float 0 -cons 80 -r $CCL_COREFILE > $LOGFILE +$ endif +$else +$ $CCL_DEBUGGER $CCL_LELISP +$endif +$ +@end; + + +@if (%Station == "wnt") then + +@template WOKDeliv_CCLScript(%DeliveryHomeName,%UnitName) is +$@echo off +$rem this is a template file for Frontal Building by umake +$ +$set CSF_VERBOSE=0 +$set CCL_DEBUGGER=exec +$set LOGFILE=0 +$set CCL_FILE=%%DeliveryHomeName%/inc/%UnitName.ccl +$set opts= +$ +$:loop +$if "%1" == "" goto endloop +$ set treated=0 +$ set c=%1 +$ shift +$ +$ if "%c%"=="/h" goto thehelp +$ +$ if "%c%"=="/play" set TR_Status=play +$ if "%c%"=="/play" set TR_File=%1 +$ if "%c%"=="/play" shift +$ if "%c%"=="/play" set treated=1 +$ +$ if "%c%"=="/record" set TR_Status=record +$ if "%c%"=="/record" set TR_File=%1 +$ if "%c%"=="/record" shift +$ if "%c%"=="/record" set TR_Comment=%1 +$ if "%c%"=="/record" shift +$ if "%c%"=="/record" set treated=1 +$ +$ if "%c%"=="/reference" set TR_RefDir=%1 +$ if "%c%"=="/reference" shift +$ if "%c%"=="/reference" set treated=1 +$ +$ if "%c%"=="/result" set TR_ResDir=%1 +$ if "%c%"=="/result" shift +$ if "%c%"=="/result" set treated=1 +$ +$ if "%c%"=="/trace" set CSF_VERBOSE=1 +$ if "%c%"=="/trace" set treated=1 +$ +$ if "%c%"=="/log" set LOGFILE=%1 +$ if "%c%"=="/log" shift +$ if "%c%"=="/log" set treated=1 +$ +$ if "%c%"=="/debug" set CCL_DEBUGGER=msdev +$ if "%c%"=="/debug" set treated=1 +$ +$ if "%treated%"=="0" set opts=%opts% %c% +$goto loop +$ +$:endloop +$if not "%CSF_MESSAGE%" == "" goto run +$set CCL_INTER_MSGFILE=%%DeliveryHomeName%/wnt/bin/%UnitName_Cmp.us +$if exist %CCL_INTER_MSGFILE% set CSF_MESSAGE=%CCL_INTER_MSGFILE% +$if not exist %CCL_INTER_MSGFILE% set CSF_MESSAGE=%%DeliveryHomeName%/etc/locale/%UnitName.us +$ +$set CCL_INTER_MSGFILE= +$:run +$if "%CCL_DEBUGGER%"=="exec" goto exec +$ echo Start debugger on process then perform (start) on interpretor +$ CCLinterpretor %CCL_FILE% %opts% +$ goto fini +$ +$:exec +$ if "%LOGFILE%"=="0" CCLinterpretor %CCL_FILE% %opts% /call start +$ if not "%LOGFILE%"=="0" CCLinterpretor %CCL_FILE% %opts% /call start > %LOGFILE% +$ goto fini +$:thehelp +$ echo "/play : play a record session" +$ echo "/record : record a session" +$ echo "/reference : set reference directory for record session" +$ echo "/result : set result directory for record session" +$ echo "/v : set verbose mode" +$ echo "/w : print stack on error" +$ echo "/d : start a debug session on error" +$ echo "/spy : trace macros, commands and all engine requests" +$ echo "/call : call the macro (start is default)" +$ echo "/trace : outputs shareable images loading and diagnostics" +$ echo "/log : outputs in a file" +$ echo "/debug : start CCL with debugger" +$ echo " ... : load these files" +$ goto fini +$:fini +@end; + +@else + +@template WOKDeliv_CCLScript(%DeliveryHomeName,%UnitName) is +$#!/bin/csh -f +$## this is a template file for Frontal Building +$## lines built by umake : +$# +$setenv CSF_VERBOSE 0 +$set CCL_DEBUGGER="exec" +$set LOGFILE=0 +$set CCL_FILE=$%DeliveryHomeName/inc/%UnitName.ccl +$ +$set i = 1 +$set opts = "" +$while ($i <= $#argv) +$ set c = $argv[$i] +$ set i = `expr $i + 1` +$ set treated = 0 +$ if (`expr $c = -h`) then +$ echo "-play : play a record session" +$ echo "-record : record a session" +$ echo "-reference : set reference directory for record session" +$ echo "-result : set result directory for record session" +$ echo "-f : load a file" +$ echo "-v : set verbose mode" +$ echo "-w : print stack on error" +$ echo "-d : start a debug session on error" +$ echo "-spy : trace macros, commands and all engine requests" +$ echo "-call : call the macro (start is default)" +$ echo "-trace : outputs shareable images loading and diagnostics" +$ echo "-log : outputs in a file" +$ echo "-debug : start CCL with debugger" +$ echo " ... : load these files" +$ exit(0) +$ endif +$ if (`expr $c = -record`) then +$ setenv TR_Status record +$ setenv TR_File $argv[$i] +$ set i = `expr $i + 1` +$ setenv TR_Comment $argv[$i] +$ set i = `expr $i + 1` +$ set treated = 1 +$ endif +$ if (`expr $c = -play`) then +$ setenv TR_Status play +$ setenv TR_File $argv[$i] +$ set i = `expr $i + 1` +$ set treated = 1 +$ endif +$ if (`expr $c = -reference`) then +$ setenv TR_RefDir $argv[$i] +$ set i = `expr $i + 1` +$ set treated = 1 +$ endif +$ if (`expr $c = -result`) then +$ setenv TR_ResDir $argv[$i] +$ set i = `expr $i + 1` +$ set treated = 1 +$ endif +$ if (`expr $c = -f`) then +$ set treated = 1 +$ endif +$ if (`expr $c = -trace`) then +$ setenv CSF_VERBOSE 1 +$ set treated = 1 +$ endif +$ if (`expr $c = -log`) then +$ set LOGFILE=$argv[$i] +$ set i = `expr $i + 1` +$ set treated = 1 +$ endif +$ if (`expr $c = -debug`) then +$ set treated = 1 +$ set CCL_DEBUGGER="dbx" +$ if (`expr $STATION = ao1`) then +$ set CCL_DEBUGGER="decladebug" +$ endif +$ if (`expr $STATION = sil`) then +$ set CCL_DEBUGGER="cvd" +$ setenv TRAP_FPE "UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT" +$ endif +$ if (`expr $STATION = hp`) then +$ set CCL_DEBUGGER="dde" +$ endif +$ endif +$ if ($treated == 0) then +$ set opts = "$opts $c" +$ endif +$end +$ +$if ( ! $?CSF_MESSAGE ) then +$ if (-x $%DeliveryHomeName/${STATION}/bin/%UnitName_Cmp.us) then +$ setenv CSF_MESSAGE $%DeliveryHomeName/${STATION}/bin/%UnitName_Cmp.us +$ else +$ setenv CSF_MESSAGE $%DeliveryHomeName/etc/locale/%UnitName.us +$ endif +$endif +$ +$if (`expr $CCL_DEBUGGER = exec`) then +$ if (`expr $LOGFILE = 0`) then +$ CCLinterpretor $CCL_FILE $opts -call start +$ else +$ CCLinterpretor $CCL_FILE $opts -call start >$LOGFILE +$ endif +$else +$ echo " $CCL_FILE $opts -call start" +$ $CCL_DEBUGGER `which CCLinterpretor` +$endif +@end; + +@endif; diff --git a/src/WOKDeliv/WOKDeliv_LDSCRIPT.edl b/src/WOKDeliv/WOKDeliv_LDSCRIPT.edl new file mode 100755 index 0000000..228a2c7 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_LDSCRIPT.edl @@ -0,0 +1,86 @@ + +@template WOKDeliv_LDInit(%EngineName) is +$proc WOKDeliv_MakePathld {} { +$ +$if {[wokparam -t %%EngineName_LoadPath]} { +$ set envload [wokparam -e %%EngineName_LoadPath]: +$} else { +$ set envload "" +$} +@end; + +@template WOKDeliv_MAKELDInit() is +$return $envload +$} +$ +$proc WOKDeliv_Makeld {fact} { +$ +$set envload [WOKDeliv_MakePathld] +$ +$set orig ${fact}:[finfo -W $fact] +$ +@end; + +@template WOKDeliv_FirstValue(%UlName) is +$return ${envload}${LibDir_%UlName}\^ +@end; + +@if (%Station != "wnt") then + +-- Case UNIX + +@template WOKDeliv_AddingValue(%Value) is +$set envload ${envload}%Value: +@end; + +@template WOKDeliv_NextValue(%PreviousVal,%UlName) is +$%PreviousVal:${LibDir_%UlName}\^ +@end; + +-- End Case UNIX + +@else + +-- Case NT + +@template WOKDeliv_AddingValue(%Value) is +$set envload ${envload}%Value\; +@end; + +@template WOKDeliv_NextValue(%PreviousVal,%UlName) is +$%PreviousVal\;${LibDir_%UlName}\^ +@end; + +-- End Case NT + +@endif; + +@template WOKDeliv_DeclHome(%UlName) is +$set LibDir_%UlName [wokparam -e WOKEntity_libdir ${orig}:%UlName] +@end; + +@template WOKDeliv_LDEnd() is +$ +$} +$ +@end; + + +@template WOKDeliv_MAKELDList() is +$proc WOKDeliv_LDList {} { +$ +$ set lp {} +$ lappend lp [WOKDeliv_MakePathld] +$ set l {} +@end; + +@template WOKDeliv_AddULList(%UlName) is +$ lappend l %UlName +@end; + +@template WOKDeliv_EndLDList () is +$ +$ lappend lp $l +$ return $lp +$} +@end; diff --git a/src/WOKDeliv/WOKDeliv_ParseDelivery.cxx b/src/WOKDeliv/WOKDeliv_ParseDelivery.cxx new file mode 100755 index 0000000..0fb229f --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_ParseDelivery.cxx @@ -0,0 +1,262 @@ +// File: WOKMake_ParseDelivery.cxx +// Created: Wed Mar 20 17:55:24 1996 +// Author: Arnaud BOUZY +// + +#include +#include +#include + +#include + +#include +#include + +static Handle(WOKDeliv_DeliveryList) thelist; +static Handle(TCollection_HAsciiString) curunit; +static Handle(TCollection_HAsciiString) getunit; +static Handle(TCollection_HAsciiString) gettype; +static Standard_Boolean goandtreat=Standard_True; + +extern "C" { + + extern int DELIVERYlineno; + + int DELIVERYparse(); + + int DELIVERYrestart(FILE*); + + int TheToken; + char* TheText; + int TheType; + int TheAttrib; + extern FILE* DELIVERYin; + int ErrorEncoutered; + + int Traite_Ifdef(char* s) + { +#ifdef WNT + char* name="WNT"; +#else + char* name="UNIX"; +#endif + if (!strcmp(name,s)) { + goandtreat = Standard_True; + } + else { + goandtreat = Standard_False; + } + return 0; + } + + int Traite_Endif() + { + goandtreat = Standard_True; + return 0; + } + + int Traite_PutPath() + { + if (goandtreat) { + thelist->SetPutPath(); + } + return 0; + } + + int Traite_PutInclude() + { + if (goandtreat) { + thelist->SetPutInclude(); + } + return 0; + } + + int Traite_PutLib() + { + if (goandtreat) { + thelist->SetPutLib(); + } + return 0; + } + + int Traite_GetUnit(char* s) + { + if (goandtreat) { + if (thelist->GetStep() == T_GET) { + getunit = new TCollection_HAsciiString(s); + } + } + return 0; + } + + int Traite_GetType(char* s) + { + if (goandtreat) { + if (thelist->GetStep() == T_GET) { + gettype = new TCollection_HAsciiString(s); + } + } + return 0; + } + + + int Traite_GetFile(char* s) + { + if (goandtreat) { + if (thelist->GetStep() == T_GET) { + getunit->AssignCat(":"); + getunit->AssignCat(gettype); + getunit->AssignCat(":"); + Handle(TCollection_HAsciiString) thes = new TCollection_HAsciiString(s); + getunit->AssignCat(thes); + if (!thelist->ChangeMap().Add(getunit)) { + WarningMsg << "WOKDeliv_ParseDelivery" << " Get " + << getunit->ToCString() << " already sent" << endm; + } + } + } + return 0; + } + + int Traite_Name(char* s) + { + if (goandtreat) { + thelist->SetName(s); + } + return 0; + } + + int Traite_Requires(char* s) + { + if (goandtreat) { + Handle(TCollection_HAsciiString) thes = new TCollection_HAsciiString(s); + if (!thelist->ChangeRequireMap().Add(thes)) { + WarningMsg << "WOKDeliv_ParseDelivery" << " Requires " + << s << " already sent" << endm; + } + } + return 0; + } + + + int ClasseElt_DeliverFormatBase(int, char* s) + { + if (goandtreat) { + curunit = new TCollection_HAsciiString(s); + if (thelist->GetStep() == T_BASE) { + thelist->ChangeMap().Add(curunit); + } + } + return 0; + } + + int ClasseElt_DeliverFormat(int tokattr) + { + if (goandtreat) { + int thestep = thelist->GetStep(); + Standard_Boolean doit = (thestep == tokattr); + if (tokattr == T_LIBRARY) { + if (thestep == T_ARCHIVE) { + doit = Standard_True; + } + if (thestep == T_SHARED) { + doit = Standard_True; + } + } + if (doit) { + if (!thelist->ChangeMap().Add(curunit)) { + WarningMsg << "WOKDeliv_ParseDelivery" << " Unit " + << curunit->ToCString() << " already sent" << endm; + } + } + } + return 0; + } + + + int ClasseElt_EndDeliverFormat() + { + // est-ce bien utile... + return 0; + } + + int ClasseElt_DeliverFormatAll(int tokunit, char* s) + { + if (goandtreat) { + ClasseElt_DeliverFormatBase(tokunit,s); + if (thelist->GetStep() != T_GET) { + if (thelist->GetStep() != T_STATIC) { + thelist->ChangeMap().Add(curunit); // en attendant mieux + } + } + ClasseElt_EndDeliverFormat(); + } + return 0; + } + + int DELIVERYwrap() + { + return 1; + } + + int DELIVERYerror(char* msg) + { + if (msg == NULL) { + ErrorMsg << "ParseCOMPONENTS" << "COMPONENTS, line " << DELIVERYlineno << " : syntax error..." << endm; + } + else { + ErrorMsg << "ParseCOMPONENTS" << "COMPONENTS, line " << DELIVERYlineno << " : " << msg << endm; + } + ErrorEncoutered = 1; + return 1; + } +} + +Standard_Boolean WOKDeliv_Delivery_SetFile(char* filename) +{ + DELIVERYin = fopen(filename,"r"); + if (DELIVERYin) { + return Standard_True; + } + return Standard_False; +} + +void WOKDeliv_Delivery_CloseFile() +{ + if (DELIVERYin) { + fclose(DELIVERYin); + } +} + +Handle(WOKDeliv_DeliveryList) WOKDeliv_Delivery_Parse(int aStep) +{ + thelist = new WOKDeliv_DeliveryList(aStep); + goandtreat = Standard_True; + DELIVERYlineno = 1; + DELIVERYrestart(DELIVERYin); + ErrorEncoutered = 0; + DELIVERYparse(); + if (ErrorEncoutered == 0) return thelist; + thelist.Nullify(); + return thelist; +} + + +void WOKDeliv_DeliveryList_Dump(const Handle(WOKDeliv_DeliveryList)& alist) +{ + InfoMsg << "Dump of DeliveryList" << endm; + InfoMsg << "Name" << endm; + InfoMsg << alist->GetName()->ToCString() << endm; + InfoMsg << "Requires" << endm; + WOKTools_MapIteratorOfMapOfHAsciiString it1(alist->GetRequireMap()); + while (it1.More()) { + InfoMsg << it1.Key()->ToCString() << endm; + it1.Next(); + } + InfoMsg << "Content" << endm; + WOKTools_MapIteratorOfMapOfHAsciiString it2(alist->GetMap()); + while (it2.More()) { + InfoMsg << it2.Key()->ToCString() << endm; + it2.Next(); + } +} diff --git a/src/WOKDeliv/WOKDeliv_ParseDelivery.h b/src/WOKDeliv/WOKDeliv_ParseDelivery.h new file mode 100755 index 0000000..6dbd7e0 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_ParseDelivery.h @@ -0,0 +1,26 @@ +#ifndef _WOKDeliv_ParseDelivery_HeaderFile + +#include +extern int TheToken; +extern int DELIVERYlineno; +extern char* TheText; +extern int TheType; +extern int TheAttrib; +int Traite_PutPath(); +int Traite_PutInclude(); +int Traite_PutLib(); +int Traite_GetUnit(char* s); +int Traite_GetType(char* s); +int Traite_GetFile(char* s); +int Traite_Name(char* s); +int Traite_Requires(char* s); +int Traite_Ifdef(char* s); +int Traite_Endif(); +int ClasseElt_DeliverFormatAll(int tokunit, char* s); +int ClasseElt_DeliverFormatBase(int tokunit, char* s); +int ClasseElt_DeliverFormat(int tokattr); +int ClasseElt_EndDeliverFormat(); + + +#define _WOKDeliv_ParseDelivery_HeaderFile +#endif diff --git a/src/WOKDeliv/WOKDeliv_ParseDelivery.hxx b/src/WOKDeliv/WOKDeliv_ParseDelivery.hxx new file mode 100755 index 0000000..baa7bb9 --- /dev/null +++ b/src/WOKDeliv/WOKDeliv_ParseDelivery.hxx @@ -0,0 +1,17 @@ +// File: WOKDeliv_ParseDelivery.hxx +// Created: Fri Mar 29 11:15:48 1996 +// Author: Arnaud BOUZY +// + + +#ifndef _WOKDeliv_ParseDelivery_HeaderFile +#define _WOKDeliv_ParseDelivery_HeaderFile + +#include +#include +#define T_BASE T_ALPHA +Standard_Boolean WOKDeliv_Delivery_SetFile(char* filename); +void WOKDeliv_Delivery_CloseFile(); +Handle(WOKDeliv_DeliveryList) WOKDeliv_Delivery_Parse(int aStep); + +#endif -- 2.39.5