91 """ |
91 """ |
92 Generate C code |
92 Generate C code |
93 @param current_location: Tupple containing plugin IEC location : %I0.0.4.5 => (0,0,4,5) |
93 @param current_location: Tupple containing plugin IEC location : %I0.0.4.5 => (0,0,4,5) |
94 @param locations: List of complete variables locations \ |
94 @param locations: List of complete variables locations \ |
95 [(IEC_loc, IEC_Direction IEC_Type, Name)]\ |
95 [(IEC_loc, IEC_Direction IEC_Type, Name)]\ |
96 ex: [((0,0,4,5),'I','X','__IX_0_0_4_5'),...] |
96 ex: [((0,0,4,5),'I','STRING','__IX_0_0_4_5'),...] |
97 """ |
97 """ |
98 return [],"" |
98 return [],"" |
99 |
99 |
100 def _Generate_C(self, buildpath, current_location, locations): |
100 def _Generate_C(self, buildpath, current_location, locations): |
101 # Generate plugins [(Cfiles, CFLAGS)], LDFLAGS |
101 # Generate plugins [(Cfiles, CFLAGS)], LDFLAGS |
102 PlugCFilesAndCFLAGS, PlugLDFLAGS = self._Generate_C(buildpath, current_location, locations) |
102 PlugCFilesAndCFLAGS, PlugLDFLAGS = self.PlugGenerate_C(buildpath, current_location, locations) |
103 # recurse through all childs, and stack their results |
103 # recurse through all childs, and stack their results |
104 for PlugChild in self.IterChilds(): |
104 for PlugChild in self.IterChilds(): |
|
105 # Compute chile IEC location |
|
106 new_location = current_location + (self.BaseParams.getIEC_Channel()) |
105 # Get childs [(Cfiles, CFLAGS)], LDFLAGS |
107 # Get childs [(Cfiles, CFLAGS)], LDFLAGS |
106 CFilesAndCFLAGS, LDFLAGS = \ |
108 CFilesAndCFLAGS, LDFLAGS = \ |
107 PlugChild._Generate_C( |
109 PlugChild._Generate_C( |
108 #keep the same path |
110 #keep the same path |
109 buildpath, |
111 buildpath, |
110 # but update location (add curent IEC channel at the end) |
112 # but update location (add curent IEC channel at the end) |
111 current_location + (self.BaseParams.getIEC_Channel()), |
113 new_location, |
112 # filter locations that start with current IEC location |
114 # filter locations that start with current IEC location |
113 [ (l,d,t,n) for l,d,t,n in locations if l[0:len(current_location)] == current_location ]) |
115 [ (l,d,t,n) for l,d,t,n in locations if l[0:len(new_location)] == new_location ]) |
114 # stack the result |
116 # stack the result |
115 PlugCFilesAndCFLAGS += CFilesAndCFLAGS |
117 PlugCFilesAndCFLAGS += CFilesAndCFLAGS |
116 PlugLDFLAGS += LDFLAGS |
118 PlugLDFLAGS += LDFLAGS |
117 |
119 |
118 return PlugCFilesAndCFLAGS,PlugLDFLAGS |
120 return PlugCFilesAndCFLAGS,PlugLDFLAGS |