ProjectController.py
changeset 2640 1b4b335e19ea
parent 2632 534387caf43d
child 2645 d15a997859b1
child 2956 6b01738308bb
equal deleted inserted replaced
2639:62b5f7b909a9 2640:1b4b335e19ea
    61 from plcopen.structures import IEC_KEYWORDS
    61 from plcopen.structures import IEC_KEYWORDS
    62 from plcopen.types_enums import ComputeConfigurationResourceName, ITEM_CONFNODE
    62 from plcopen.types_enums import ComputeConfigurationResourceName, ITEM_CONFNODE
    63 import targets
    63 import targets
    64 from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer
    64 from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer
    65 from runtime import PlcStatus
    65 from runtime import PlcStatus
    66 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
    66 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage, UserAddressedException
    67 
    67 
    68 base_folder = paths.AbsParentDir(__file__)
    68 base_folder = paths.AbsParentDir(__file__)
    69 
    69 
    70 MATIEC_ERROR_MODEL = re.compile(
    70 MATIEC_ERROR_MODEL = re.compile(
    71     r".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
    71     r".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
  1169 
  1169 
  1170         # Generate C code and compilation params from liraries
  1170         # Generate C code and compilation params from liraries
  1171         try:
  1171         try:
  1172             LibCFilesAndCFLAGS, LibLDFLAGS, LibExtraFiles = self.GetLibrariesCCode(
  1172             LibCFilesAndCFLAGS, LibLDFLAGS, LibExtraFiles = self.GetLibrariesCCode(
  1173                 buildpath)
  1173                 buildpath)
  1174         except Exception:
  1174         except UserAddressedException as e:
       
  1175             self.logger.write_error(e.message)
       
  1176             return False
       
  1177         except Exception as e:
  1175             self.logger.write_error(
  1178             self.logger.write_error(
  1176                 _("Runtime library extensions C code generation failed !\n"))
  1179                 _("Runtime library extensions C code generation failed !\n"))
  1177             self.logger.write_error(traceback.format_exc())
  1180             self.logger.write_error(traceback.format_exc())
  1178             return False
  1181             return False
  1179 
  1182 
  1180         # Generate C code and compilation params from confnode hierarchy
  1183         # Generate C code and compilation params from confnode hierarchy
  1181         try:
  1184         try:
  1182             CTNLocationCFilesAndCFLAGS, CTNLDFLAGS, CTNExtraFiles = self._Generate_C(
  1185             CTNLocationCFilesAndCFLAGS, CTNLDFLAGS, CTNExtraFiles = self._Generate_C(
  1183                 buildpath,
  1186                 buildpath,
  1184                 self.PLCGeneratedLocatedVars)
  1187                 self.PLCGeneratedLocatedVars)
       
  1188         except UserAddressedException as e:
       
  1189             self.logger.write_error(e.message)
       
  1190             return False
  1185         except Exception:
  1191         except Exception:
  1186             self.logger.write_error(
  1192             self.logger.write_error(
  1187                 _("Runtime IO extensions C code generation failed !\n"))
  1193                 _("Runtime IO extensions C code generation failed !\n"))
  1188             self.logger.write_error(traceback.format_exc())
  1194             self.logger.write_error(traceback.format_exc())
  1189             return False
  1195             return False