PLCControler.py
changeset 71 0578bc212c20
parent 70 0e48629c1e6d
child 80 c798a68c5560
--- a/PLCControler.py	Mon Aug 13 18:06:50 2007 +0200
+++ b/PLCControler.py	Tue Aug 14 14:53:06 2007 +0200
@@ -311,6 +311,15 @@
             # Analyze each pou 
             for pou in pous:
                 name = pou.getName()
+                if pou.interface:
+                    # Extract variables from every varLists
+                    for type, varlist in pou.getVars():
+                        for var in varlist.getVariable():
+                            var_type = var.getType().getValue()
+                            if not isinstance(var_type, (StringType, UnicodeType)):
+                                typename = var_type.getName()
+                                if typename in pounames and name not in self.PouUsingTree[typename]:
+                                    self.PouUsingTree[typename].append(name)
                 bodytype = pou.getBodyType()
                 # If pou is written in a graphical language
                 if bodytype in ["FBD","LD","SFC"]:
@@ -764,6 +773,7 @@
             pou.interface = plcopen.pou_interface()
         # Set Pou interface
         pou.setVars(self.ExtractVarLists(vars))
+        self.RefreshPouUsingTree()
         self.RefreshBlockTypes()
     
     # Replace the return type of the pou given by its name (only for functions)