/[svn]/linuxsampler/trunk/src/scriptvm/tree.cpp
ViewVC logotype

Log of /linuxsampler/trunk/src/scriptvm/tree.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:

Revision 3714 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 11 20:19:11 2020 UTC (4 years, 2 months ago) by schoenebeck
File length: 57931 byte(s)
Diff to previous 3707 , to selected 2935
NKSP: Fixed crash with built-in functions returning an array.

* Calling built-in functions returning an array type was broken and
  caused a crash when built-in function's NULL (supposed to be array)
  result value was used by the script VM.

* Bumped version (2.1.1.svn37).


Revision 3707 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 8 21:21:58 2020 UTC (4 years, 2 months ago) by schoenebeck
File length: 56874 byte(s)
Diff to previous 3595 , to selected 2935
Fixed compiler warnings about format specifiers:

Use portable format specifiers like PRId64 from inttypes.h
instead of assuming a particular word size.


Revision 3595 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 3 11:06:33 2019 UTC (4 years, 6 months ago) by schoenebeck
File length: 56698 byte(s)
Diff to previous 3590 , to selected 2935
* Fixed compiler errors with GCC 8.x.
* Bumped version (2.1.1.svn16).


Revision 3590 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 2 09:03:31 2019 UTC (4 years, 6 months ago) by schoenebeck
File length: 56686 byte(s)
Diff to previous 3585 , to selected 2935
NKSP: Implemented common real number math functions.

* Added built-in real number functions "round()", "ceil()", "floor()",
  "sqrt()", "log()", "log2()", "log10()", "exp()", "pow()", "sin()",
  "cos()", "tan()", "asin()", "acos()", "atan()".

* Added built-in script real number constant "~NI_MATH_PI".

* Added built-in script real number constant "~NI_MATH_E".

* Added NKSP test cases for built-in functions "round()", "ceil()",
  "floor()", "sqrt()", "log()", "log2()", "log10()", "exp()", "pow()",
  "sin()", "cos()", "tan()", "asin()", "acos()", "atan()".

* Bumped version (2.1.1.svn14).


Revision 3585 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 30 17:51:24 2019 UTC (4 years, 6 months ago) by schoenebeck
File length: 56337 byte(s)
Diff to previous 3582 , to selected 2935
NKSP: Cleanup regarding multiple data types for built-in function args.

* NKSP VM API cleanup: Get rid of legacy method
  VMFunction::argType(vmint iArg) which was already superseded by its new
  replacement VMFunction::acceptsArgType(vmint iArg, ExprType_t type).

* NKSP parser: if wrong argument type was passed to a built-in function and
  that built-in function accepts more than one data type for the argument,
  then show all supported data types as parser error message.

* Bumped version (2.1.1.svn10).


Revision 3582 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 30 12:23:40 2019 UTC (4 years, 6 months ago) by schoenebeck
File length: 55233 byte(s)
Diff to previous 3581 , to selected 2935
NKSP VM refactoring: Renamed all methods, functions and
classes matching pattern '*ScalarNumber*' to simply '*Number*':

- Renamed classes VMScalarNumberExpr -> VMNumberExpr,
  ScalarNumberExpr -> NumberExpr, ScalarNumberVariable ->
  NumberVariable, ScalarNumberBinaryOp -> NumberBinaryOp,
  VMScalarNumberResultFunction -> VMNumberResultFunction.

- Renamed method VMExpr::asScalarNumberExpr() -> VMExpr::asNumber().

- Renamed function isScalarNumber() -> isNumber().


Revision 3581 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 30 11:40:25 2019 UTC (4 years, 6 months ago) by schoenebeck
File length: 55453 byte(s)
Diff to previous 3577 , to selected 2935
NKSP: Allow more wider support of standard measuring units & 'final'ness.

* Raised compiler requirement to be C++14 compliant (due to severe
  restrictions regarding C-style aggregate initializer lists in C++11
  which are now massively used throughout the code base).

* NKSP VM API: Allow units and 'final'ness to be returned as result from
  built-in functions (added methods VMFunction::returnUnitType() and
  VMFunction::returnsFinal() for that purpose which must be implemented by
  built-in function implementations).

* NKSP language: Allow metric unit prefixes of numeric scalar and array
  variables to be changed freely at runtime (unlike unit types like Hz etc.
  which are still sticky parse-time features of variables which cannot be
  changed at runtime for the intentional sake of determinism).

