Skip to content
Snippets Groups Projects
Commit a5e447b6 authored by Phil's avatar Phil
Browse files

Wrapped Automaton state methods with objects to give them .breaks() and .intercepts() methods

parent bfae396a
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,21 @@ class Message: ...@@ -36,6 +36,21 @@ class Message:
for (k,v) in self.__dict__.iteritems() for (k,v) in self.__dict__.iteritems()
if not k.startswith("_")) if not k.startswith("_"))
class instance_state:
def __init__(self, instance):
self.im_self = instance.im_self
self.im_func = instance.im_func
self.im_class = instance.im_class
def __getattr__(self, attr):
return getattr(self.im_func, attr)
def __call__(self, *args, **kargs):
return self.im_func(self.im_self, *args, **kargs)
def breaks(self):
return self.im_self.add_breakpoints(self.im_func)
def intercepts(self):
return self.im_self.add_interception_points(self.im_func)
############## ##############
## Automata ## ## Automata ##
...@@ -370,6 +385,12 @@ class Automaton: ...@@ -370,6 +385,12 @@ class Automaton:
ioout.ioname = n ioout.ioname = n
setattr(self.io, n, self._IO_mixer(ioout,ioin)) setattr(self.io, n, self._IO_mixer(ioout,ioin))
setattr(self.oi, n, self._IO_mixer(ioin,ioout)) setattr(self.oi, n, self._IO_mixer(ioin,ioout))
for stname in self.states:
setattr(self, stname,
instance_state(getattr(self, stname)))
self.parse_args(*args, **kargs) self.parse_args(*args, **kargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment