--- linuxsampler/trunk/src/scriptvm/common.h 2016/12/16 12:57:59 3056 +++ linuxsampler/trunk/src/scriptvm/common.h 2017/06/22 10:45:38 3285 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Christian Schoenebeck + * Copyright (c) 2014-2017 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -644,8 +644,9 @@ struct VMInt8Array { int8_t* data; int size; + bool readonly; ///< Whether the array data may be modified or just be read. - VMInt8Array() : data(NULL), size(0) {} + VMInt8Array() : data(NULL), size(0), readonly(false) {} }; /** @brief Virtual machine script variable. @@ -757,6 +758,16 @@ public: }; + /** @brief Dynamically executed variable (of integer array data type). + * + * This is the base class for all built-in integer array script variables + * whose variable content needs to be provided dynamically by executable + * native code on each script variable access. + */ + class VMDynIntArrayVar : virtual public VMDynVar, virtual public VMIntArrayExpr { + public: + }; + /** @brief Provider for built-in script functions and variables. * * Abstract base class defining the high-level interface for all classes @@ -840,6 +851,34 @@ * @see ScriptVM::exec() */ virtual int suspensionTimeMicroseconds() const = 0; + + /** + * Causes all polyphonic variables to be reset to zero values. A + * polyphonic variable is expected to be zero when entering a new event + * handler instance. As an exception the values of polyphonic variables + * shall only be preserved from an note event handler instance to its + * correspending specific release handler instance. So in the latter + * case the script author may pass custom data from the note handler to + * the release handler, but only for the same specific note! + */ + virtual void resetPolyphonicData() = 0; + + /** + * Returns amount of virtual machine instructions which have been + * performed the last time when this execution context was executing a + * script. So in case you need the overall amount of instructions + * instead, then you need to add them by yourself after each + * ScriptVM::exec() call. + */ + virtual size_t instructionsPerformed() const = 0; + + /** + * Sends a signal to this script execution instance to abort its script + * execution as soon as possible. This method is called i.e. when one + * script execution instance intends to stop another script execution + * instance. + */ + virtual void signalAbort() = 0; }; /** @brief Script callback for a certain event. @@ -871,6 +910,20 @@ }; /** + * Reflects the precise position and span of a specific code block within + * a script. This is currently only used for the locations of commented + * code blocks due to preprocessor statements. + * + * @see VMParserContext::preprocessorComments() + */ + struct CodeBlock { + int firstLine; ///< The first line number of this code block within the script (indexed with 1 being the very first line). + int lastLine; ///< The last line number of this code block within the script. + int firstColumn; ///< The first column of this code block within the script (indexed with 1 being the very first column). + int lastColumn; ///< The last column of this code block within the script. + }; + + /** * Encapsulates a noteworty parser issue. This encompasses the type of the * issue (either a parser error or parser warning), a human readable * explanation text of the error or warning and the location of the @@ -963,6 +1016,12 @@ virtual std::vector warnings() const = 0; /** + * Returns all code blocks of the script which were filtered out by the + * preprocessor. + */ + virtual std::vector preprocessorComments() const = 0; + + /** * Returns the translated virtual machine representation of an event * handler block (i.e. "on note ... end on" code block) within the * parsed script. This translated representation of the event handler