POULibrary.py
changeset 2645 d15a997859b1
parent 1917 d51d14719392
child 2744 577118ebd179
child 2981 a0932a52e53b
equal deleted inserted replaced
2644:769fefae7c81 2645:d15a997859b1
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    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 
       
    29 # Exception type for problems that user has to take action in order to fix
       
    30 class UserAddressedException(Exception):
       
    31     pass
    28 
    32 
    29 
    33 
    30 class POULibrary(object):
    34 class POULibrary(object):
    31     def __init__(self, CTR, LibName, TypeStack):
    35     def __init__(self, CTR, LibName, TypeStack):
    32         from PLCControler import PLCControler
    36         from PLCControler import PLCControler
    57 
    61 
    58     def Generate_C(self, buildpath, varlist, IECCFLAGS):
    62     def Generate_C(self, buildpath, varlist, IECCFLAGS):
    59         # Pure python or IEC libs doesn't produce C code
    63         # Pure python or IEC libs doesn't produce C code
    60         return ((""), [], False), ""
    64         return ((""), [], False), ""
    61 
    65 
       
    66     def FatalError(self, message):
       
    67         """ Raise an exception that will trigger error message intended to 
       
    68             the user, but without backtrace since it is not a software error """
       
    69 
       
    70         raise UserAddressedException(message)
    62 
    71 
    63 def SimplePOULibraryFactory(path):
    72 def SimplePOULibraryFactory(path):
    64     class SimplePOULibrary(POULibrary):
    73     class SimplePOULibrary(POULibrary):
    65         def GetLibraryPath(self):
    74         def GetLibraryPath(self):
    66             return path
    75             return path