summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_timeout.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_timeout.py')
0 files changed, 0 insertions, 0 deletions
cal invokers, where the main thread is required in order to react to UI events. You will have to deligate control flow from the main thread into the interpreter every now and then: - interpreter.runOnMainThread(25); + interpreter.runOnMainThread(25); This will perform a single iteration on the invoked components with a maximum of 25 frames per seconds or return immediately. You will have to call this method every now and then if you are using e.g. the scenegraph invoker. ### Blocking Interpretation with inline SCXML - Interpreter scxml = Interpreter::fromXML(""); - scxml.interpret(); // blocking + Interpreter scxml = Interpreter::fromXML(""); + scxml.interpret(); // blocking ### Callbacks for an Interpreter You can register an InterpreterMonitor prior to start in order to receive control-flow upon various events in the Interpreter. - class StatusMonitor : public uscxml::InterpreterMonitor { - void onStableConfiguration(Interpreter) {} - void beforeCompletion(Interpreter) {} - void afterCompletion(Interpreter) {} - void beforeMicroStep(Interpreter) {} - void beforeTakingTransitions(Interpreter, const Arabica::XPath::NodeSet&) {} - void beforeEnteringStates(Interpreter, const Arabica::XPath::NodeSet&) {} - void afterEnteringStates(Interpreter) {} - void beforeExitingStates(Interpreter, const Arabica::XPath::NodeSet&) {} - void afterExitingStates(Interpreter) {} - }; - - StatusMonitor statMon; - Interpreter scxml = Interpreter::fromXML(""); - scxml.addMonitor(&statMon); - scxml.start(); + class StatusMonitor : public uscxml::InterpreterMonitor { + void onStableConfiguration(Interpreter) {} + void beforeCompletion(Interpreter) {} + void afterCompletion(Interpreter) {} + void beforeMicroStep(Interpreter) {} + void beforeTakingTransitions(Interpreter, const Arabica::XPath::NodeSet&) {} + void beforeEnteringStates(Interpreter, const Arabica::XPath::NodeSet&) {} + void afterEnteringStates(Interpreter) {} + void beforeExitingStates(Interpreter, const Arabica::XPath::NodeSet&) {} + void afterExitingStates(Interpreter) {} + }; + + StatusMonitor statMon; + Interpreter scxml = Interpreter::fromXML(""); + scxml.addMonitor(&statMon); + scxml.start(); This will cause the interpreter to invoke the callbacks from the monitor whenever the corresponding internal phase is reached. @@ -135,15 +135,15 @@ internal phase is reached. The uSCXML interpreter can be extended by introducing new - 1. DataModels as embedded scripting languages (e.g. ECMAScript, Prolog and XPath) - 2. Invokers to represent external components that deliver and accept events (e.g. iCal, SceneGraph, DirectoryMonitor) - 3. I/O-Processors to provide communication with external systems (e.g. BasicHTTP, SCXML). - 4. Elements for Executable Content (e.g. <respond>, <fetch>, <postpone>). +1. DataModels as embedded scripting languages (e.g. ECMAScript, Prolog and XPath) +2. Invokers to represent external components that deliver and accept events (e.g. iCal, SceneGraph, DirectoryMonitor) +3. I/O-Processors to provide communication with external systems (e.g. BasicHTTP, SCXML). +4. Elements for Executable Content (e.g. <respond>, <fetch>, <postpone>). The basic approach to extend the interpreter is the same in all cases: - 1. Write a class inheriting the abstract base class (e.g. DataModelImpl, InvokerImpl, IOProcessorImpl, ExecutableContentImpl). - 2. Instantiate your class and register it as a prototype at the Factory via one of its static register* methods. - 1. You can register at the global Factory Singleton via Factory::register*(prototypeInstance) - 2. Or provide a new Factory instance to selected interpreters as an in-between. - 3. Write an interpreter using your new functionality. +1. Write a class inheriting the abstract base class (e.g. DataModelImpl, InvokerImpl, IOProcessorImpl, ExecutableContentImpl). +2. Instantiate your class and register it as a prototype at the Factory via one of its static register* methods. + 1. You can register at the global Factory Singleton via Factory::register*(prototypeInstance) + 2. Or provide a new Factory instance to selected interpreters as an in-between. +3. Write an interpreter using your new functionality. -- cgit v0.12