1 |
schoenebeck |
2581 |
/* |
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 |
schoenebeck |
2588 |
class ExecContext; |
24 |
schoenebeck |
2581 |
|
25 |
|
|
class ScriptVM : public VMFunctionProvider { |
26 |
|
|
public: |
27 |
|
|
ScriptVM(); |
28 |
|
|
virtual ~ScriptVM(); |
29 |
schoenebeck |
2588 |
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 |
schoenebeck |
2581 |
VMFunction* functionByName(const String& name); |
35 |
schoenebeck |
2588 |
|
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 |
schoenebeck |
2581 |
protected: |
39 |
schoenebeck |
2588 |
|
40 |
|
|
ParserContext* m_parserContext; |
41 |
schoenebeck |
2581 |
CoreVMFunction_message fnMessage; |
42 |
|
|
CoreVMFunction_exit fnExit; |
43 |
|
|
CoreVMFunction_wait fnWait; |
44 |
|
|
}; |
45 |
|
|
|
46 |
|
|
} // namespace LinuxSampler |
47 |
|
|
|
48 |
|
|
#endif // LS_INSTRUMENTSCRIPTVM_H |