[esnacc-dev,RFC,2/5] gen-code: Use the detailed inc directory for generated code

Message ID 1483482316-10045-3-git-send-email-aconole@bytheb.org
State RFC, archived
Delegated to: Aaron Conole
Headers show
Series
  • [esnacc-dev,RFC,1/5] snacc: Change c and c++ api
Related show

Commit Message

Aaron Conole Jan. 3, 2017, 10:25 p.m.
Generated code should spell out the full path to the include files.

Signed-off-by: Aaron Conole <aconole@bytheb.org>

---
 compiler/back-ends/c++-gen/gen-code.c |  4 ++--
 compiler/back-ends/c-gen/gen-code.c   | 30 ++++--------------------------
 2 files changed, 6 insertions(+), 28 deletions(-)

Patch

diff --git a/compiler/back-ends/c++-gen/gen-code.c b/compiler/back-ends/c++-gen/gen-code.c
index 0e4e991..b647a00 100644
--- a/compiler/back-ends/c++-gen/gen-code.c
+++ b/compiler/back-ends/c++-gen/gen-code.c
@@ -4082,8 +4082,8 @@  PrintCxxCode PARAMS ((src, hdr, if_META (printMeta COMMA meta COMMA meta_pdus CO
     }
 #endif /* META */
 
-    fprintf(hdr, "#include \"asn-incl.h\"\n");
-    fprintf(hdr, "#include \"asn-listset.h\"\n");
+    fprintf(hdr, "#include \"cxx-lib/inc/asn-incl.h\"\n");
+    fprintf(hdr, "#include \"cxx-lib/inc/asn-listset.h\"\n");
     fprintf(src, "\n");
 
     PrintSrcIncludes(src, mods, m);
diff --git a/compiler/back-ends/c-gen/gen-code.c b/compiler/back-ends/c-gen/gen-code.c
index 63b1c4d..86c5f65 100644
--- a/compiler/back-ends/c-gen/gen-code.c
+++ b/compiler/back-ends/c-gen/gen-code.c
@@ -139,8 +139,7 @@  static void PrintCSrcComment PROTO ((FILE *src, Module *m));
 static void PrintCSrcIncludes PROTO ((FILE *src, Module *m, ModuleList *mods));
 static void PrintCHdrComment PROTO ((FILE *hdr, Module *m));
 static void PrintCHdrObjectDeclaration_and_Init PROTO ((FILE *hdr, Module *m, CRules *r));
-//RWC;static void PrintCHdrObjectField PROTO ((FILE *hdr, Module *m, CRules *r, char *objName, ObjectAssignmentField *oaf));
-//extern short ImportedFilesG;
+
 /*
  * Fills the hdr file with the C type and encode/decode prototypes
  * Fills the src file with the encoded/decode routine definitions
@@ -166,17 +165,12 @@  PrintCCode PARAMS ((src, hdr, mods, m, r, longJmpVal, printTypes, printValues, p
 	/* Deepak: suppose the asn source file is test.asn
 	 * then the C source file name is test.c and C header file is test.h
 	 */
-    PrintCSrcComment (src, m);	// Deepak: Write the comments in the source file.
-    PrintCSrcIncludes (hdr/*RWC;src*/, m, mods);	// Deepak: #include "asn-incl.h" and #include "test.h".
+    PrintCSrcComment (src, m);
+    PrintCSrcIncludes (hdr, m, mods);
 
     PrintCHdrComment (hdr, m);	// Deepak: Write the comments in the header file.
     PrintConditionalIncludeOpen (hdr, m->cHdrFileName);	
 
-	/* Deepak: the above fn writes 
-	 * #ifndef _test_h_ 
-	 * #define _test_h_
-     */
-
 	/* PIERCE TBD: Is this necessary still after Deepak's mods?
      *
 	 * Add include reference to source file
@@ -535,7 +529,7 @@  PrintCSrcIncludes PARAMS ((inFile, m, mods ),
     /*
      * include snacc runtime library related hdrs
      */
-    fprintf (inFile, "\n#include \"asn-incl.h\"\n");
+    fprintf (inFile, "\n#include \"c-lib/inc/asn-incl.h\"\n");
 
     /*
      * print out include files in same order of the module
@@ -561,26 +555,10 @@  PrintCSrcIncludes PARAMS ((inFile, m, mods ),
 			}
             mods->curr = currModTmp;    // RWC;RESET loop control
         }
-//		if ((ImportedFilesG == FALSE) || (impMod->ImportedFlag == TRUE))
-//		{
-//			// Only include if Module was exported
-//			if (impMod->exportStatus != 0)
-//			{
-//				// Check that the source header is not part of 
-//				// These references.
-//				if ((strcmp(impMod->cHdrFileName, srcref) != 0))
-//					fprintf (src, "#include \"%s\"\n", impMod->cHdrFileName);
-//			}
-//		} // endif
- //       fprintf (src, "#include \"%s\"\n", impMod->cHdrFileName);
     }
 
-	//RWC;if (m->cHdrFileName != NULL)
-	//RWC;	fprintf (inFile, "#include \"%s\"\n", m->cHdrFileName);
-
 
     SET_CURR_LIST_NODE (mods, tmp);
-   m=m; /* AVOIDS warning. */
 }  /* PrintCSrcIncludes */