Просмотр исходного кода

HPCC-12159 add ability to suppress outputing imports
Signed-off-by: rpastrana <rodrigo.pastrana@lexisnexis.com>

rpastrana 10 лет назад
Родитель
Сommit
a6594db8dc
3 измененных файлов с 8 добавлено и 7 удалено
  1. 3 2
      tools/esdlcmd-xml/esdl2xml.hpp
  2. 3 4
      tools/esdlcomp/esdlcomp.cpp
  3. 2 1
      tools/esdlcomp/esdlcomp.h

+ 3 - 2
tools/esdlcmd-xml/esdl2xml.hpp

@@ -45,7 +45,7 @@ public:
     void setVerbose(bool verbose){optVerbose = verbose;};
     bool getVerbose(){return optVerbose;};
 
-    void transform(const char * source, const char * outdir="" ,StringBuffer * out=NULL)
+    void transform(const char * source, const char * outdir="", StringBuffer * out=NULL, bool outputIncludes=true)
     {
         if (added.getValue(source) == false)
         {
@@ -56,7 +56,7 @@ public:
                     fprintf(stdout, "Output directory not specified\n");
             }
 
-            ESDLcompiler hc(source, out==NULL, outdir);
+            ESDLcompiler hc(source, out==NULL, outdir, outputIncludes);
             hc.Process();
             if (out != NULL)
                 out->append(hc.getEsxdlContent());
@@ -83,6 +83,7 @@ public:
 protected:
     bool      optRecursive;
     bool      optVerbose;
+
     AddedHash added;
 };
 

+ 3 - 4
tools/esdlcomp/esdlcomp.cpp

@@ -1082,16 +1082,15 @@ char* getTargetBase(const char* outDir, const char* src)
         // copy the file name
         buf[len] = '/';
         strcpy(buf+len+1, p);
-        //printf("src: %s. dir: %s.\n", src,outDir);
-        //printf("buf: %s\n", buf);
         return buf;
     }
     else
         return strdup(src);
 }
 
-ESDLcompiler::ESDLcompiler(const char * sourceFile, bool generatefile, const char *outDir)
+ESDLcompiler::ESDLcompiler(const char * sourceFile, bool generatefile, const char *outDir, bool outputIncludes_)
 {
+    outputIncludes = outputIncludes_;
     modules = NULL;
     enums = NULL;
     apis=NULL;
@@ -1231,7 +1230,7 @@ void ESDLcompiler::write_esxdl()
         vi->toString(esxdlcontent);
     }
 
-    if (esxdlo > 0) // This only makes sense if outputting to file
+    if(outputIncludes)
     {
         IncludeInfo * ii;
         for (ii=hcp->includes;ii;ii=ii->next)

+ 2 - 1
tools/esdlcomp/esdlcomp.h

@@ -1285,7 +1285,7 @@ public:
 class ESDLcompiler
 {
 public:
-    ESDLcompiler(const char * sourceFile, bool generatefile, const char * outDir);
+    ESDLcompiler(const char * sourceFile, bool generatefile, const char * outDir, bool outputIncludes);
     ~ESDLcompiler();
 
     void Process();
@@ -1310,6 +1310,7 @@ public:
     StrBuffer name;
 
 private:
+    bool outputIncludes;
     int esxdlo;
     char* packagename;
     StrBuffer srcDir;