# HG changeset patch # User Manuele Conti # Date 1353441344 -3600 # Node ID 76c87fdb5fc8e28cccd75eac9812661629c4d139 # Parent ad4265253528993e72daca62c4d16096c3fd2ac7 Add some comments to argument new code. diff -r ad4265253528 -r 76c87fdb5fc8 stage1_2/create_enumtype_conversion_functions.cc --- 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 &enumerateValues) { std::list ::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 &enumerateValues) { std::list ::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 &enumerateValues, bool isSigned, size_t size) { std::list ::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 &enumerateValues, bool isSigned, size_t size) { std::list ::const_iterator itr; diff -r ad4265253528 -r 76c87fdb5fc8 stage1_2/iec_bison.yy --- 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_;