1 |
/* |
2 |
* Copyright (c) 2014 Christian Schoenebeck |
3 |
* |
4 |
* http://www.linuxsampler.org |
5 |
* |
6 |
* This file is part of LinuxSampler and released under the same terms. |
7 |
* See README file for details. |
8 |
*/ |
9 |
|
10 |
#ifndef LS_SCRIPTVM_H |
11 |
#define LS_SCRIPTVM_H |
12 |
|
13 |
#include <iostream> |
14 |
#include <vector> |
15 |
|
16 |
#include "../common/global.h" |
17 |
#include "common.h" |
18 |
#include "CoreVMFunctions.h" |
19 |
|
20 |
namespace LinuxSampler { |
21 |
|
22 |
class ParserContext; |
23 |
class ExecContext; |
24 |
|
25 |
class ScriptVM : public VMFunctionProvider { |
26 |
public: |
27 |
ScriptVM(); |
28 |
virtual ~ScriptVM(); |
29 |
VMParserContext* loadScript(const String& s); |
30 |
VMParserContext* loadScript(std::istream* is); |
31 |
void dumpParsedScript(VMParserContext* context); |
32 |
VMExecContext* createExecContext(VMParserContext* parserContext); |
33 |
VMExecStatus_t exec(VMParserContext* parserContext, VMExecContext* execContex, VMEventHandler* handler); |
34 |
VMFunction* functionByName(const String& name); |
35 |
|
36 |
VMParserContext* currentVMParserContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions) |
37 |
VMExecContext* currentVMExecContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions) |
38 |
protected: |
39 |
|
40 |
ParserContext* m_parserContext; |
41 |
CoreVMFunction_message fnMessage; |
42 |
CoreVMFunction_exit fnExit; |
43 |
CoreVMFunction_wait fnWait; |
44 |
}; |
45 |
|
46 |
} // namespace LinuxSampler |
47 |
|
48 |
#endif // LS_INSTRUMENTSCRIPTVM_H |