/[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 2948 by schoenebeck, Fri Jul 15 15:29:04 2016 UTC revision 3034 by schoenebeck, Mon Oct 31 00:05:00 2016 UTC
# Line 168  namespace LinuxSampler { Line 168  namespace LinuxSampler {
168           * expression's constant value may be evaluated already at script           * expression's constant value may be evaluated already at script
169           * parse time, which may result in performance benefits during script           * parse time, which may result in performance benefits during script
170           * runtime.           * runtime.
171             *
172             * @b NOTE: A constant expression is per se always also non modifyable.
173             * But a non modifyable expression may not necessarily be a constant
174             * expression!
175             *
176             * @see isModifyable()
177           */           */
178          virtual bool isConstExpr() const = 0;          virtual bool isConstExpr() const = 0;
179    
180            /**
181             * Returns true in case this expression is allowed to be modified.
182             * If this method returns @c false then this expression must be handled
183             * as read-only expression, which means that assigning a new value to it
184             * is either not possible or not allowed.
185             *
186             * @b NOTE: A constant expression is per se always also non modifyable.
187             * But a non modifyable expression may not necessarily be a constant
188             * expression!
189             *
190             * @see isConstExpr()
191             */
192          bool isModifyable() const;          bool isModifyable() const;
193      };      };
194    
# Line 563  namespace LinuxSampler { Line 581  namespace LinuxSampler {
581       * complexity inside the sampler engines which provide the actual script       * complexity inside the sampler engines which provide the actual script
582       * functionalities.       * functionalities.
583       */       */
584      #define DECLARE_VMINT(basePtr, T_struct, T_member) ( \      #define DECLARE_VMINT(basePtr, T_struct, T_member) (          \
585          (VMRelPtr) {                                     \          /* Disable offsetof warning, trust us, we are cautios. */ \
586              (void**) &basePtr,                           \          _Pragma("GCC diagnostic push")                            \
587              offsetof(T_struct, T_member),                \          _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")  \
588              false                                        \          (VMRelPtr) {                                              \
589          }                                                \              (void**) &basePtr,                                    \
590      )                                                    \              offsetof(T_struct, T_member),                         \
591                false                                                 \
592            }                                                         \
593            _Pragma("GCC diagnostic pop")                             \
594        )                                                             \
595    
596      /**      /**
597       * Same as DECLARE_VMINT(), but this one defines the VMIntRelPtr and       * Same as DECLARE_VMINT(), but this one defines the VMIntRelPtr and
# Line 585  namespace LinuxSampler { Line 607  namespace LinuxSampler {
607       * @see ScriptVM::builtInConstIntVariables()       * @see ScriptVM::builtInConstIntVariables()
608       */       */
609      #define DECLARE_VMINT_READONLY(basePtr, T_struct, T_member) ( \      #define DECLARE_VMINT_READONLY(basePtr, T_struct, T_member) ( \
610          (VMRelPtr) {                                          \          /* Disable offsetof warning, trust us, we are cautios. */ \
611              (void**) &basePtr,                                \          _Pragma("GCC diagnostic push")                            \
612              offsetof(T_struct, T_member),                     \          _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")  \
613              true                                              \          (VMRelPtr) {                                              \
614          }                                                     \              (void**) &basePtr,                                    \
615      )                                                         \              offsetof(T_struct, T_member),                         \
616                true                                                  \
617            }                                                         \
618            _Pragma("GCC diagnostic pop")                             \
619        )                                                             \
620    
621      /** @brief Built-in VM 8 bit integer array variable.      /** @brief Built-in VM 8 bit integer array variable.
622       *       *
# Line 690  namespace LinuxSampler { Line 716  namespace LinuxSampler {
716           * @param expr - new value to be assigned to this variable           * @param expr - new value to be assigned to this variable
717           */           */
718          void assignExpr(VMExpr* expr) OVERRIDE {}          void assignExpr(VMExpr* expr) OVERRIDE {}
719    
720            virtual ~VMDynVar() {}
721      };      };
722    
723      /** @brief Dynamically executed variable (of integer data type).      /** @brief Dynamically executed variable (of integer data type).
# Line 830  namespace LinuxSampler { Line 858  namespace LinuxSampler {
858       * issue (either a parser error or parser warning), a human readable       * issue (either a parser error or parser warning), a human readable
859       * explanation text of the error or warning and the location of the       * explanation text of the error or warning and the location of the
860       * encountered parser issue within the script.       * encountered parser issue within the script.
861         *
862         * @see VMSourceToken for processing syntax highlighting instead.
863       */       */
864      struct ParserIssue {      struct ParserIssue {
865          String txt; ///< Human readable explanation text of the parser issue.          String txt; ///< Human readable explanation text of the parser issue.
# Line 948  namespace LinuxSampler { Line 978  namespace LinuxSampler {
978       * This class is not actually used by the sampler itself. It is rather       * This class is not actually used by the sampler itself. It is rather
979       * provided for external script editor applications. Primary purpose of       * provided for external script editor applications. Primary purpose of
980       * this class is syntax highlighting for external script editors.       * this class is syntax highlighting for external script editors.
981         *
982         * @see ParserIssue for processing compile errors and warnings instead.
983       */       */
984      class VMSourceToken {      class VMSourceToken {
985      public:      public:
# Line 960  namespace LinuxSampler { Line 992  namespace LinuxSampler {
992          String text() const;          String text() const;
993    
994          // position of token in script          // position of token in script
995          int firstLine() const; ///< First line this source token is located at in script source code (indexed with 0 being the very first line).          int firstLine() const; ///< First line this source token is located at in script source code (indexed with 0 being the very first line). Most source code tokens are not spanning over multiple lines, the only current exception are comments, in the latter case you need to process text() to get the last line and last column for the comment.
996          int firstColumn() const; ///< Last line this source token is located at in script source code.          int firstColumn() const; ///< First column on the first line this source token is located at in script source code (indexed with 0 being the very first column). To get the length of this token use text().length().
997    
998          // base types          // base types
999          bool isEOF() const;          bool isEOF() const; ///< Returns true in case this source token represents the end of the source code file.
1000          bool isNewLine() const;          bool isNewLine() const; ///< Returns true in case this source token represents a line feed character (i.e. "\n" on Unix systems).
1001          bool isKeyword() const;          bool isKeyword() const; ///< Returns true in case this source token represents a language keyword (i.e. "while", "function", "declare", "on", etc.).
1002          bool isVariableName() const;          bool isVariableName() const; ///< Returns true in case this source token represents a variable name (i.e. "$someIntVariable", "%someArrayVariable", "\@someStringVariable"). @see isIntegerVariable(), isStringVariable(), isArrayVariable() for the precise variable type.
1003          bool isIdentifier() const;          bool isIdentifier() const; ///< Returns true in case this source token represents an identifier, which currently always means a function name.
1004          bool isNumberLiteral() const;          bool isNumberLiteral() const; ///< Returns true in case this source token represents a number literal (i.e. 123).
1005          bool isStringLiteral() const;          bool isStringLiteral() const; ///< Returns true in case this source token represents a string literal (i.e. "Some text").
1006          bool isComment() const;          bool isComment() const; ///< Returns true in case this source token represents a source code comment.
1007          bool isPreprocessor() const;          bool isPreprocessor() const; ///< Returns true in case this source token represents a preprocessor statement.
1008          bool isOther() const;          bool isOther() const; ///< Returns true in case this source token represents anything else not covered by the token types mentioned above.
1009    
1010          // extended types          // extended types
1011          bool isIntegerVariable() const;          bool isIntegerVariable() const; ///< Returns true in case this source token represents an integer variable name (i.e. "$someIntVariable").
1012          bool isStringVariable() const;          bool isStringVariable() const; ///< Returns true in case this source token represents an string variable name (i.e. "\@someStringVariable").
1013          bool isArrayVariable() const;          bool isArrayVariable() const; ///< Returns true in case this source token represents an array variable name (i.e. "%someArryVariable").
1014          bool isEventHandlerName() const;          bool isEventHandlerName() const; ///< Returns true in case this source token represents an event handler name (i.e. "note", "release", "controller").
1015    
1016          VMSourceToken& operator=(const VMSourceToken& other);          VMSourceToken& operator=(const VMSourceToken& other);
1017    

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

  ViewVC Help
Powered by ViewVC