stage4/generate_c/generate_c.cc
changeset 181 38d6eb056260
parent 178 1622dc05c6ca
child 184 16495e10f69a
equal deleted inserted replaced
180:64334c5a00b1 181:38d6eb056260
    44 #include <strings.h>
    44 #include <strings.h>
    45 
    45 
    46 #include "../../util/symtable.hh"
    46 #include "../../util/symtable.hh"
    47 #include "../../util/dsymtable.hh"
    47 #include "../../util/dsymtable.hh"
    48 #include "../../absyntax/visitor.hh"
    48 #include "../../absyntax/visitor.hh"
       
    49 #include "../../absyntax_utils/absyntax_utils.hh"
    49 
    50 
    50 #include "../stage4.hh"
    51 #include "../stage4.hh"
    51 
       
    52 
    52 
    53 
    53 
    54 
    54 
    55 
    55 
    56 
    56 
    68 #define ERROR error_exit(__FILE__,__LINE__)
    68 #define ERROR error_exit(__FILE__,__LINE__)
    69 /* function defined in main.cc */
    69 /* function defined in main.cc */
    70 extern void error_exit(const char *file_name, int line_no);
    70 extern void error_exit(const char *file_name, int line_no);
    71 
    71 
    72 
    72 
    73 
       
    74 
       
    75 
       
    76 #if 0
       
    77 /* A symbol table with all globally declared functions... */
       
    78 function_declaration_c null_symbol1(NULL,NULL,NULL,NULL);
       
    79 dsymtable_c<function_declaration_c *, &null_symbol1> function_symtable;
       
    80 
       
    81 /* A symbol table with all globally declared functions block types... */
       
    82 function_block_declaration_c null_symbol2(NULL,NULL,NULL);
       
    83 symtable_c<function_block_declaration_c *, &null_symbol2> function_block_type_symtable;
       
    84 
       
    85 /* A symbol table with all globally declared program types... */
       
    86 program_declaration_c null_symbol3(NULL,NULL,NULL);
       
    87 symtable_c<program_declaration_c *, &null_symbol3> program_type_symtable;
       
    88 
       
    89 /* A symbol table with all user declared type definitions... */
       
    90 /* Note that function block types and program types have their
       
    91  * own symbol tables, so do not get placed in this symbol table!
       
    92  */
       
    93 symbol_c null_symbol4;
       
    94 symtable_c<symbol_c *, &null_symbol4> type_symtable;
       
    95 #else
       
    96 
       
    97 #include "../../search_utils/search_utils.hh"
       
    98 
       
    99 #endif
       
   100 
       
   101 /***********************************************************************/
       
   102 /***********************************************************************/
       
   103 /***********************************************************************/
       
   104 /***********************************************************************/
       
   105 
       
   106 
       
   107 /* returns 0 if the names are equal!! */
       
   108 /* NOTE: it must ignore case!! */
       
   109 static int compare_identifiers(symbol_c *ident1, symbol_c *ident2) {
       
   110 
       
   111   token_c *name1 = dynamic_cast<token_c *>(ident1);
       
   112   token_c *name2 = dynamic_cast<token_c *>(ident2);
       
   113   
       
   114   if ((name1 == NULL) || (name2 == NULL))
       
   115     /* invalid identifiers... */
       
   116     return -1;
       
   117 
       
   118   if (strcasecmp(name1->value, name2->value) == 0)
       
   119     return 0;
       
   120 
       
   121   /* identifiers do not match! */
       
   122   return 1;
       
   123 }
       
   124 
    73 
   125 
    74 
   126 /***********************************************************************/
    75 /***********************************************************************/
   127 /***********************************************************************/
    76 /***********************************************************************/
   128 /***********************************************************************/
    77 /***********************************************************************/
   175 
   124 
   176 /***********************************************************************/
   125 /***********************************************************************/
   177 /***********************************************************************/
   126 /***********************************************************************/
   178 /***********************************************************************/
   127 /***********************************************************************/
   179 /***********************************************************************/
   128 /***********************************************************************/
   180 
       
   181 
       
   182 #include "spec_init_separator.cc"
       
   183 #include "function_param_iterator.cc"
       
   184 #include "function_call_iterator.cc"
       
   185 #include "function_call_param_iterator.cc"
       
   186 #include "type_initial_value.cc"
       
   187 #include "search_fb_instance_decl.cc"
       
   188 #include "search_fb_typedecl.cc"
       
   189 #include "search_base_type.cc"
       
   190 #include "search_var_instance_decl.cc"
       
   191 #include "decompose_var_instance_name.cc"
       
   192 #include "search_varfb_instance_type.cc"
       
   193 #include "search_constant_type.cc"
       
   194 #include "search_expression_type.cc"
       
   195 
   129 
   196 #include "generate_c_base.cc"
   130 #include "generate_c_base.cc"
   197 #include "generate_c_typedecl.cc"
   131 #include "generate_c_typedecl.cc"
   198 #include "generate_c_sfcdecl.cc"
   132 #include "generate_c_sfcdecl.cc"
   199 #include "generate_c_vardecl.cc"
   133 #include "generate_c_vardecl.cc"