* NKSP language: 'final' values are prohibited for array variables for now
  (attempt causes a parsers error).

* NKSP language: expressions with unit types (e.g. Hz) are prohibited for
  conditions of runtime control structures like if(), while(), select()
  (attempt causes a parser error).

* NKSP VM API: Allow built-in functions to perform their own, individual
  parse time checks of arguments going to be passed to the function at
  runtime (added method VMFunction::checkArgs() for that purpose).

* NKSP language: raise parser warning if only one operand of binary
  operators (like logical 'or' comparison) contain a 'final' value (because
  it would always yield in a 'final' result in such cases).

* NKSP language: Allow comparison (=, #, <, >, <=, >=) of values with
  different metric unit prefixes, which will behave as expected (e.g.
  result of expression '1000us < 2ms' is true).

* NKSP language: Allow adding values with different metric unit prefixes
  (e.g. result of expression '100Hz + 5kHz' is '5100Hz').

* NKSP language: Allow subtracting values with different metric unit
  prefixes (e.g. result of expression '1ms - 20us' is '980us').

* NKSP language: Allow multiplying with any metric unit prefixes
  (e.g. result of expression '2k * 3ms' is '6s'), however multiplications
  with unit types on both sides (e.g. '2s * 2s') is still prohibited since
  we don't have any considerable practical use for a term like '4s^2'
  (hence any attempt multiplying two unit types still causes parser error).

* NKSP language: Allow dividing by any metric unit prefixes and allow
  division of same unit type on both sides (e.g. expression '8kHz / 1000Hz'
  yields in unit free result '8'). So this is now a way to cast units away
  e.g. for passing the result to other expressions, certain function calls
  or variables which are not accepting any units (or that specific unit).

* NKSP language: integer arrays and real number arrays can now be converted
  to strings (e.g. for dumping their content with message() calls for
  script debugging purposes).

* NKSP language: expressions and variables with units are now correctly
  casted to strings (e.g. with message() calls).

* NKSP language: comparing real numbers for equalness (e.g. '~foo = 3.1') or
  unequalness (e.g. '~foo # 3.1') is now less strict and takes the expected
  floating point tolerances into account.

* NKSP VM API: Added methods VMScalarNumberExpr::evalCastInt() and
  VMScalarNumberExpr::evalCastReal().

* NKSP VM API: Added base class 'VMNumberArrayExpr' for classes
  'VMIntArrayExpr' and 'VMRealArrayExpr'.

* NKSP VM API: replaced all unitPrefix() (parse time) methods by
  unitFactor() (runtime) methods.

* Built-in function "exit()" supports now returning units and 'final'ness
  exclusively for test cases.

* The following built-in functions support now units as well: "abs()",
  "random()", "inc()", "dec()", "in_range()", "min()", "max()",
  "real_to_int()", "int()", "int_to_real()" and "real()".

* Built-in functions "array_equal()", "search()" and "sort()" support now
  real number arrays (correctly) as well.

* Added individual parse time checks of arguments to be passed to built-in
  functions "random()", "inc()", "dec()", "in_range()", "min()", "max()",
  "array_equal()" and "search()" specific for their individual purposes.

* Test cases: Added massive amount of NKSP test cases for standard
  measuring units and 'final' operator usage cases.

* Test cases: Added NKSP test cases for (floating point tolerance aware)
  real number equalness / unequalness comparison.

* Bumped version (2.1.1.svn8).


Revision 3577 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 28 15:23:23 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 41334 byte(s)
Diff to previous 3576 , to selected 2935
NKSP: Introducing variable return type for built-in functions.

* Changed method signature VMFunction::returnType() ->
  VMFunction::returnType(VMFnArgs* args) to allow built-in
  functions to proclaim a different result value type depending
  on the arguments to be passed to the function.

* Built-in script function abs() optionally accepts and returns
  real number.

* Built-in script functions min() and max() optionally accept
  real number arguments and return real number as result in that
  case.

* Added real number test cases for the built-in abs(), min() and
  max() functions.

* Bumped version (2.1.1.svn7).


Revision 3576 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 28 12:56:38 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 41239 byte(s)
Diff to previous 3573 , to selected 2935
NKSP: Fixed negate operator which did not work with real numbers.


Revision 3573 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 27 21:36:53 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 41172 byte(s)
Diff to previous 3561 , to selected 2935
NKSP: Introducing floating point support.

* NKSP language: Added support for NKSP real number literals and
  arithmetic operations on them (e.g. "(3.9 + 2.9) / 12.3 - 42.0").

* NKSP language: Added support for NKSP real number (floating point)
  script variables (declare ~foo := 3.4).

* NKSP language: Added support for NKSP real number (floating point)
  array script variables (declare ?foo[3] := ( 1.1, 2.7, 49.0 )).

* NKSP built-in script function "message()" accepts now real number
  argument as well.

* Added built-in NKSP script function "real_to_int()" and its short
  hand form "int()" for casting from real number to integer in NKSP
  scripts.

* Added built-in NKSP script function "int_to_real()" and its short
  hand form "real()" for casting from integer to real number in NKSP
  scripts.

* Bumped version (2.1.1.svn6).


Revision 3561 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 23 11:44:00 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 32914 byte(s)
Diff to previous 3557 , to selected 2935
NKSP: Added standard units support for numbers and final "!" operator:

* NKSP strictness: Variable names, function names and preprocessor condition
  names must start with a regular character (a-z or A-Z); starting them with
  a digit or underscore is no longer allowed.

* NKSP parser fix: equal comparison operator "=" and not equal comparison
  operator "#" must only accept integer operands.

* NKSP language: Implemented support for standard units like Hertz, seconds,
  Bel including support for metric unit prefixes; so one can now e.g.
  conveniently use numbers in scripts like "5us" meaning "5 microseconds",
  or e.g. "12kHz" meaning "12 kilo Hertz", or e.g. "-14mdB" meaning
  "minus 14 Millidecibel", or e.g. "28c" meaning "28 cents" (for tuning).

* NKSP language: Introduced "final" operator "!" which is specifically
  intended for synthesis parameter values to denote that the synthesis
  parameter value is intended to be the "final" value for that synthesis
  parameter that should explicitly be used by the engine and thus causing
  the sampler engine to ignore all other modulation sources for the same
  synthesis parameter (like e.g. LFO, EG); by simply prefixing a value,
  variable or formula with this new "!" operator the expression is marked as
  being "final".

* Bumped version (2.1.1.svn4).


Revision 3557 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 18 00:06:04 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 29917 byte(s)
Diff to previous 3551 , to selected 2935
* NKSP: Introducing 64 bit support for NKSP integer scripts
  variables (declare $foo).
* Require C++11 compiler support.
* Autoconf: Added m4/ax_cxx_compile_stdcxx.m4 macro which is used
  for checking in configure for C++11 support (as mandatory
  requirement) and automatically adds compiler argument if required
  (e.g. -std=C++11).
* Bumped version (2.1.1.svn3).


Revision 3551 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 1 10:22:56 2019 UTC (4 years, 7 months ago) by schoenebeck
File length: 29790 byte(s)
Diff to previous 3311 , to selected 2935
* Added test cases for NKSP core language aspects and core built-in
  functions.
* NKSP: Added method ScriptVM::setExitResultEnabled() which allows
  to explicitly enable the built-in exit() function to optionally
  accept one function argument; the value of the passed exit()
  function argument will then become available by calling
  VMExecContext::exitResult() after script execution.
* Bumped version (2.1.1.svn2).


Revision 3311 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 15 16:24:59 2017 UTC (6 years, 8 months ago) by schoenebeck
File length: 29611 byte(s)
Diff to previous 3293 , to selected 2935
* NKSP: Added built-in preprocessor condition NKSP_NO_MESSAGE,
  which can be set to disable all subsequent built-in "message()"
  function calls on preprocessor level.
* Bumped version (2.0.0.svn71).


Revision 3293 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 27 22:19:19 2017 UTC (6 years, 9 months ago) by schoenebeck
File length: 29641 byte(s)
Diff to previous 3285 , to selected 2935
* NKSP: Added built-in script function "fork()".
* NKSP: Added built-in array variable %NKSP_CALLBACK_CHILD_ID[].
* NKSP: Added built-in variable $NKSP_CALLBACK_PARENT_ID.
* NKSP: Fixed potential crash when accessing dynamic built-in
  array variables.
* Bumped version (2.0.0.svn65).


Revision 3285 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 22 10:45:38 2017 UTC (6 years, 9 months ago) by schoenebeck
File length: 29250 byte(s)
Diff to previous 3260 , to selected 2935
* NKSP: Print a time stamp along to each call of built-in function
  "message()".
* ScriptVM API: Added VMParserContext::preprocessorComments() which
  allows to retrieve all code blocks filtered out by the
  preprocessor.
* Bumped version (2.0.0.svn63).


Revision 3260 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 31 21:07:44 2017 UTC (6 years, 9 months ago) by schoenebeck
File length: 28833 byte(s)
Diff to previous 3257 , to selected 2935
* NKSP language: Added support for "synchronized .. end synchronized"
  code blocks.
* Bumped version (2.0.0.svn60).


Revision 3257 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 30 17:20:02 2017 UTC (6 years, 10 months ago) by schoenebeck
File length: 28545 byte(s)
Diff to previous 3056 , to selected 2935
* NKSP language: Added support for user declared const array variables.
* NKSP language: Raise parser warning if array variable is accessed with
  an index that exceeds the array's size.
* Bumped version (2.0.0.svn58).


Revision 3056 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 16 12:57:59 2016 UTC (7 years, 3 months ago) by schoenebeck
File length: 28529 byte(s)
Diff to previous 3034 , to selected 2935
* RT Instrument Scripts: Fixed crash when using built-in script function
  "by_marks()".
* LSCP Server: Fixed client connection not being closed after network error.
* Fixed some more few compiler warnings.
* Bumped version (2.0.0.svn33).


Revision 3034 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 31 00:05:00 2016 UTC (7 years, 4 months ago) by schoenebeck
File length: 28034 byte(s)
Diff to previous 2951 , to selected 2935
* Fixed a bunch of minor issues (mostly compiler warnings).
* Bumped version (2.0.0.svn31).


Revision 2951 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 15 20:07:47 2016 UTC (7 years, 8 months ago) by schoenebeck
File length: 28026 byte(s)
Diff to previous 2948 , to selected 2935
* NKSP language: Added support for user defined script functions.
* Bumped version (2.0.0.svn18).


Revision 2948 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 15 15:29:04 2016 UTC (7 years, 8 months ago) by schoenebeck
File length: 27836 byte(s)
Diff to previous 2945 , to selected 2935
* NKSP: Implemented built-in script function "stop_wait()".
* NKSP: Implemented built-in script variable "$NI_CALLBACK_ID".
* NKSP: Implemented built-in script variable "$NI_CALLBACK_TYPE".
* NKSP: Implemented built-in script variable "$NKSP_IGNORE_WAIT".
* NKSP: Added support for read-only built-in variables
  (respectively handled by the script parser).
* NKSP: Added built-in script constant "$NI_CB_TYPE_INIT".
* NKSP: Added built-in script constant "$NI_CB_TYPE_NOTE".
* NKSP: Added built-in script constant "$NI_CB_TYPE_RELEASE".
* NKSP: Added built-in script constant "$NI_CB_TYPE_CONTROLLER".
* Bumped version (2.0.0.svn17).


Revision 2945 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 14 00:22:26 2016 UTC (7 years, 8 months ago) by schoenebeck
File length: 27349 byte(s)
Diff to previous 2942 , to selected 2935
* NKSP: Implemented built-in script function "inc()".
* NKSP: Implemented built-in script function "dec()".
* NKSP language fix: division expressions were evaluated too often.
* NKSP language fix: string concatenation operator was right
  associative instead of left (to right).
* Bumped version (2.0.0.svn15).


Revision 2942 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 13 15:51:06 2016 UTC (7 years, 8 months ago) by schoenebeck
File length: 27161 byte(s)
Diff to previous 2935
* NKSP: Implemented built-in script variable "$KSP_TIMER".
* NKSP: Implemented built-in script variable "$NKSP_REAL_TIMER".
* NKSP: Implemented built-in script variable "$NKSP_PERF_TIMER".
* NKSP: Implemented built-in script variable "$ENGINE_UPTIME".
* Bumped version (2.0.0.svn14).


Revision 2935 - (view) (download) (annotate) - [selected]
Modified Sun Jul 10 14:24:13 2016 UTC (7 years, 8 months ago) by schoenebeck
File length: 25973 byte(s)
Diff to previous 2889
* NKSP: Added & implemented built-in script function "change_cutoff()".
* NKSP: Added & implemented built-in script function "change_reso()".
* NKSP: Added & implemented built-in script function "event_status()".
* NKSP: Added built-in script constants "$EVENT_STATUS_INACTIVE" and
  "$EVENT_STATUS_NOTE_QUEUE" both for being used as flags for
  built-in "event_status()" script function.
* NKSP language: Added support for bitwise operators ".or.", ".and."
  and ".not.".
* NKSP language scanner: Fixed IDs matching to require at least one
  character (i.e. when matching function names or variable names).
* NKSP language scanner: disabled unusued rules.
* Bumped version (2.0.0.svn12).


Revision 2889 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 25 17:28:23 2016 UTC (7 years, 11 months ago) by schoenebeck
File length: 24994 byte(s)
Diff to previous 2888 , to selected 2935
* Added new C++ API class "ScriptVMFactory".
* Instrument Scripts: extended parser issues to provide not only first
  line and first column, but also last line and last column of issue
  (thus marking the precise span of the issue within the source code).
* Bumped version (2.0.0.svn7).


Revision 2888 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 24 18:16:10 2016 UTC (7 years, 11 months ago) by schoenebeck
File length: 24758 byte(s)
Diff to previous 2645 , to selected 2935
* Instrument Scripts: Fixed line numbers on parser error/warning messages.
* Instrument Scripts: Added output of precise column on parser
  error/warning messages.
* Shut up some irrelevant errors of parser generating shell scripts.
* Bumped version (2.0.0.svn6).


Revision 2645 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 18 00:14:57 2014 UTC (9 years, 9 months ago) by schoenebeck
File length: 24688 byte(s)
Diff to previous 2611 , to selected 2935
* RT instrument scripts: Pass/preserve polyphonic variable data
  from respective "note" event handler to "release" event handler.
* Fixed theoretical memory leak regarding instrument scripts.
* Bumped version (1.0.0.svn54).


Revision 2611 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 9 19:20:37 2014 UTC (9 years, 9 months ago) by schoenebeck
File length: 23632 byte(s)
Diff to previous 2594 , to selected 2935
* Fixed crash when loading an instrument script.
* Fixed "init" script handler only to be executed once:
  when the script was loaded.
* Fixed aftertouch script event which always had value zero
  and controller number was set to aftertouch value instead.
* gig Engine: Fixed handling of "smartmidi" dimension, which
  was recognized as "unknown" dimension.
* Fixed script function gig_set_dim_zone(): was accessing
  wrong event.
* ls_instr_script command line tool: is now not limited to
  core language scripts, but can now also parse sampler format
  dependent instrument scripts, with the respective specific
  built-in script variables and functions.
* ScriptVM: Fixed runtime behavior of "and" and "or" binary
  script expressions, which also evaluated the right hand side
  of the expression even if the left hand side already failed
  the overall expression semantic to become true.
* Bumped version (1.0.0.svn46).


Revision 2594 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 5 00:16:25 2014 UTC (9 years, 9 months ago) by schoenebeck
File length: 23580 byte(s)
Diff to previous 2588 , to selected 2935
* ScriptVM (WIP): started to integrate real-time instrument script
  support into the sampler engine implementations. The code is
  shared among all sampler engines, however currently only the gig
  file format supports storing instrument scripts (as LinuxSampler
  extension to the original GigaStudio 4 file format).
* gig engine: Added support for loading instrument scripts from .gig
  files.
* ScriptVM (WIP): Implemented built-in script variables %CC, $CC_NUM,
  $EVENT_NOTE, $EVENT_VELOCITY, $VCC_MONO_AT, $VCC_PITCH_BEND.
* ScriptVM (WIP): Implemented execution of script event handler "init".
* ScriptVM (WIP): Implemented execution of script event handler
  "controller".
* Bumped version (1.0.0.svn42).


Revision 2588 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 1 14:44:38 2014 UTC (9 years, 9 months ago) by schoenebeck
File length: 21448 byte(s)
Diff to previous 2581 , to selected 2935
* ScriptVM: refactoring and fixes.


Revision 2581 - (view) (download) (annotate) - [select for diffs]
Added Fri May 30 12:48:05 2014 UTC (9 years, 10 months ago) by schoenebeck
File length: 20224 byte(s)
Diff to selected 2935
* (WIP) Implemented parser and VM for upcoming new real-time instrument
  script support. It needs yet to be integrated into the sampler's
  sampler engines. You can toy around for now with the command line tool
  "ls_instr_script" and i.e. examples showing the core language features
  under src/scriptvm/examples/.
* Bumped version (1.0.0.svn41).


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC