generate_IEC_std.py
changeset 26 36d378bd852e
parent 25 8dc68e669d99
child 36 e7d67b27877f
equal deleted inserted replaced
25:8dc68e669d99 26:36d378bd852e
     9     Convert ANY_XXX IEC type declaration into IEC2CC's generated type test.
     9     Convert ANY_XXX IEC type declaration into IEC2CC's generated type test.
    10     This tests are defined in search_expression_type.cc 
    10     This tests are defined in search_expression_type.cc 
    11     """
    11     """
    12     return {"ANY" : "",
    12     return {"ANY" : "",
    13     "ANY_BIT" : "if(search_expression_type->is_binary_type(%(paramname)s_type_symbol))",
    13     "ANY_BIT" : "if(search_expression_type->is_binary_type(%(paramname)s_type_symbol))",
       
    14     "ANY_NBIT" : "if(search_expression_type->is_nbinary_type(%(paramname)s_type_symbol))",
    14     "ANY_NUM" : "if(search_expression_type->is_num_type(%(paramname)s_type_symbol))",
    15     "ANY_NUM" : "if(search_expression_type->is_num_type(%(paramname)s_type_symbol))",
    15     "ANY_REAL" : "if(search_expression_type->is_real_type(%(paramname)s_type_symbol))",
    16     "ANY_REAL" : "if(search_expression_type->is_real_type(%(paramname)s_type_symbol))",
    16     "ANY_INT" : "if(search_expression_type->is_integer_type(%(paramname)s_type_symbol))"
    17     "ANY_INT" : "if(search_expression_type->is_integer_type(%(paramname)s_type_symbol))"
    17     }.get(typename,
    18     }.get(typename,
    18         "if (typeid(*last_type_symbol) == typeid(%(typename)s_type_name_c))")%{
    19         "if (typeid(*last_type_symbol) == typeid(%(typename)s_type_name_c))")%{
   403 for name, ext in [
   404 for name, ext in [
   404         ('function_type_decl','h'),
   405         ('function_type_decl','h'),
   405         ('get_function_type_decl','c'),
   406         ('get_function_type_decl','c'),
   406         ('st_code_gen','c'),
   407         ('st_code_gen','c'),
   407         ('il_code_gen','c'),
   408         ('il_code_gen','c'),
   408         ('search_type_code','c'),
   409         ('search_type_code','c')#,
   409         ('iec_std_lib_generated','h')]:
   410         #('iec_std_lib_generated','h')
       
   411         ]:
   410     fd = open(os.path.join(sys.argv[1],name+'.'+ext),'w')
   412     fd = open(os.path.join(sys.argv[1],name+'.'+ext),'w')
   411     fd.write(eval(name))
   413     fd.write(eval(name))
   412     fd.close()
   414     fd.close()