Home » Support » Release Notes » 6.5 » SPL Enhancements


"A jewel, a fully responsive package that meets the needs of the Test & Evaluation world."

- Mike Alamo, Ordnance Evaluation

DADiSP 6.5 B05 Release Notes

SPL Enhancements


Static Variables


Static variables are persistent from one call of a function to another. Static variables can be local to a particular function or local to all functions within particular SPL file. A static variable behaves like a local variable in that variable is only accessible to the function that declares the static variable or if file based, to the functions declared within the same file.

For example:


  sumval(x)
  {
      static sum = 0;

      sum += x;

      return(sum);

  }

The function sumval returns the sum of the current input value and all previous values. The static variable sum behaves like a local variable except it is persistent from one call to sumval to another.

Static variables can be file based such that all functions within the same SPL file have access to the variable.


  // sumval.spl

  static sum = 0;

  sumval(x)
  {
      sum += x;
      return(sum);
  }

  currsum()
  {
      return(sum);
  }

In this case, sumval behaves identically to the previous example and currsum returns the current sum.

File Based Global Variables


Global variables can be specified on a file basis.


  // myfun1.spl

  extern a = 10;
  extern b = 20;

  myfun1()
  {
      return(b);

  }

  myfun2(x)
  {
      a = x;
      b = a * a;
  }

  c1 = myfun1();

  c1 == 20;

  myfun2(5);

  a == 5;
  b == 25;

  c2 = myfun1();

  c2 == 25;

Variables a and b are global variables accessible to both functions myfun1 and myfun2. File based external variables are initialized when the SPL function is first loaded, whether automatically loaded or explicitly loaded.

Custom Dialog Forms


The @form and @endform keywords enable custom dialog box templates to directly embed related SPL code in the same file. For example, the following dialog generates a random series with user defined length and delta X values:


  // test.pan - form based dialog
  @panel
  @form

  // default initial length and deltax if not defined
  {defvar("_form_dlen", 1000)}
  {defvar("_form_dx",   0.01)}

  Test Menu

  // get integer value, "%" sets value immediately
  Length: <% w{25}>~_form_dlen = <{_form_dlen}>~input(2)

  // get real value, "%" sets value immediately
  DeltaX: <% w{25}>~_form_dx   = <{_form_dx}>  ~input(1)
  <L>

  // generate data when OK pressed
  ~form_gendata(_form_dlen, _form_dx)

  @endform

  // SPL code

  form_gendata(len, dx)
  {
      // format and set the current window formula
      eval(sprintf("W0 := gnorm(%d, %g)", len, dx));
  }

The above form creates the following custom dialog box:

Custom Form Dialog

When the OK button is pressed, the embedded form_gendata() function executes and produces a formula in the current window based on the input values.


    gnorm(1000, 0.001)


Any SPL code can be embedded in the form after the @endform statement.

New @@ Concatenate Operator


a = b @@ c is more compact and equivalent to a = concat(b, c)

New @= Append Operator


a @= b is equivalent to append(a, b). The @= operator appends the series b to the end of series a in place. a @= b is much faster than a = a @@ b for large series because @= operates on the existing series whereas @@ creates and assigns a new series.

Compatible Operators


The .* scalar multiply ./ scalar divide and .' real transpose operators are supported for convienence with legacy M file code.



 SPL Debugger | Shapes and Text