]> OCCT Git - occt-wok.git/commitdiff
No comments
authorcas <cas@opencascade.com>
Wed, 3 Nov 1999 18:05:01 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Wed, 3 Nov 1999 18:05:01 +0000 (18:05 +0000)
src/WOKBuilder/WOKBuilder_Compiler.cdl
src/WOKBuilder/WOKBuilder_Compiler.cxx
src/WOKBuilder/WOKBuilder_CompilerIterator.cdl
src/WOKBuilder/WOKBuilder_CompilerIterator.cxx
src/WOKBuilder/WOKBuilder_Linker.cxx

index 17a56a9d14fc80641c9c37a3e193150ee8ca8c64..a11156284699b8a2057ff85985fee8f2617ff039 100755 (executable)
@@ -48,4 +48,9 @@ fields
     myincdirs : HSequenceOfPath      from WOKUtils;
     mydbdirs  : HSequenceOfPath      from WOKUtils;
     myoptions : HAsciiString         from TCollection;
+    myCmdLine : HAsciiString         from TCollection;
+
+friends
+
+   class CompilerIterator from WOKBuilder
 end Compiler;
index 2d41b8b3b1c1f71ace245072c979770adaac9077..9cacf738b178b41a026e48c3233095fa38c0060a 100755 (executable)
 
 #include <stdio.h>
 
+#include <OSD_Protection.hxx>
+#include <OSD_File.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
 //=======================================================================
 //function : WOKBuilder_Compiler
 //purpose  : 
