274 LocationCFilesAndCFLAGS = [] |
274 LocationCFilesAndCFLAGS = [] |
275 |
275 |
276 # confnode asks for some LDFLAGS |
276 # confnode asks for some LDFLAGS |
277 if CTNLDFLAGS: |
277 if CTNLDFLAGS: |
278 # LDFLAGS can be either string |
278 # LDFLAGS can be either string |
279 if type(CTNLDFLAGS)==type(str()): |
279 if type(CTNLDFLAGS) == type(str()): |
280 LDFLAGS=[CTNLDFLAGS] |
280 LDFLAGS = [CTNLDFLAGS] |
281 # or list of strings |
281 # or list of strings |
282 elif type(CTNLDFLAGS)==type(list()): |
282 elif type(CTNLDFLAGS) == type(list()): |
283 LDFLAGS=CTNLDFLAGS[:] |
283 LDFLAGS = CTNLDFLAGS[:] |
284 else: |
284 else: |
285 LDFLAGS=[] |
285 LDFLAGS = [] |
286 |
286 |
287 # recurse through all children, and stack their results |
287 # recurse through all children, and stack their results |
288 for CTNChild in self.IECSortedChildren(): |
288 for CTNChild in self.IECSortedChildren(): |
289 new_location = CTNChild.GetCurrentLocation() |
289 new_location = CTNChild.GetCurrentLocation() |
290 # How deep are we in the tree ? |
290 # How deep are we in the tree ? |
291 depth=len(new_location) |
291 depth = len(new_location) |
292 _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \ |
292 _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \ |
293 CTNChild._Generate_C( |
293 CTNChild._Generate_C( |
294 # keep the same path |
294 # keep the same path |
295 buildpath, |
295 buildpath, |
296 # filter locations that start with current IEC location |
296 # filter locations that start with current IEC location |
395 # Get Current Name |
395 # Get Current Name |
396 CurrentName = self.BaseParams.getName() |
396 CurrentName = self.BaseParams.getName() |
397 # Do nothing if no change |
397 # Do nothing if no change |
398 #if CurrentName == DesiredName: return CurrentName |
398 #if CurrentName == DesiredName: return CurrentName |
399 # Build a list of used Name out of parent's Children |
399 # Build a list of used Name out of parent's Children |
400 AllNames=[] |
400 AllNames = [] |
401 for CTNInstance in self.CTNParent.IterChildren(): |
401 for CTNInstance in self.CTNParent.IterChildren(): |
402 if CTNInstance != self: |
402 if CTNInstance != self: |
403 AllNames.append(CTNInstance.BaseParams.getName()) |
403 AllNames.append(CTNInstance.BaseParams.getName()) |
404 |
404 |
405 # Find a free name, eventually appending digit |
405 # Find a free name, eventually appending digit |
427 msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1 = DesiredName, a2 = res) |
427 msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1 = DesiredName, a2 = res) |
428 self.GetCTRoot().logger.write_warning(msg) |
428 self.GetCTRoot().logger.write_warning(msg) |
429 return res |
429 return res |
430 |
430 |
431 def GetAllChannels(self): |
431 def GetAllChannels(self): |
432 AllChannels=[] |
432 AllChannels = [] |
433 for CTNInstance in self.CTNParent.IterChildren(): |
433 for CTNInstance in self.CTNParent.IterChildren(): |
434 if CTNInstance != self: |
434 if CTNInstance != self: |
435 AllChannels.append(CTNInstance.BaseParams.getIEC_Channel()) |
435 AllChannels.append(CTNInstance.BaseParams.getIEC_Channel()) |
436 AllChannels.sort() |
436 AllChannels.sort() |
437 return AllChannels |
437 return AllChannels |