SURVO MM Help System (web edition)

Nesting of sucros

When a sucro is running it can call another sucro (say SUCRO2)
as a subroutine either by activating it as a Survo command (/SUCRO2)
or without any visible signs by certain special codes.

If another sucro is activated by a Survo command, the tutstack is
lost and replaced by the parameters of the new sucro.
Also the reference point (set by REF key) is cancelled.

Example:
  11 *TUTSAVE S2    / This sucro is used as a subroutine.
  12 *{R}Sucro S2 working...
  13 *{W1=W1+W2}{end}
  14 *
  15 *TUTSAVE S1    / This sucro is the main program.
  16 / Tutstack will contain 11@22@ :
  17 *{init}{del stack}{W1=11}{W2=22}{R}Sucro S1 starts...{R}
  18 / After calling S2, tutstack will be 25@11@ :
  19 *{erase}/S2 25,{print W1}{act}
  20 / The altered contents of W1 is printed:
  21 *{R}{print W1}{end}
  22 *
  23 *If both sucros are saved, activation of /S1 gives:
  24 */S1
  25 *Sucro S1 starts...
  26 *Sucro S2 working...
  27 *36_

Another sucro (say SUCRO2) can be called as a subroutine also without
any visible traces in the edit field either by the sucro code

   {call SUCRO2}
or
   {calls SUCRO2}

In the first case, the tutstack and the reference point are preserved
but in the second case they are lost as in /SUCRO2{act}.

By the commands {save stack},{load stack},{save stack <file>},
{load stack <file>} one can restore the original contents of the
tutstack after the return from a subsucro.
A subsucro can call another subsucro and so on. Maximum number of
nested sucros is 5. However, when chaining sucros, there are no limits.

  C = More information on sucro calls 
  S = More information on sucros in general 


More information on Survo from www.survo.fi
Copyright © Survo Systems 2001-2012.
webmaster'at'survo.fi