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 |
|
|
|
24 |
|
|
class ScriptVM : public VMFunctionProvider { |
25 |
|
|
public: |
26 |
|
|
ScriptVM(); |
27 |
|
|
virtual ~ScriptVM(); |
28 |
|
|
void loadScript(const String& s); |
29 |
|
|
void loadScript(std::istream* is); |
30 |
|
|
std::vector<ParserIssue> issues() const; |
31 |
|
|
std::vector<ParserIssue> errors() const; |
32 |
|
|
std::vector<ParserIssue> warnings() const; |
33 |
|
|
void dumpParsedScript(); |
34 |
|
|
VMExecContext* createExecContext(); |
35 |
|
|
VMEventHandler* eventHandler(uint index); |
36 |
|
|
VMEventHandler* eventHandlerByName(const String& name); |
37 |
|
|
VMExecStatus_t exec(VMEventHandler* handler, VMExecContext* execContex); |
38 |
|
|
VMExecContext* currentVMExecContext(); |
39 |
|
|
VMFunction* functionByName(const String& name); |
40 |
|
|
protected: |
41 |
|
|
ParserContext* m_context; |
42 |
|
|
CoreVMFunction_message fnMessage; |
43 |
|
|
CoreVMFunction_exit fnExit; |
44 |
|
|
CoreVMFunction_wait fnWait; |
45 |
|
|
}; |
46 |
|
|
|
47 |
|
|
} // namespace LinuxSampler |
48 |
|
|
|
49 |
|
|
#endif // LS_INSTRUMENTSCRIPTVM_H |