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

Aaron Conole aconole at bytheb.org
Mon Feb 27 20:36:42 UTC 2017


Generated code should spell out the full path to the include files.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 compiler/back-ends/c++-gen/gen-code.c |  4 ++--
 compiler/back-ends/c-gen/gen-code.c   | 35 ++++++-----------------------------
 2 files changed, 8 insertions(+), 31 deletions(-)

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..9a82154 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,16 +165,11 @@ 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".
-
-    PrintCHdrComment (hdr, m);	// Deepak: Write the comments in the header file.
-    PrintConditionalIncludeOpen (hdr, m->cHdrFileName);	
+    PrintCSrcComment(src, m);
+    PrintCSrcIncludes(hdr, m, mods);
 
-	/* Deepak: the above fn writes 
-	 * #ifndef _test_h_ 
-	 * #define _test_h_
-     */
+    PrintCHdrComment(hdr, m);
+    PrintConditionalIncludeOpen(hdr, m->cHdrFileName);	
 
 	/* PIERCE TBD: Is this necessary still after Deepak's mods?
      *
@@ -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,9 @@ 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 */
 
 
-- 
2.9.3




More information about the dev mailing list