/[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 3035 by schoenebeck, Mon Oct 31 12:00:00 2016 UTC revision 3292 by schoenebeck, Sat Jun 24 13:43:09 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 9  Line 9 
9    
10  // This header defines data types shared between the VM core implementation  // This header defines data types shared between the VM core implementation
11  // (inside the current source directory) and other parts of the sampler  // (inside the current source directory) and other parts of the sampler
12  // (located at other source directories).  // (located at other source directories). It also acts as public API of the
13    // Real-Time script engine for other applications.
14    
15  #ifndef LS_INSTR_SCRIPT_PARSER_COMMON_H  #ifndef LS_INSTR_SCRIPT_PARSER_COMMON_H
16  #define LS_INSTR_SCRIPT_PARSER_COMMON_H  #define LS_INSTR_SCRIPT_PARSER_COMMON_H
# Line 157  namespace LinuxSampler { Line 158  namespace LinuxSampler {
158           * expressions to an array expression for you, instead this method will           * expressions to an array expression for you, instead this method will
159           * simply return NULL!           * simply return NULL!
160           *           *
161             * @b Note: this method is currently, and in contrast to its other
162             * counter parts, declared as virtual method. Some deriving classes are
163             * currently using this to override this default implementation in order
164             * to implement an "evaluate now as integer array" behavior. This has
165             * efficiency reasons, however this also currently makes this part of
166             * the API less clean and should thus be addressed in future with
167             * appropriate changes to the API.
168             *
169           * @see exprType()           * @see exprType()
170           */           */
171          VMIntArrayExpr* asIntArray() const;          virtual VMIntArrayExpr* asIntArray() const;
172    
173          /**          /**
174           * 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 636  namespace LinuxSampler { Line 645  namespace LinuxSampler {
645      struct VMInt8Array {      struct VMInt8Array {
646          int8_t* data;          int8_t* data;
647          int size;          int size;
648            bool readonly; ///< Whether the array data may be modified or just be read.
649    
650          VMInt8Array() : data(NULL), size(0) {}          VMInt8Array() : data(NULL), size(0), readonly(false) {}
651      };      };
652    
653      /** @brief Virtual machine script variable.      /** @brief Virtual machine script variable.
# Line 749  namespace LinuxSampler { Line 759  namespace LinuxSampler {
759      public:      public:
760      };      };
761    
762        /** @brief Dynamically executed variable (of integer array data type).
763         *
764         * This is the base class for all built-in integer array script variables
765         * whose variable content needs to be provided dynamically by executable
766         * native code on each script variable access.
767         */
768        class VMDynIntArrayVar : virtual public VMDynVar, virtual public VMIntArrayExpr {
769        public:
770        };
771    
772      /** @brief Provider for built-in script functions and variables.      /** @brief Provider for built-in script functions and variables.
773       *       *
774       * Abstract base class defining the high-level interface for all classes       * Abstract base class defining the high-level interface for all classes
# Line 832  namespace LinuxSampler { Line 852  namespace LinuxSampler {
852           * @see ScriptVM::exec()           * @see ScriptVM::exec()
853           */           */
854          virtual int suspensionTimeMicroseconds() const = 0;          virtual int suspensionTimeMicroseconds() const = 0;
855    
856            /**
857             * Causes all polyphonic variables to be reset to zero values. A
858             * polyphonic variable is expected to be zero when entering a new event
859             * handler instance. As an exception the values of polyphonic variables
860             * shall only be preserved from an note event handler instance to its
861             * correspending specific release handler instance. So in the latter
862             * case the script author may pass custom data from the note handler to
863             * the release handler, but only for the same specific note!
864             */
865            virtual void resetPolyphonicData() = 0;
866    
867            /**
868             * Returns amount of virtual machine instructions which have been
869             * performed the last time when this execution context was executing a
870             * script. So in case you need the overall amount of instructions
871             * instead, then you need to add them by yourself after each
872             * ScriptVM::exec() call.
873             */
874            virtual size_t instructionsPerformed() const = 0;
875    
876            /**
877             * Sends a signal to this script execution instance to abort its script
878             * execution as soon as possible. This method is called i.e. when one
879             * script execution instance intends to stop another script execution
880             * instance.
881             */
882            virtual void signalAbort() = 0;
883      };      };
884    
885      /** @brief Script callback for a certain event.      /** @brief Script callback for a certain event.
# Line 863  namespace LinuxSampler { Line 911  namespace LinuxSampler {
911      };      };
912    
913      /**      /**
914         * Reflects the precise position and span of a specific code block within
915         * a script. This is currently only used for the locations of commented
916         * code blocks due to preprocessor statements, and for parser errors and
917         * parser warnings.
918         *
919         * @see ParserIssue for code locations of parser errors and parser warnings
920         *
921         * @see VMParserContext::preprocessorComments() for locations of code which
922         *      have been filtered out by preprocessor statements
923         */
924        struct CodeBlock {
925            int firstLine; ///< The first line number of this code block within the script (indexed with 1 being the very first line).
926            int lastLine; ///< The last line number of this code block within the script.
927            int firstColumn; ///< The first column of this code block within the script (indexed with 1 being the very first column).
928            int lastColumn; ///< The last column of this code block within the script.
929        };
930    
931        /**
932       * Encapsulates a noteworty parser issue. This encompasses the type of the       * Encapsulates a noteworty parser issue. This encompasses the type of the
933       * issue (either a parser error or parser warning), a human readable       * issue (either a parser error or parser warning), a human readable
934       * explanation text of the error or warning and the location of the       * explanation text of the error or warning and the location of the
# Line 870  namespace LinuxSampler { Line 936  namespace LinuxSampler {
936       *       *
937       * @see VMSourceToken for processing syntax highlighting instead.       * @see VMSourceToken for processing syntax highlighting instead.
938       */       */
939      struct ParserIssue {      struct ParserIssue : CodeBlock {
940          String txt; ///< Human readable explanation text of the parser issue.          String txt; ///< Human readable explanation text of the parser issue.
         int firstLine; ///< The first line number within the script where this issue was encountered (indexed with 1 being the very first line).  
         int lastLine; ///< The last line number within the script where this issue was encountered.  
         int firstColumn; ///< The first column within the script where this issue was encountered (indexed with 1 being the very first column).  
         int lastColumn; ///< The last column within the script where this issue was encountered.  
941          ParserIssueType_t type; ///< Whether this issue is either a parser error or just a parser warning.          ParserIssueType_t type; ///< Whether this issue is either a parser error or just a parser warning.
942    
943          /**          /**
# Line 955  namespace LinuxSampler { Line 1017  namespace LinuxSampler {
1017          virtual std::vector<ParserIssue> warnings() const = 0;          virtual std::vector<ParserIssue> warnings() const = 0;
1018    
1019          /**          /**
1020             * Returns all code blocks of the script which were filtered out by the
1021             * preprocessor.
1022             */
1023            virtual std::vector<CodeBlock> preprocessorComments() const = 0;
1024    
1025            /**
1026           * Returns the translated virtual machine representation of an event           * Returns the translated virtual machine representation of an event
1027           * handler block (i.e. "on note ... end on" code block) within the           * handler block (i.e. "on note ... end on" code block) within the
1028           * parsed script. This translated representation of the event handler           * parsed script. This translated representation of the event handler

Legend:
Removed from v.3035  
changed lines
  Added in v.3292

  ViewVC Help
Powered by ViewVC