From: cascade Date: Fri, 8 Oct 2004 21:13:25 +0000 (+0000) Subject: OCC5916 Correction of time compensation mechanism cxx only X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=7f319b0177cd1516fb6b2321d937e9e3fe54a981;p=occt-wok.git OCC5916 Correction of time compensation mechanism cxx only --- diff --git a/src/WOKStep/WOKStep_CDLUnitSource.cxx b/src/WOKStep/WOKStep_CDLUnitSource.cxx index 842fc6c..73be607 100755 --- a/src/WOKStep/WOKStep_CDLUnitSource.cxx +++ b/src/WOKStep/WOKStep_CDLUnitSource.cxx @@ -1,40 +1,12 @@ -// File: WOKStep_CDLUnitSource.cxx -// Created: Tue Aug 29 21:40:36 1995 -// Author: Jean GAUTIER -// +// File: WOKStep_CDLUnitSource.cxx +// Created: Tue Aug 29 21:40:36 1995 +// Author: Jean GAUTIER +// #ifdef HAVE_CONFIG_H # include #endif -#ifndef DONT_COMPENSATE - -#include - -#ifdef WNT -# include -#endif // WNT - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#if defined (HAVE_SYS_STAT_H) || defined (WNT) -# include -#endif -#include - -#if defined(HAVE_TIME_H) || defined(WNT) -# include -#endif - -#include -#endif // DONT_COMPENSATE - #include #include @@ -76,10 +48,10 @@ //purpose : //======================================================================= WOKStep_CDLUnitSource::WOKStep_CDLUnitSource(const Handle(WOKMake_BuildProcess)& abp, - const Handle(WOKernel_DevUnit)& aunit, - const Handle(TCollection_HAsciiString)& acode, - const Standard_Boolean checked, - const Standard_Boolean hidden) + const Handle(WOKernel_DevUnit)& aunit, + const Handle(TCollection_HAsciiString)& acode, + const Standard_Boolean checked, + const Standard_Boolean hidden) : WOKStep_Source(abp, aunit, acode, checked, hidden) { } @@ -118,72 +90,6 @@ void WOKStep_CDLUnitSource::ReadUnitDescr(const Handle(WOKMake_InputFile)& PKCDL Standard_Integer i; Standard_Boolean stop = Standard_False; - -#ifndef DONT_COMPENSATE - - { - Handle(WOKernel_File) srcdir = new WOKernel_File(new TCollection_HAsciiString("testdate.temoin"), - Unit(), Unit()->GetFileType("source")); - - srcdir->GetPath(); - - Standard_CString tempath = srcdir->Path()->Name()->ToCString(); - Standard_Integer fd; -#ifndef WNT - if((fd=open(tempath, O_WRONLY | O_CREAT| O_TRUNC)) == -1) -#else - if((fd=open(tempath, O_WRONLY | O_CREAT| O_TRUNC, _S_IREAD | _S_IWRITE)) == -1) -#endif // WNT - { - //WarningMsg << "WOKStep_MSFill::Execute" - // << "Could not create : " << tempath << endm; - //perror(tempath); - } - else - { - close(fd); - } - - if(fd != -1 ) - { - struct stat buf; - - if(stat(tempath, &buf)) - { - ErrorMsg << "WOKStep_MSFill::Execute" - << "Could not stat : " << tempath << endm; - } - - time_t curdate ; - - curdate = time(NULL); - if(curdate == -1) - { - ErrorMsg << "WOKStep_MSFill::Execute" - << "Could not obtain current date" << endm; - } - - unlink(tempath); - - Standard_Integer decal = buf.st_mtime - curdate; - - if(decal < 0) - { - WarningMsg << "WOKStep_MSFill::Execute" - << "Cannot compensate negative (" << decal << "s) time displace" << endm; - } - else if(decal > 0) - { - WarningMsg << "WOKStep_MSFill::Execute" - << "Trying compensate positive (" << decal << "s) time displace" << endm; - sleep(decal); - } - } - } - -#endif - - // Initialisation du traducteur acdlt->Load(); acdlt->SetMSchema(WOKBuilder_MSTool::GetMSchema()); @@ -218,25 +124,25 @@ _TEST_BREAK(); acdlfile = Locator()->Locate(aunitname, new TCollection_HAsciiString("source"), astr); if(!acdlfile.IsNull()) - { - aspec = new WOKBuilder_CDLFile(acdlfile->Path()); - - switch(anit.Execute(acdlt, anaction, aspec)) - { - case WOKBuilder_Unbuilt: - case WOKBuilder_Success: - break; - case WOKBuilder_Failed: - stop = Standard_True; - anit.Reset(); - break; - } - } + { + aspec = new WOKBuilder_CDLFile(acdlfile->Path()); + + switch(anit.Execute(acdlt, anaction, aspec)) + { + case WOKBuilder_Unbuilt: + case WOKBuilder_Success: + break; + case WOKBuilder_Failed: + stop = Standard_True; + anit.Reset(); + break; + } + } else - { - WarningMsg << "WOKStep_MSFill::Execute" << "No file " << astr << " in " << aunitname << endm; - SetIncomplete(); - } + { + WarningMsg << "WOKStep_MSFill::Execute" << "No file " << astr << " in " << aunitname << endm; + SetIncomplete(); + } anit.Next(); } @@ -246,42 +152,42 @@ _TEST_BREAK(); // test du type d'ud if (WOKernel_IsPackage(Unit())) { if (!theschema->IsPackage(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsSchema(Unit())) { if (!theschema->IsSchema(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsInterface(Unit())) { if (!theschema->IsInterface(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsClient(Unit())) { if (!theschema->IsClient(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsEngine(Unit())) { if (!theschema->IsEngine(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsExecutable(Unit())) { if (!theschema->IsExecutable(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } else if (WOKernel_IsServer(Unit())) { if (!theschema->IsComponent(Unit()->Name())) { - stop = Standard_True; + stop = Standard_True; } } if (stop) { ErrorMsg << "WOKStep_MSFill::Execute" - << "Unit and cdl file definition type mismatch for unit " << Unit()->Name() << endm; + << "Unit and cdl file definition type mismatch for unit " << Unit()->Name() << endm; } } @@ -297,14 +203,14 @@ _TEST_BREAK(); #endif // WNT anent = Locator()->Locate(Unit()->Name(), sourcetype, WOKBuilder_MSTool::GetMSchema()->AssociatedFile(aseq->Value(i))); if(!anent.IsNull()) - { - Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(anent->LocatorName(), - anent, - Handle(WOKBuilder_Entity)(), anent->Path()); - outfile->SetLocateFlag(Standard_True); - outfile->SetProduction(); - AddExecDepItem(PKCDL, outfile, Standard_True); - } + { + Handle(WOKMake_OutputFile) outfile = new WOKMake_OutputFile(anent->LocatorName(), + anent, + Handle(WOKBuilder_Entity)(), anent->Path()); + outfile->SetLocateFlag(Standard_True); + outfile->SetProduction(); + AddExecDepItem(PKCDL, outfile, Standard_True); + } } if(stop) @@ -328,41 +234,41 @@ void WOKStep_CDLUnitSource::Execute(const Handle(WOKMake_HSequenceOfInputFile)& Standard_Integer i; for(i=1; i<=execlist->Length(); i++) - { - if(!strcmp(execlist->Value(i)->File()->Name()->ToCString(), FILES->Name()->ToCString())) - { - ReadFILES(execlist->Value(i)); - } - if(!strcmp(execlist->Value(i)->File()->Name()->ToCString(), PKCDL->Name()->ToCString())) - { - ReadFILES(execlist->Value(i)); - } - } + { + if(!strcmp(execlist->Value(i)->File()->Name()->ToCString(), FILES->Name()->ToCString())) + { + ReadFILES(execlist->Value(i)); + } + if(!strcmp(execlist->Value(i)->File()->Name()->ToCString(), PKCDL->Name()->ToCString())) + { + ReadFILES(execlist->Value(i)); + } + } } else { if(!FILES.IsNull()) - { - Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(FILES->LocatorName(), FILES, - Handle(WOKBuilder_Entity)(), FILES->Path()); - execlist->Append(infile); - infile->SetDirectFlag(Standard_True); - infile->SetLocateFlag(Standard_True); - - ReadFILES(infile); - } + { + Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(FILES->LocatorName(), FILES, + Handle(WOKBuilder_Entity)(), FILES->Path()); + execlist->Append(infile); + infile->SetDirectFlag(Standard_True); + infile->SetLocateFlag(Standard_True); + + ReadFILES(infile); + } if(CheckStatus("FILES reading")) return; if(!PKCDL.IsNull()) - { - Handle(WOKBuilder_Specification) cdlent = new WOKBuilder_CDLFile(PKCDL->Path()); - Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(PKCDL->LocatorName(), PKCDL, - cdlent , PKCDL->Path()); - execlist->Append(infile); - infile->SetDirectFlag(Standard_True); - infile->SetLocateFlag(Standard_True); - ReadUnitDescr(infile); - } + { + Handle(WOKBuilder_Specification) cdlent = new WOKBuilder_CDLFile(PKCDL->Path()); + Handle(WOKMake_InputFile) infile = new WOKMake_InputFile(PKCDL->LocatorName(), PKCDL, + cdlent , PKCDL->Path()); + execlist->Append(infile); + infile->SetDirectFlag(Standard_True); + infile->SetLocateFlag(Standard_True); + ReadUnitDescr(infile); + } if(CheckStatus("CDL processing")) return; } return; diff --git a/src/WOKStep/WOKStep_MSFill.cxx b/src/WOKStep/WOKStep_MSFill.cxx index 5c89bdb..3656548 100755 --- a/src/WOKStep/WOKStep_MSFill.cxx +++ b/src/WOKStep/WOKStep_MSFill.cxx @@ -7,36 +7,6 @@ # include #endif -#ifndef DONT_COMPENSATE - -#include - -#ifdef WNT -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#if defined(HAVE_SYS_TYPES_H) || defined(WNT) -# include -#endif - -#if defined(HAVE_SYS_STAT_H) || defined(WNT) -# include -#endif - -#include - -#if defined(HAVE_TIME_H) || defined(WNT) -# include -#endif -#include - -// endif DONT_COMPENSATE -#endif -// #include #include @@ -152,70 +122,6 @@ void WOKStep_MSFill::Execute(const Handle(WOKMake_HSequenceOfInputFile)& ) Standard_Integer i; Standard_Boolean stop = Standard_False; -#ifndef DONT_COMPENSATE - - { - Handle(WOKernel_File) srcdir = new WOKernel_File(new TCollection_HAsciiString("testdate.temoin"), - Unit(), Unit()->GetFileType("source")); - - srcdir->GetPath(); - - Standard_CString tempath = srcdir->Path()->Name()->ToCString(); - Standard_Integer fd; - -#ifndef WNT - if((fd=open(tempath, O_WRONLY | O_CREAT | O_TRUNC)) == -1) -#else - if((fd=open(tempath, O_WRONLY | O_CREAT | O_TRUNC, _S_IREAD | _S_IWRITE)) == -1) -#endif // WNT - { - //SetFailed(); - } - else - { - close(fd); - } - - if(fd!=-1) - { - struct stat buf; - - if(stat(tempath, &buf)) - { - ErrorMsg << "WOKStep_MSFill::Execute" - << "Could not stat : " << tempath << endm; - //SetFailed(); - } - - time_t curdate ; - - curdate = time(NULL); - if(curdate == -1) - { - ErrorMsg << "WOKStep_MSFill::Execute" - << "Could not obtain current date" << endm; - } - - unlink(tempath); - - Standard_Integer decal = buf.st_mtime - curdate; - - if(decal < 0) - { - WarningMsg << "WOKStep_MSFill::Execute" - << "Cannot compensate negative (" << decal << "s) time displace" << endm; - } - else if(decal > 0) - { - WarningMsg << "WOKStep_MSFill::Execute" - << "Trying compensate positive (" << decal << "s) time displace" << endm; - sleep(decal); - } - } - } - -#endif - acdlt->Load(); acdlt->SetMSchema(WOKBuilder_MSTool::GetMSchema());