plcopen/structures.py
changeset 28 fc23e1f415d8
parent 27 dae55dd9ee14
child 40 49c8ebc1ee25
--- a/plcopen/structures.py	Mon Jul 09 11:10:14 2007 +0200
+++ b/plcopen/structures.py	Tue Jul 10 09:52:53 2007 +0200
@@ -128,10 +128,15 @@
 Function that returns the block definition associated to the block type given
 """
 
-def GetBlockType(type):
+def GetBlockType(type, inputs = None):
     for category in BlockTypes:
         for blocktype in category["list"]:
-            if blocktype["name"] == type:
+            if inputs:
+                block_inputs = tuple([var_type for name, var_type, modifier in blocktype["inputs"]])
+                same_inputs = inputs == block_inputs
+            else:
+                same_inputs = True
+            if blocktype["name"] == type and same_inputs:
                 return blocktype
     return None