Leave standard function names hardcoded, as these are considered keywords even though
authorMario de Sousa <msousa@fe.up.pt>
Mon, 04 Apr 2011 15:22:42 +0100
changeset 275 af3d0e3ac65d
parent 274 8d36d1f81170
child 276 1679f514f38a
Leave standard function names hardcoded, as these are considered keywords even though
they may not be implemented in the library.
stage1_2/iec.y
stage1_2/standard_function_names.c
--- a/stage1_2/iec.y	Mon Apr 04 14:32:21 2011 +0100
+++ b/stage1_2/iec.y	Mon Apr 04 15:22:42 2011 +0100
@@ -7971,11 +7971,6 @@
   FILE *in_file = NULL, *lib_file = NULL;
   char *libfilename = NULL;
 	
-  for(int i = 0; standard_function_names[i] != NULL; i++)
-    if (library_element_symtable.find_value(standard_function_names[i]) ==
-        library_element_symtable.end_value())
-      library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
-
   if((in_file = fopen(filename, "r")) == NULL) {
     char *errmsg = strdup2("Error opening main file ", filename);
     perror(errmsg);
@@ -8028,6 +8023,11 @@
   /* if by any chance the library is not complete, we
    * now add the missing reserved keywords to the list!!!
    */
+  for(int i = 0; standard_function_names[i] != NULL; i++)
+    if (library_element_symtable.find_value(standard_function_names[i]) ==
+        library_element_symtable.end_value())
+      library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
+
   for(int i = 0; standard_function_block_names[i] != NULL; i++)
     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
         library_element_symtable.end_value())
--- a/stage1_2/standard_function_names.c	Mon Apr 04 14:32:21 2011 +0100
+++ b/stage1_2/standard_function_names.c	Mon Apr 04 15:22:42 2011 +0100
@@ -36,7 +36,6 @@
  
  
 const char *standard_function_names[] = {
-/*  
 "REAL_TO_SINT",
 "REAL_TO_LINT",
 "REAL_TO_DINT",
@@ -401,7 +400,6 @@
 "INT_TO_ULINT",
 "INT_TO_BOOL",
 "INT_TO_TIME",
-*/
 "TRUNC",
 "BCD_TO_UDINT",
 "BCD_TO_UINT",
@@ -411,10 +409,8 @@
 "UINT_TO_BCD",
 "USINT_TO_BCD",
 "ULINT_TO_BCD",
-/*
 "DATE_AND_TIME_TO_TIME_OF_DAY",
 "DATE_AND_TIME_TO_DATE",
-*/
 "ABS",
 "SQRT",
 "LN",