635 undefined_blocks = [] |
635 undefined_blocks = [] |
636 for instance in body.getcontentInstances(): |
636 for instance in body.getcontentInstances(): |
637 if isinstance(instance, (plcopen.fbdObjects_inVariable, plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable)): |
637 if isinstance(instance, (plcopen.fbdObjects_inVariable, plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable)): |
638 expression = instance.getexpression() |
638 expression = instance.getexpression() |
639 var_type = self.GetVariableType(expression) |
639 var_type = self.GetVariableType(expression) |
640 if pou.getpouType() == "function" and expression == pou.getname(): |
640 if isinstance(pou, plcopen.transitions_transition) and expression == pou.getname(): |
|
641 var_type = "BOOL" |
|
642 elif (not isinstance(pou, (plcopen.transitions_transition, plcopen.actions_action)) and |
|
643 pou.getpouType() == "function" and expression == pou.getname()): |
641 returntype_content = pou.interface.getreturnType().getcontent() |
644 returntype_content = pou.interface.getreturnType().getcontent() |
642 if returntype_content["name"] == "derived": |
645 if returntype_content["name"] == "derived": |
643 var_type = returntype_content["value"].getname() |
646 var_type = returntype_content["value"].getname() |
644 elif returntype_content["name"] in ["string", "wstring"]: |
647 elif returntype_content["name"] in ["string", "wstring"]: |
645 var_type = returntype_content["name"].upper() |
648 var_type = returntype_content["name"].upper() |
740 block_infos = self.GetBlockType(instance.gettypeName(), tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in instance.inputVariables.getvariable() if variable.getformalParameter() != "EN"])) |
743 block_infos = self.GetBlockType(instance.gettypeName(), tuple([self.ConnectionTypes.get(variable.connectionPointIn, "ANY") for variable in instance.inputVariables.getvariable() if variable.getformalParameter() != "EN"])) |
741 if block_infos is not None: |
744 if block_infos is not None: |
742 self.ComputeBlockInputTypes(instance, block_infos, body) |
745 self.ComputeBlockInputTypes(instance, block_infos, body) |
743 else: |
746 else: |
744 raise PLCGenException, _("No informations found for \"%s\" block")%(instance.gettypeName()) |
747 raise PLCGenException, _("No informations found for \"%s\" block")%(instance.gettypeName()) |
|
748 if body_type == "SFC": |
|
749 previous_tagname = self.TagName |
|
750 for action in pou.getactionList(): |
|
751 self.TagName = self.ParentGenerator.Controler.ComputePouActionName(self.Name, action.getname()) |
|
752 self.ComputeConnectionTypes(action) |
|
753 for transition in pou.gettransitionList(): |
|
754 self.TagName = self.ParentGenerator.Controler.ComputePouTransitionName(self.Name, transition.getname()) |
|
755 self.ComputeConnectionTypes(transition) |
|
756 self.TagName = previous_tagname |
745 |
757 |
746 def ComputeBlockInputTypes(self, instance, block_infos, body): |
758 def ComputeBlockInputTypes(self, instance, block_infos, body): |
747 undefined = {} |
759 undefined = {} |
748 for variable in instance.outputVariables.getvariable(): |
760 for variable in instance.outputVariables.getvariable(): |
749 output_name = variable.getformalParameter() |
761 output_name = variable.getformalParameter() |