POULibrary.py
branchsvghmi
changeset 2964 a7b11c9f468e
parent 1917 d51d14719392
child 2971 f0a822ef9fa0
equal deleted inserted replaced
2957:c0ea5015e46f 2964:a7b11c9f468e
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
    27 from weakref import ref
    27 from weakref import ref
    28 
    28 
       
    29 from ConfigTreeNode import UserAddressedException
    29 
    30 
    30 class POULibrary(object):
    31 class POULibrary(object):
    31     def __init__(self, CTR, LibName, TypeStack):
    32     def __init__(self, CTR, LibName, TypeStack):
    32         from PLCControler import PLCControler
    33         from PLCControler import PLCControler
    33         self.CTR = ref(CTR)
    34         self.CTR = ref(CTR)
    57 
    58 
    58     def Generate_C(self, buildpath, varlist, IECCFLAGS):
    59     def Generate_C(self, buildpath, varlist, IECCFLAGS):
    59         # Pure python or IEC libs doesn't produce C code
    60         # Pure python or IEC libs doesn't produce C code
    60         return ((""), [], False), ""
    61         return ((""), [], False), ""
    61 
    62 
       
    63     def FatalError(self, message):
       
    64         """ Raise an exception that will trigger error message intended to 
       
    65             the user, but without backtrace since it is not a software error """
       
    66 
       
    67         raise UserAddressedException(message)
    62 
    68 
    63 def SimplePOULibraryFactory(path):
    69 def SimplePOULibraryFactory(path):
    64     class SimplePOULibrary(POULibrary):
    70     class SimplePOULibrary(POULibrary):
    65         def GetLibraryPath(self):
    71         def GetLibraryPath(self):
    66             return path
    72             return path