Weevil-Defined Macro Functions

The following macros are defined in Weevil for users to ease their experiment configuration. Besides, users could also define their own macros to help with experiment configuration.
WVL_SYS_Range(name, int lowerbound, int upperbound)
  Function
  A name list, the resulting list is $1$2, $1($2+1), ...$1$3
  Example
  WVL_SYS_Range(`br', 1, 5)
  => br1,br2,br3,br4,br5

WVL_SYS_Echo(name)
  Function
  Display the value of the argument
  Sometimes, when a marco expansion is within another macro expansion, it won't be expanded automatically. To solve the problem, we define this macro to ask the inner macro to expand first.
  Example
  Assumed that "WVL_Component_ID = S0"
  WVL_SYS_Host(`H0', `skylark.cs.colorado.edu', `ywang', `', `/bin/sh', `/scratch/yanyan/testroot', `FreeBSD')
  WVL_SYS_Component(`S0', `SienaServer')
  WVL_SYS_Actor(`D1', `D1', `DrProgram1', `S0')
  `WVL_Component_'WVL_SYS_Echo(`WVL_Component_'WVL_Component_ID`_Parent')`_type'
  => skylark.cs.colorado.edu

WVL_SYS_Head(name [, name])
  Function
  Returns the "head" of its argument list
  Example
  WVL_SYS_Head(`S0', `S1', `S2')
  => S0

WVL_SYS_Tail(name [, name])
  Function
  Returns the "rest" of its argument list
  Example
  WVL_SYS_Tail(`S0', `S1', `S2')
  => S1,S2

WVL_SYS_Add(name, expansion)
  Function
  Defines or redefines $1 to be its previous contents with $2 appended
  Example
  define(`Group1', `S1,S2')
  define(`Group2', `S3,S4')
  WVL_SYS_Add(`Group2', Group1)
  Group2
  => S3,S4,S1,S2

WVL_SYS_Contains(name, expansion [, expansion])
  Function
  Checks if $1 is contained by the list represented by the rest of the arguments
  Example
  define(`Group1', `S1,S2')
  define(`Group2', `S3,S4')
  WVL_SYS_Contains(`S3', Group1)
  => false
  WVL_SYS_Contains(`S3', Group1, Group2)
  => true

WVL_SYS_Insert(expansion, name)
  Function
  Adds $2 to $1 if it doesn't already exist there
  Example
  define(`Group1', `S1,S2')
  WVL_SYS_Insert(`Group1', `S1')
  Group1
  => S1,S2
  WVL_SYS_Insert(`Group1', `S3')
  Group1
  => S1,S2,S3

WVL_SYS_Callforeach(function, name [, name])
  Function
  Applies $1 to $2 and then processes the rest one by one, $1 can only accept one argument
  Example
  define(`serverdef', `WVL_SYS_Component($1, `SienaServer')')
  WVL_SYS_Callforeach(`serverdef', S0, S1, S2)
  => WVL_SYS_Component(`S0', `SienaServer')dnl
  WVL_SYS_Component(`S1', `SienaServer')dnl
  WVL_SYS_Component(`S2', `SienaServer')dnl

WVL_SYS_Foreach(name, function, list)
  Function
  Iterates over $3 defining $1 to the current value in $3 and executing $2
  Example
  WVL_SYS_Foreach(`i', `WVL_SYS_Component(i, `SienaServer')', `S0, S1, S2')
  => WVL_SYS_Component(`S0', `SienaServer')dnl
  WVL_SYS_Component(`S1', `SienaServer')dnl
  WVL_SYS_Component(`S2', `SienaServer')dnl

WVL_SYS_Fortwo(name, name, function, list)
  Function
  Iterates over $4 defining $1 to the current value and $2 to the next value and executing $3
  Example
  WVL_SYS_Fortwo( `i', `j', ``i' is set to i, `j' is set to j', `a', `b', `123', `this,is')
  => i is set to a, j is set to b
   i is set to 123, j is set to this,is

WVL_SYS_Fortwovar(name, name, function, `list', `list')
  Function
  Iterates over $4 and $5 defining $1 and $2 to the current value of $4 and $5 and executing $3
  Example
  WVL_SYS_Fortwo( `i', `j', ``i' is set to i, `j' is set to j', `a, b, c', `1, 2, 3')
  => i is set to a, j is set to 1
   i is set to b, j is set to 2
   i is set to c, j is set to 3

WVL_SYS_First(list)
  Function
  return the first item in $1
  Example
  WVL_SYS_First( `1, 2, 3')
  => 1

WVL_SYS_Subst_Commas(string, name [, name])
  Function
  Iterates over arguments replacing commas with $1
  Example
  WVL_SYS_Subst_Commas(`;', S0, S1, S2)
  => S0;S1;S2;

WVL_SYS_Strip_Commas(name [, name])
  Function
  Iterates over arguments expanding without commas
  equals to WVL_SYS_Subst_Commas(` ', name [, name])
  Example
  WVL_SYS_Strip_Commas(S0, S1, S2)
  => S0 S1 S2