stage1_2/iec.y
changeset 275 af3d0e3ac65d
parent 267 0a1204bcc9af
child 278 050d31dd7c74
equal deleted inserted replaced
274:8d36d1f81170 275:af3d0e3ac65d
  7969             ) {
  7969             ) {
  7970 
  7970 
  7971   FILE *in_file = NULL, *lib_file = NULL;
  7971   FILE *in_file = NULL, *lib_file = NULL;
  7972   char *libfilename = NULL;
  7972   char *libfilename = NULL;
  7973 	
  7973 	
  7974   for(int i = 0; standard_function_names[i] != NULL; i++)
       
  7975     if (library_element_symtable.find_value(standard_function_names[i]) ==
       
  7976         library_element_symtable.end_value())
       
  7977       library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
       
  7978 
       
  7979   if((in_file = fopen(filename, "r")) == NULL) {
  7974   if((in_file = fopen(filename, "r")) == NULL) {
  7980     char *errmsg = strdup2("Error opening main file ", filename);
  7975     char *errmsg = strdup2("Error opening main file ", filename);
  7981     perror(errmsg);
  7976     perror(errmsg);
  7982     free(errmsg);
  7977     free(errmsg);
  7983     return -1;
  7978     return -1;
  8026   fclose(lib_file);
  8021   fclose(lib_file);
  8027 
  8022 
  8028   /* if by any chance the library is not complete, we
  8023   /* if by any chance the library is not complete, we
  8029    * now add the missing reserved keywords to the list!!!
  8024    * now add the missing reserved keywords to the list!!!
  8030    */
  8025    */
       
  8026   for(int i = 0; standard_function_names[i] != NULL; i++)
       
  8027     if (library_element_symtable.find_value(standard_function_names[i]) ==
       
  8028         library_element_symtable.end_value())
       
  8029       library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
       
  8030 
  8031   for(int i = 0; standard_function_block_names[i] != NULL; i++)
  8031   for(int i = 0; standard_function_block_names[i] != NULL; i++)
  8032     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
  8032     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
  8033         library_element_symtable.end_value())
  8033         library_element_symtable.end_value())
  8034       library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token);
  8034       library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token);
  8035 
  8035