/[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 2727 by schoenebeck, Tue Mar 31 17:46:11 2015 UTC revision 2879 by schoenebeck, Tue Apr 19 14:07:53 2016 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014-2015 Christian Schoenebeck   * Copyright (c) 2014-2016 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 40  namespace LinuxSampler { Line 40  namespace LinuxSampler {
40       * - 1. Create an instance of this ScriptVM class (or of one of its deriving       * - 1. Create an instance of this ScriptVM class (or of one of its deriving
41       *      classes).       *      classes).
42       * - 2. Load a script by passing its source code to method loadScript(),       * - 2. Load a script by passing its source code to method loadScript(),
43       *      which will return the parsed represenation of the script.       *      which will return the parsed representation of the script.
44       * - 3. Create a VM execution context by calling createExecContext().       * - 3. Create a VM execution context by calling createExecContext().
45       * - 4. Execute the script by calling method exec().       * - 4. Execute the script by calling method exec().
46       *       *
# Line 61  namespace LinuxSampler { Line 61  namespace LinuxSampler {
61    
62          /**          /**
63           * Loads a script given by its source code (passed as argument @a s to           * Loads a script given by its source code (passed as argument @a s to
64           * this method) and returns the parsed represenation of that script.           * this method) and returns the parsed representation of that script.
65           * After calling this method you must check the returned VMParserContext           * After calling this method you must check the returned VMParserContext
66           * object whether there had been any parser errors. If there were no           * object whether there had been any parser errors. If there were no
67           * parser errors, you may pass the VMParserContext object to method           * parser errors, you may pass the VMParserContext object to method
68           * exec() for actually executing the script.           * exec() for actually executing the script.
69           *           *
70           * @param s - entire source code of the script to be loaded           * @param s - entire source code of the script to be loaded
71           * @returns parsed represenation of the script           * @returns parsed representation of the script
72           */           */
73          VMParserContext* loadScript(const String& s);          VMParserContext* loadScript(const String& s);
74    
# Line 78  namespace LinuxSampler { Line 78  namespace LinuxSampler {
78           *           *
79           * @param is - input stream from which the entire source code of the           * @param is - input stream from which the entire source code of the
80           *             script is to be read and loaded from           *             script is to be read and loaded from
81           * @returns parsed represenation of the script           * @returns parsed representation of the script
82           */           */
83          VMParserContext* loadScript(std::istream* is);          VMParserContext* loadScript(std::istream* is);
84    
# Line 87  namespace LinuxSampler { Line 87  namespace LinuxSampler {
87           * argument @a context, to stdout. This method is for debugging purposes           * argument @a context, to stdout. This method is for debugging purposes
88           * only.           * only.
89           *           *
90           * @param context - parsed represenation of the script           * @param context - parsed representation of the script
91             * @see loadScript()
92           */           */
93          void dumpParsedScript(VMParserContext* context);          void dumpParsedScript(VMParserContext* context);
94    
# Line 97  namespace LinuxSampler { Line 98  namespace LinuxSampler {
98           * general real-time design of this virtual machine, the VM execution           * general real-time design of this virtual machine, the VM execution
99           * context differs for every script. So you must (re)create the           * context differs for every script. So you must (re)create the
100           * execution context for each script being loaded.           * execution context for each script being loaded.
101             *
102             * @param parserContext - parsed representation of the script
103             * @see loadScript()
104           */           */
105          VMExecContext* createExecContext(VMParserContext* parserContext);          VMExecContext* createExecContext(VMParserContext* parserContext);
106    
# Line 110  namespace LinuxSampler { Line 114  namespace LinuxSampler {
114           * This method usually blocks until the entire script event handler           * This method usually blocks until the entire script event handler
115           * block has been executed completely. It may however also return before           * block has been executed completely. It may however also return before
116           * completion if either a) a script runtime error occurred or b) the           * completion if either a) a script runtime error occurred or b) the
117           * script was suspened by the VM (either because script execution           * script was suspended by the VM (either because script execution
118           * exceeded a certain limit of time or the script called the built-in           * exceeded a certain limit of time or the script called the built-in
119           * wait() function). You must check the return value of this method to           * wait() function). You must check the return value of this method to
120           * find out which case applies.           * find out which case applies.
121           *           *
122           * @param parserContext - parsed represenation of the script           * @param parserContext - parsed representation of the script (see loadScript())
123           * @param execContext - VM execution context (see createExecContext())           * @param execContext - VM execution context (see createExecContext())
124           * @param handler - precise event handler (i.e. "on note ... end on"           * @param handler - precise event handler (i.e. "on note ... end on"
125           *                  code block) to be executed           *                  code block) to be executed
# Line 177  namespace LinuxSampler { Line 181  namespace LinuxSampler {
181           */           */
182          std::map<String,int> builtInConstIntVariables() OVERRIDE;          std::map<String,int> builtInConstIntVariables() OVERRIDE;
183    
184            VMEventHandler* currentVMEventHandler(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)
185          VMParserContext* currentVMParserContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)          VMParserContext* currentVMParserContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)
186          VMExecContext* currentVMExecContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)          VMExecContext* currentVMExecContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions)
187    
188      protected:      protected:
189            VMEventHandler* m_eventHandler;
190          ParserContext* m_parserContext;          ParserContext* m_parserContext;
191          CoreVMFunction_message fnMessage;          CoreVMFunction_message fnMessage;
192          CoreVMFunction_exit fnExit;          CoreVMFunction_exit fnExit;

Legend:
Removed from v.2727  
changed lines
  Added in v.2879

  ViewVC Help
Powered by ViewVC