30#include "../platforms/sdl/PlatformEventQueue.h"
31#include "../base/FunctionMap.h"
33#include "../apps/Globals.h"
38#include "../base/Evaluator.h"
39#include "emscripten.h"
42#include "../base/Evaluator.h"
45#include "../base/PComplexData.h"
46#include "../base/PEBLObject.h"
47#include "../base/PNode.h"
48#include "../base/grammar.tab.hpp"
50#include "../utility/Defs.h"
51#include "../utility/PEBLUtility.h"
53#include "../libs/PEBLEnvironment.h"
79 mCallbackScheduled =
false;
80 mCallbackNodeStackSize = 0;
98 const std::string & function,
142 const std::string & function,
181 std::vector<DeviceState*>::iterator i =
mStates.begin();
212 unsigned int i, result =0;
230#ifdef PEBL_ITERATIVE_EVAL
234 if(mCallbackScheduled)
238 size_t targetNodeStackSize = mCallbackNodeStackSize;
242 while(!
myEval->mNodeStack.empty() &&
243 myEval->mNodeStack.size() > targetNodeStackSize)
250#ifdef PEBL_EMSCRIPTEN
285 unsigned int result =0;
286 bool matched =
false;
289 mCallbackScheduled =
false;
314 result =
mStates[i]->TestDevice();
324 mCallbackNodeStackSize =
myEval->mNodeStack.size();
350 OpNode * functionCallNode =
new OpNode(PEBL_FUNCTION, (
PNode*)funcNameNode, (
PNode*)paramsNode,
"event-callback", -1);
353 mCallbackScheduled =
true;
402 result =
mStates[i]->TestDevice();
443 mCallbackNodeStackSize =
myEval->mNodeStack.size();
468 OpNode * functionCallNode =
new OpNode(PEBL_FUNCTION, (
PNode*)funcNameNode, (
PNode*)paramsNode,
"event-callback", -1);
471 mCallbackScheduled =
true;
519 out <<
"PEBL Event Loop:" << flush;
std::ostream & operator<<(std::ostream &out, const PEventLoop &loop)
PlatformEventQueue * gEventQueue
void NodeStackPush(const PNode *node)
static VariableMap gGlobalVariableMap
std::vector< Variant > mParameters
std::vector< bool > mIsEvent
std::vector< PNode * > mNodes
PEvent Loop()
Initiates the looping tests.
PEvent Loop1()
Initiates the looping tests.
void RegisterEvent(DeviceState *state, const std::string &function, Variant parameters)
void RegisterState(DeviceState *state, const std::string &function, Variant parameters)
~PEventLoop()
This is the standard pNode destructor.
std::vector< Variant > mFunctionNames
PEventLoop()
This is the standard PEventLoop constructor.
std::vector< DeviceState * > mStates
virtual PEBL_DEVICE_TYPE GetFirstEventType()
virtual PEvent GetFirstEvent()
PEBL_DEVICE_TYPE GetType() const
void SetDummyEvent(const PEBL_DummyEvent &evt)
void PushBack(const Variant &v)
void AddVariable(const std::string &varname, const Variant &val)
Variant RetrieveValue(const std::string &varname)
PComplexData * GetComplexData() const