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 |
* |
* |
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 |
|
|
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 |
|
|
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() |
* @see loadScript() |
92 |
*/ |
*/ |
93 |
void dumpParsedScript(VMParserContext* context); |
void dumpParsedScript(VMParserContext* context); |
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 represenation of the script |
* @param parserContext - parsed representation of the script |
103 |
* @see loadScript() |
* @see loadScript() |
104 |
*/ |
*/ |
105 |
VMExecContext* createExecContext(VMParserContext* parserContext); |
VMExecContext* createExecContext(VMParserContext* parserContext); |
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 (see loadScript()) |
* @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 |