plcopen/structures.py
changeset 517 026ef159e8a2
parent 483 779a519f78f2
child 526 79900abdfa3c
equal deleted inserted replaced
516:40290ddff19c 517:026ef159e8a2
   567                         res = eval(Function_decl["python_eval_c_code_format"])
   567                         res = eval(Function_decl["python_eval_c_code_format"])
   568 
   568 
   569                         if res != None :
   569                         if res != None :
   570                             # create the copy of decl dict to be appended to section
   570                             # create the copy of decl dict to be appended to section
   571                             Function_decl_copy = Function_decl.copy()
   571                             Function_decl_copy = Function_decl.copy()
   572                             # Have to generate type description in comment with freshly redefined types
       
   573                             words = Function_decl_copy["comment"].split('"')
       
   574                             if len(words) > 1:
       
   575                                 Function_decl_copy["comment"] = words[1]
       
   576                             Function_decl_copy["usage"] = (
       
   577                                 "\n (" +
       
   578                                 str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["inputs"]]).strip("[]").replace("'",'') +
       
   579                                 " ) => (" +
       
   580                                 str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in Function_decl["outputs"]]).strip("[]").replace("'",'') +
       
   581                                 " )")
       
   582                             Current_section["list"].append(Function_decl_copy)
   572                             Current_section["list"].append(Function_decl_copy)
   583                             #pp.pprint(Function_decl_copy)
       
   584             else:
   573             else:
   585                 raise "First function must be in a category"
   574                 raise "First function must be in a category"
   586     
   575     
   587     return Standard_Functions_Decl
   576     return Standard_Functions_Decl
   588 
   577 
   589 std_decl = get_standard_funtions(csv_file_to_table(open(os.path.join(os.path.split(__file__)[0],"iec_std.csv"))))#, True)
   578 std_decl = get_standard_funtions(csv_file_to_table(open(os.path.join(os.path.split(__file__)[0],"iec_std.csv"))))#, True)
   590 
   579 
   591 BlockTypes.extend(std_decl)
   580 BlockTypes.extend(std_decl)
       
   581 
       
   582 for section in BlockTypes: 
       
   583     for desc in section["list"]:
       
   584         words = desc["comment"].split('"')
       
   585         if len(words) > 1:
       
   586             desc["comment"] = words[1]
       
   587         desc["usage"] = (
       
   588             "\n (" +
       
   589             str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in desc["inputs"]]).strip("[]").replace("'",'') +
       
   590             " ) => (" +
       
   591             str([ " " + fctdecl[1]+":"+fctdecl[0] for fctdecl in desc["outputs"]]).strip("[]").replace("'",'') +
       
   592             " )")
   592 
   593 
   593 
   594 
   594 #-------------------------------------------------------------------------------
   595 #-------------------------------------------------------------------------------
   595 #                            Languages Keywords
   596 #                            Languages Keywords
   596 #-------------------------------------------------------------------------------
   597 #-------------------------------------------------------------------------------