blob: b25c651f69cc85c8d95b4bf139509e7c64af1145 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#ifndef SCRIPT_ENGINE_H
#define SCRIPT_ENGINE_H
#include "number.h"
#include "expression.h"
#include <bu/hash.h>
#include <bu/list.h>
#include <bu/string.h>
#include <bu/signals.h>
namespace Bu
{
class Stream;
}
class Expression;
class ScriptEngine
{
private:
typedef Bu::Hash<Bu::String, Number> VarHash;
typedef Bu::List<Number> NumStack;
public:
ScriptEngine();
virtual ~ScriptEngine();
void exec( const Bu::String &sExpr );
void exec( Bu::Stream &sInput );
void exec( Expression *pExpr );
bool isRunning() const { return bRunning; }
public:
Bu::Signal1<void, const class Number &> sigNumResult;
Bu::Signal1<void, const Bu::String &> sigError;
Bu::Signal1<void, const Bu::String &> sigMessage;
private:
void command( Expression::iterator &i );
private:
VarHash hVarState;
bool bRunning;
};
#endif
|