Add some comments to argument new code.
authorManuele Conti <conti.ma@alice.it>
Tue, 20 Nov 2012 20:55:44 +0100
changeset 749 76c87fdb5fc8
parent 748 ad4265253528
child 750 25f7b35bdff7
Add some comments to argument new code.
stage1_2/create_enumtype_conversion_functions.cc
stage1_2/iec_bison.yy
--- a/stage1_2/create_enumtype_conversion_functions.cc	Tue Nov 20 00:01:57 2012 +0100
+++ b/stage1_2/create_enumtype_conversion_functions.cc	Tue Nov 20 20:55:44 2012 +0100
@@ -159,6 +159,7 @@
   END_IF;
   END_FUNCTION
 
+  Note: if you change code below remember to update this comment.
  */
 void create_enumtype_conversion_functions_c::printStringToEnum  (std::string &enumerateName, std::list<std::string> &enumerateValues) {
     std::list <std::string>::const_iterator itr;
@@ -197,6 +198,7 @@
   END_IF;
   END_FUNCTION
 
+  Note: if you change code below remember to update this comment.
  */
 void create_enumtype_conversion_functions_c::printEnumToString  (std::string &enumerateName, std::list<std::string> &enumerateValues) {
     std::list <std::string>::const_iterator itr;
@@ -235,6 +237,7 @@
   END_IF;
   END_FUNCTION
 
+  Note: if you change code below remember to update this comment.
  */
 void create_enumtype_conversion_functions_c::printIntegerToEnum (std::string &enumerateName, std::list<std::string> &enumerateValues, bool isSigned, size_t size) {
     std::list <std::string>::const_iterator itr;
@@ -280,6 +283,7 @@
   END_IF;
   END_FUNCTION
 
+  Note: if you change code below remember to update this comment.
  */
 void create_enumtype_conversion_functions_c::printEnumToInteger (std::string &enumerateName, std::list<std::string> &enumerateValues, bool isSigned, size_t size) {
     std::list <std::string>::const_iterator itr;
--- a/stage1_2/iec_bison.yy	Tue Nov 20 00:01:57 2012 +0100
+++ b/stage1_2/iec_bison.yy	Tue Nov 20 20:55:44 2012 +0100
@@ -8354,6 +8354,7 @@
   return 0;
 }
 
+/* Create a tmp file from a char buffer. */
 FILE *ftmpopen (void *buf, size_t size, const char *opentype)
 {
   FILE *f;
@@ -8363,7 +8364,11 @@
   return f;
 }
 
-
+/*  sstage2__ function allow to parse a ST code inside a string.
+ *  We use this function to add into AST auto generated code like enum conversion functions.
+ *  This appoach allow us to write future changes code indipendetly and to check generate code
+ *  during developing.
+ */
 int sstage2__(const char *text, 
               symbol_c **tree_root_ref,
               bool full_token_loc_        /* error messages specify full token location */
@@ -8372,7 +8377,7 @@
   FILE *in_file = NULL;
     
   if((in_file = ftmpopen((void *)text, strlen(text), "r")) == NULL) {
-    perror("Error temp file.");
+    perror("Error creating temp file.");
     return -1;
   }
 
@@ -8381,6 +8386,12 @@
     yydebug = 1;
   #endif
   yyin = in_file;
+  
+  /* We turn on "allow_function_overloading" flag to disable some checks. 
+   * In detail when we add to symboltable a symbol already processed we
+   * don't want to get any error. 
+   */  
+   
   allow_function_overloading = true;
   allow_extensible_function_parameters = false;
   full_token_loc = full_token_loc_;