/[svn]/linuxsampler/trunk/src/scriptvm/ScriptVM.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/ScriptVM.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2581 by schoenebeck, Fri May 30 12:48:05 2014 UTC revision 2594 by schoenebeck, Thu Jun 5 00:16:25 2014 UTC
# Line 20  Line 20 
20  namespace LinuxSampler {  namespace LinuxSampler {
21    
22      class ParserContext;      class ParserContext;
23        class ExecContext;
24    
25        /** @brief Core virtual machine for real-time instrument scripts.
26         *
27         * This is the core of the virtual machine, used for running real-time
28         * instrument scripts. The core encompasses the instrument script parser,
29         * generalized virtual machine and very generic built-in script functions.
30         * Thus this class only provides functionalities which are yet independent
31         * of the actual purpose the virtual machine is going to be used for.
32         *
33         * The actual use case specific functionalites (i.e. MIDI processing) is
34         * then implemented by VM classes which are derived from this generalized
35         * ScriptVM class.
36         *
37         * This class is re-entrant safe, but not thread safe. So you can share one
38         * instance of this class between multiple (native) threads, but you @b must
39         * @b not execute methods of the same class instance simultaniously from
40         * different (native) threads. If you want to execute scripts simultaniously
41         * multi threaded, then create a separate ScriptVM instance for each
42         * (native) thread. Also note that one VMParserContext instance is tied to
43         * exactly one ScriptVM instance. So you @b must @b not create a
44         * VMParserContext with one ScriptVM instance and run it with a different
45         * ScriptVM instance!
46         */
47      class ScriptVM : public VMFunctionProvider {      class ScriptVM : public VMFunctionProvider {
48      public:      public:
49          ScriptVM();          ScriptVM();
50          virtual ~ScriptVM();          virtual ~ScriptVM();
51          void loadScript(const String& s);          VMParserContext* loadScript(const String& s);
52          void loadScript(std::istream* is);          VMParserContext* loadScript(std::istream* is);
53          std::vector<ParserIssue> issues() const;          void dumpParsedScript(VMParserContext* context);
54          std::vector<ParserIssue> errors() const;          VMExecContext* createExecContext(VMParserContext* parserContext);
55          std::vector<ParserIssue> warnings() const;          VMExecStatus_t exec(VMParserContext* parserContext, VMExecContext* execContex, VMEventHandler* handler);
56          void dumpParsedScript();          VMFunction* functionByName(const String& name) OVERRIDE;
57          VMExecContext* createExecContext();          std::map<String,VMIntRelPtr*> builtInIntVariables() OVERRIDE;
58          VMEventHandler* eventHandler(uint index);          std::map<String,VMInt8Array*> builtInIntArrayVariables() OVERRIDE;
59          VMEventHandler* eventHandlerByName(const String& name);          std::map<String,int> builtInConstIntVariables() OVERRIDE;
60          VMExecStatus_t exec(VMEventHandler* handler, VMExecContext* execContex);  
61          VMExecContext* currentVMExecContext();          VMParserContext* currentVMParserContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)
62          VMFunction* functionByName(const String& name);          VMExecContext* currentVMExecContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)
63      protected:      protected:
64          ParserContext* m_context;          ParserContext* m_parserContext;
65          CoreVMFunction_message fnMessage;          CoreVMFunction_message fnMessage;
66          CoreVMFunction_exit fnExit;          CoreVMFunction_exit fnExit;
67          CoreVMFunction_wait fnWait;          CoreVMFunction_wait fnWait;

Legend:
Removed from v.2581  
changed lines
  Added in v.2594

  ViewVC Help
Powered by ViewVC