PLCGenerator.py
changeset 1846 14b40afccd69
parent 1832 0f1081928d65
child 1847 6198190bc121
equal deleted inserted replaced
1845:3abde7651c38 1846:14b40afccd69
   392         for task in tasks:
   392         for task in tasks:
   393             # Task declaration
   393             # Task declaration
   394             resrce += [("    TASK ", ()),
   394             resrce += [("    TASK ", ()),
   395                        (task.getname(), (tagname, "task", task_number, "name")),
   395                        (task.getname(), (tagname, "task", task_number, "name")),
   396                        ("(", ())]
   396                        ("(", ())]
   397             args = []
       
   398             single = task.getsingle()
   397             single = task.getsingle()
   399             # Single argument if exists
   398             # Single argument if exists
   400             if single is not None:
   399             if single is not None:
   401                 if len(single) == 0:
   400                 if len(single) == 0:
   402                     raise PLCGenException(
   401                     raise PLCGenException(
   634         return [connection]
   633         return [connection]
   635 
   634 
   636     def ComputeInterface(self, pou):
   635     def ComputeInterface(self, pou):
   637         interface = pou.getinterface()
   636         interface = pou.getinterface()
   638         if interface is not None:
   637         if interface is not None:
   639             body = pou.getbody()
       
   640             if isinstance(body, ListType):
       
   641                 body = body[0]
       
   642             body_content = body.getcontent()
       
   643             body_type = body_content.getLocalTag()
       
   644             if self.Type == "FUNCTION":
   638             if self.Type == "FUNCTION":
   645                 returntype_content = interface.getreturnType()[0]
   639                 returntype_content = interface.getreturnType()[0]
   646                 returntype_content_type = returntype_content.getLocalTag()
   640                 returntype_content_type = returntype_content.getLocalTag()
   647                 if returntype_content_type == "derived":
   641                 if returntype_content_type == "derived":
   648                     self.ReturnType = returntype_content.getname()
   642                     self.ReturnType = returntype_content.getname()
  1022             factorized_paths.append(paths[num])
  1016             factorized_paths.append(paths[num])
  1023         factorized_paths.sort()
  1017         factorized_paths.sort()
  1024         return factorized_paths
  1018         return factorized_paths
  1025 
  1019 
  1026     def GenerateBlock(self, block, block_infos, body, link, order=False, to_inout=False):
  1020     def GenerateBlock(self, block, block_infos, body, link, order=False, to_inout=False):
  1027         body_type = body.getcontent().getLocalTag()
       
  1028         name = block.getinstanceName()
  1021         name = block.getinstanceName()
  1029         type = block.gettypeName()
  1022         type = block.gettypeName()
  1030         executionOrderId = block.getexecutionOrderId()
  1023         executionOrderId = block.getexecutionOrderId()
  1031         input_variables = block.inputVariables.getvariable()
  1024         input_variables = block.inputVariables.getvariable()
  1032         output_variables = block.outputVariables.getvariable()
  1025         output_variables = block.outputVariables.getvariable()