194 "SIZE" : size "X", "B", "W", "D", "L" |
194 "SIZE" : size "X", "B", "W", "D", "L" |
195 "LOC" : tuple of interger for IEC location (0,1,2,...) |
195 "LOC" : tuple of interger for IEC location (0,1,2,...) |
196 }, ...] |
196 }, ...] |
197 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
197 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
198 """ |
198 """ |
199 logger.write_warning(".".join(map(lambda x:str(x), self.GetCurrentLocation())) + " -> Nothing yo do\n") |
199 logger.write_warning(".".join(map(lambda x:str(x), self.GetCurrentLocation())) + " -> Nothing to do\n") |
200 return [],"",False |
200 return [],"",False |
201 |
201 |
202 def _Generate_C(self, buildpath, locations, logger): |
202 def _Generate_C(self, buildpath, locations, logger): |
203 # Generate plugins [(Cfiles, CFLAGS)], LDFLAGS |
203 # Generate plugins [(Cfiles, CFLAGS)], LDFLAGS |
204 PlugCFilesAndCFLAGS, PlugLDFLAGS, DoCalls = self.PlugGenerate_C(buildpath, locations, logger) |
204 PlugCFilesAndCFLAGS, PlugLDFLAGS, DoCalls = self.PlugGenerate_C(buildpath, locations, logger) |
206 if PlugCFilesAndCFLAGS: |
206 if PlugCFilesAndCFLAGS: |
207 LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), PlugCFilesAndCFLAGS, DoCalls)] |
207 LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), PlugCFilesAndCFLAGS, DoCalls)] |
208 else: |
208 else: |
209 LocationCFilesAndCFLAGS = [] |
209 LocationCFilesAndCFLAGS = [] |
210 |
210 |
211 # plugin asks some some LDFLAGS |
211 # plugin asks for some LDFLAGS |
212 if PlugLDFLAGS: |
212 if PlugLDFLAGS: |
213 # LDFLAGS can be either string |
213 # LDFLAGS can be either string |
214 if type(PlugLDFLAGS)==type(str()): |
214 if type(PlugLDFLAGS)==type(str()): |
215 LDFLAGS=[PlugLDFLAGS] |
215 LDFLAGS=[PlugLDFLAGS] |
216 #or list of strings |
216 #or list of strings |
878 return False |
878 return False |
879 # Now extract C files of stdout |
879 # Now extract C files of stdout |
880 C_files = [ fname for fname in result.splitlines() if fname[-2:]==".c" or fname[-2:]==".C" ] |
880 C_files = [ fname for fname in result.splitlines() if fname[-2:]==".c" or fname[-2:]==".C" ] |
881 # remove those that are not to be compiled because included by others |
881 # remove those that are not to be compiled because included by others |
882 C_files.remove("POUS.c") |
882 C_files.remove("POUS.c") |
|
883 if not C_files: |
|
884 logger.write_error("Error : At least one configuration and one ressource must be declared in PLC !\n") |
|
885 return False |
883 # transform those base names to full names with path |
886 # transform those base names to full names with path |
884 C_files = map(lambda filename:os.path.join(buildpath, filename), C_files) |
887 C_files = map(lambda filename:os.path.join(buildpath, filename), C_files) |
885 logger.write("Extracting Located Variables...\n") |
888 logger.write("Extracting Located Variables...\n") |
886 # Keep track of generated located variables for later use by self._Generate_C |
889 # Keep track of generated located variables for later use by self._Generate_C |
887 self.PLCGeneratedLocatedVars = self.GetLocations() |
890 self.PLCGeneratedLocatedVars = self.GetLocations() |