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

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

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

revision 3034 by schoenebeck, Mon Oct 31 00:05:00 2016 UTC revision 3207 by schoenebeck, Thu May 25 10:53:45 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014-2016 Christian Schoenebeck   * Copyright (c) 2014-2017 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 157  namespace LinuxSampler { Line 157  namespace LinuxSampler {
157           * expressions to an array expression for you, instead this method will           * expressions to an array expression for you, instead this method will
158           * simply return NULL!           * simply return NULL!
159           *           *
160             * @b Note: this method is currently, and in contrast to its other
161             * counter parts, declared as virtual method. Some deriving classes are
162             * currently using this to override this default implementation in order
163             * to implement an "evaluate now as integer array" behavior. This has
164             * efficiency reasons, however this also currently makes this part of
165             * the API less clean and should thus be addressed in future with
166             * appropriate changes to the API.
167             *
168           * @see exprType()           * @see exprType()
169           */           */
170          VMIntArrayExpr* asIntArray() const;          virtual VMIntArrayExpr* asIntArray() const;
171    
172          /**          /**
173           * Returns true in case this expression can be considered to be a           * Returns true in case this expression can be considered to be a
# Line 539  namespace LinuxSampler { Line 547  namespace LinuxSampler {
547          }          }
548      };      };
549    
550        #if HAVE_CXX_EMBEDDED_PRAGMA_DIAGNOSTICS
551        # define COMPILER_DISABLE_OFFSETOF_WARNING                    \
552            _Pragma("GCC diagnostic push")                            \
553            _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
554        # define COMPILER_RESTORE_OFFSETOF_WARNING \
555            _Pragma("GCC diagnostic pop")
556        #else
557        # define COMPILER_DISABLE_OFFSETOF_WARNING
558        # define COMPILER_RESTORE_OFFSETOF_WARNING
559        #endif
560    
561      /**      /**
562       * Convenience macro for initializing VMIntRelPtr and VMInt8RelPtr       * Convenience macro for initializing VMIntRelPtr and VMInt8RelPtr
563       * structures. Usage example:       * structures. Usage example:
# Line 583  namespace LinuxSampler { Line 602  namespace LinuxSampler {
602       */       */
603      #define DECLARE_VMINT(basePtr, T_struct, T_member) (          \      #define DECLARE_VMINT(basePtr, T_struct, T_member) (          \
604          /* Disable offsetof warning, trust us, we are cautios. */ \          /* Disable offsetof warning, trust us, we are cautios. */ \
605          _Pragma("GCC diagnostic push")                            \          COMPILER_DISABLE_OFFSETOF_WARNING                         \
         _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")  \  
606          (VMRelPtr) {                                              \          (VMRelPtr) {                                              \
607              (void**) &basePtr,                                    \              (void**) &basePtr,                                    \
608              offsetof(T_struct, T_member),                         \              offsetof(T_struct, T_member),                         \
609              false                                                 \              false                                                 \
610          }                                                         \          }                                                         \
611          _Pragma("GCC diagnostic pop")                             \          COMPILER_RESTORE_OFFSETOF_WARNING                         \
612      )                                                             \      )                                                             \
613    
614      /**      /**
# Line 608  namespace LinuxSampler { Line 626  namespace LinuxSampler {
626       */       */
627      #define DECLARE_VMINT_READONLY(basePtr, T_struct, T_member) ( \      #define DECLARE_VMINT_READONLY(basePtr, T_struct, T_member) ( \
628          /* Disable offsetof warning, trust us, we are cautios. */ \          /* Disable offsetof warning, trust us, we are cautios. */ \
629          _Pragma("GCC diagnostic push")                            \          COMPILER_DISABLE_OFFSETOF_WARNING                         \
         _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")  \  
630          (VMRelPtr) {                                              \          (VMRelPtr) {                                              \
631              (void**) &basePtr,                                    \              (void**) &basePtr,                                    \
632              offsetof(T_struct, T_member),                         \              offsetof(T_struct, T_member),                         \
633              true                                                  \              true                                                  \
634          }                                                         \          }                                                         \
635          _Pragma("GCC diagnostic pop")                             \          COMPILER_RESTORE_OFFSETOF_WARNING                         \
636      )                                                             \      )                                                             \
637    
638      /** @brief Built-in VM 8 bit integer array variable.      /** @brief Built-in VM 8 bit integer array variable.
# Line 740  namespace LinuxSampler { Line 757  namespace LinuxSampler {
757      public:      public:
758      };      };
759    
760        /** @brief Dynamically executed variable (of integer array data type).
761         *
762         * This is the base class for all built-in integer array script variables
763         * whose variable content needs to be provided dynamically by executable
764         * native code on each script variable access.
765         */
766        class VMDynIntArrayVar : virtual public VMDynVar, virtual public VMIntArrayExpr {
767        public:
768        };
769    
770      /** @brief Provider for built-in script functions and variables.      /** @brief Provider for built-in script functions and variables.
771       *       *
772       * Abstract base class defining the high-level interface for all classes       * Abstract base class defining the high-level interface for all classes
# Line 823  namespace LinuxSampler { Line 850  namespace LinuxSampler {
850           * @see ScriptVM::exec()           * @see ScriptVM::exec()
851           */           */
852          virtual int suspensionTimeMicroseconds() const = 0;          virtual int suspensionTimeMicroseconds() const = 0;
853    
854            /**
855             * Causes all polyphonic variables to be reset to zero values. A
856             * polyphonic variable is expected to be zero when entering a new event
857             * handler instance. As an exception the values of polyphonic variables
858             * shall only be preserved from an note event handler instance to its
859             * correspending specific release handler instance. So in the latter
860             * case the script author may pass custom data from the note handler to
861             * the release handler, but only for the same specific note!
862             */
863            virtual void resetPolyphonicData() = 0;
864      };      };
865    
866      /** @brief Script callback for a certain event.      /** @brief Script callback for a certain event.

Legend:
Removed from v.3034  
changed lines
  Added in v.3207

  ViewVC Help
Powered by ViewVC