@@ -154,6 +158,10 @@ void WOKBuilder_Compiler::SetCompilable(const Handle(WOKBuilder_Compilable)& afi
 //=======================================================================
 WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute()
 {
+
+  static Handle( TCollection_HAsciiString ) NL = new TCollection_HAsciiString ( " \\\n " );
+  static Handle( TCollection_HAsciiString ) LF = new TCollection_HAsciiString ( "\n"     );
+
   int start;
 
 #ifdef WNT
@@ -190,6 +198,8 @@ WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute()
   Shell()->ClearOutput();
   Shell()->Execute(astr);
 
+  myCmdLine = new TCollection_HAsciiString ( astr );
+
   Handle(TColStd_HSequenceOfHAsciiString) resseq = Shell()->Errors();
 
   if(Shell()->Status())
@@ -218,6 +228,79 @@ WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute()
   Shell()->ClearOutput();
 
   SetProduction(EvalProduction());
+
+  astr -> Clear ();
+
+  for (  start = 1; start <= Produces () -> Length (); ++start  ) {
+
+   Handle( WOKBuilder_Entity ) ent = Produces () -> Value ( start );
+
+   if (  ent -> IsKind (
+                 STANDARD_TYPE( WOKBuilder_ObjectFile )
+                )
+   ) {
+
+    astr -> AssignCat (  ent -> Path () -> FileName ()  );
+    astr -> AssignCat ( ": " );
+
+   } else if (  ent -> IsKind (
+                        STANDARD_TYPE( WOKBuilder_MFile )
+                       )
+          ) {
+
+    WOKUtils_AdmFile mFile (  ent -> Path ()  );
+
+    Handle( TColStd_HSequenceOfHAsciiString ) deps = mFile.Read ();
+
+    for (  int i = 1; i <= deps -> Length (); ++i  ) {
+
+     astr -> AssignCat ( NL );
+     astr -> AssignCat (  deps -> Value ( i )  );
+
+    }  // end for
+
+    astr -> AssignCat ( LF );
+
+   }  // end if
+
+  }  // end for
+
+  if (  !astr -> IsEmpty ()  ) {
+
+   OSD_Path dPath (  OutputDir () -> Name () -> ToCString ()  );
+
+   dPath.SetName (  Compilable () -> Path () -> BaseName () -> ToCString ()  );
+   dPath.SetExtension ( ".d" );
+
+   OSD_File dFile ( dPath );
+
+   dFile.Build (
+          OSD_WriteOnly,
+          OSD_Protection ( OSD_RWXD, OSD_RWXD, OSD_R, OSD_R )
+         );
+
+   if (  !dFile.Failed ()  ) {
+
+    dFile.Write (  astr -> String (), astr -> Length ()  );
+
+    if (  dFile.Failed ()  ) {
+
+     TCollection_AsciiString name;
+
+     dPath.SystemName ( name );
+
+     ErrorMsg << "WOKBuilder_Compiler::Execute"
+              << "could not create '" << new TCollection_HAsciiString ( name )
+              << "'" << endm;
+
+    }  // end if
+
+    dFile.Close ();
+
+   }  // end if
+
+  }  // end if
+
   return WOKBuilder_Success;
 }
 
index fbcc18b0fc3bccdb710d5d8ede3f9e8c0ef3475d..388ea6c7218c5f2804c63af85940622957c8959e 100755 (executable)
@@ -50,9 +50,11 @@ is
     Execute(me:out; acompilable : Compilable from WOKBuilder)  
        returns BuildStatus from WOKBuilder;
 
+    CmdLine ( me ) returns HAsciiString from TCollection;
 fields
 
     myincdirs : HSequenceOfPath from WOKUtils;
     mydbdirs : HSequenceOfPath from WOKUtils;
+    myCmdLine: HAsciiString from TCollection;
 
 end CompilerIterator;
index fb53df333a6c8ca47a2b74e3afd87d3808a3aad5..fb784a67a969f6432765b7c8789f08f9a47ad358 100755 (executable)
@@ -133,6 +133,9 @@ WOKBuilder_BuildStatus WOKBuilder_CompilerIterator::Execute(const Handle(WOKBuil
   if(status == WOKBuilder_Success)
     {
       myproduction = acompiler->Produces();
+
+      if (  !acompiler -> myCmdLine.IsNull ()  ) myCmdLine = new TCollection_HAsciiString ( acompiler -> myCmdLine );
+
     }
   return status;
 }
index 6bd7e7d9d1d9155afa5c96de6baaa29320292542..e6fc79455a19e7d74898f54d91dfef2f7e85c7a0 100755 (executable)
@@ -282,7 +282,7 @@ Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibSearchDirectives()
 //=======================================================================
 Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalDatabaseDirectives()
 {
-  Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString ( "\\\n" );
 
   if(!mydbdirs.IsNull())
     {
@@ -349,7 +349,7 @@ Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibraryList()
   Standard_Integer i;
   Handle(TCollection_HAsciiString) line;
 
-  line = new TCollection_HAsciiString;
+  line = new TCollection_HAsciiString ( "\\\n" );
 
   for(i=1; i<=mylibs->Length(); i++)
     {
@@ -458,7 +458,29 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute()
   Shell()->Send(EvalHeader());
   Shell()->Send(EvalObjectList());
   Shell()->Send(EvalLibraryList());
+#ifndef LIN
   Shell()->Execute(EvalFooter());
+#else
+  static Handle( TCollection_HAsciiString ) skipStr =
+   new TCollection_HAsciiString ( "/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to " );
+  Shell () -> Send (  EvalFooter ()  );
+
+  Handle( TCollection_HAsciiString ) paramH = EvalToolTemplate ( "CheckUndefHeader" );
+  Handle( TCollection_HAsciiString ) paramF = EvalToolTemplate ( "CheckUndefFooter" );
+
+  if (  !paramH.IsNull     () && !paramF.IsNull     () &&
+        !paramH -> IsEmpty () && !paramF -> IsEmpty ()
+  ) {
+
+   Shell () -> Send ( paramH );
+   Shell () -> Send ( EvalLibSearchDirectives ()  );
+   Shell () -> Send ( EvalDatabaseDirectives  ()  );
+   Shell () -> Send (  EvalObjectList  ()  );
+   Shell () -> Send (  EvalLibraryList ()  );
+   Shell () -> Execute ( paramF );
+
+  } else Shell () -> Execute (  new TCollection_HAsciiString ( "\n" )  );
+#endif  // LIN
 
   if(Shell()->Status())
     {
@@ -470,6 +492,9 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute()
       ErrorMsg.DontPrintHeader();
       for(Standard_Integer i=1; i<= errmsgs->Length(); i++)
        {
+#ifdef LIN
+          if (  errmsgs -> Value ( i ) -> Search ( skipStr ) == 1  ) continue;
+#endif  // LIN
          ErrorMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm;
        }
       if(ph) ErrorMsg.DoPrintHeader();
@@ -482,6 +507,9 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute()
       errmsgs = Shell()->Errors();
       for(Standard_Integer i=1; i<= errmsgs->Length(); i++)
        {
+#ifdef LIN
+          if (  errmsgs -> Value ( i ) -> Search ( skipStr ) == 1  ) continue;
+#endif  // LIN
          InfoMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm;
        }
       if(ph) InfoMsg.DoPrintHeader();