--- linuxsampler/trunk/src/scriptvm/common.h 2016/10/31 00:05:00 3034 +++ linuxsampler/trunk/src/scriptvm/common.h 2017/05/25 10:53:45 3207 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Christian Schoenebeck + * Copyright (c) 2014-2017 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -157,9 +157,17 @@ * expressions to an array expression for you, instead this method will * simply return NULL! * + * @b Note: this method is currently, and in contrast to its other + * counter parts, declared as virtual method. Some deriving classes are + * currently using this to override this default implementation in order + * to implement an "evaluate now as integer array" behavior. This has + * efficiency reasons, however this also currently makes this part of + * the API less clean and should thus be addressed in future with + * appropriate changes to the API. + * * @see exprType() */ - VMIntArrayExpr* asIntArray() const; + virtual VMIntArrayExpr* asIntArray() const; /** * Returns true in case this expression can be considered to be a @@ -539,6 +547,17 @@ } }; + #if HAVE_CXX_EMBEDDED_PRAGMA_DIAGNOSTICS + # define COMPILER_DISABLE_OFFSETOF_WARNING \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") + # define COMPILER_RESTORE_OFFSETOF_WARNING \ + _Pragma("GCC diagnostic pop") + #else + # define COMPILER_DISABLE_OFFSETOF_WARNING + # define COMPILER_RESTORE_OFFSETOF_WARNING + #endif + /** * Convenience macro for initializing VMIntRelPtr and VMInt8RelPtr * structures. Usage example: @@ -583,14 +602,13 @@ */ #define DECLARE_VMINT(basePtr, T_struct, T_member) ( \ /* Disable offsetof warning, trust us, we are cautios. */ \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") \ + COMPILER_DISABLE_OFFSETOF_WARNING \ (VMRelPtr) { \ (void**) &basePtr, \ offsetof(T_struct, T_member), \ false \ } \ - _Pragma("GCC diagnostic pop") \ + COMPILER_RESTORE_OFFSETOF_WARNING \ ) \ /** @@ -608,14 +626,13 @@ */ #define DECLARE_VMINT_READONLY(basePtr, T_struct, T_member) ( \ /* Disable offsetof warning, trust us, we are cautios. */ \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") \ + COMPILER_DISABLE_OFFSETOF_WARNING \ (VMRelPtr) { \ (void**) &basePtr, \ offsetof(T_struct, T_member), \ true \ } \ - _Pragma("GCC diagnostic pop") \ + COMPILER_RESTORE_OFFSETOF_WARNING \ ) \ /** @brief Built-in VM 8 bit integer array variable. @@ -740,6 +757,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 @@ -823,6 +850,17 @@ * @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; }; /** @brief Script callback for a certain event.