&ldel, &lfind, &lget, &linsert, &lset - List manipulation functions
&ldel list index
&lfind list value
&lget list index
&linsert list index value
&lset list index value
The list manipulation functions perform operations on specially formatted strings called lists. A list is defined as:
"|value1|value2|.....|valueN|"
Where '|' is the dividing character, this is not fixed to a '|', but is defined by the first character of the string. Following are all valid lists.
"|1|2|3|4|5|"
"X1X2X3X4X5X"
"\CAHello\CAWorld\CA"
"??"
The functions may all be abbreviated to their three letter abbreviation (i.e. &linsert may be expressed as &lin). In all cases the first argument is completely evaluated before the second or third argument.
&ldel list index
&lfind list value
&lget list index
&linsert list index value
&lset list index value
The following example moves item 4 in a list to position 2:
set-variable #l0 &lget %list 4 set-variable #l1 &ldel %list 4 set-variable %list &lins #l1 2 #l0
The following example is taken from vm.emf, it firstly checks where the user has entered a vm command, if not then the key is execute as normal, otherwise the appropriate vm command is executed.
define-macro vm-input set-variable #l2 @cck set-variable #l3 @cc !if ¬ &set #l0 &lfi "|esc h|delete|space|return|A|a|C|c|....|z|" #l2 !if ¬ &seq #l3 "ERROR" execute-line &spr "!nma %s %s" &cond @? @# "" #l3 !return !endif ml-write &spr "[Key \"%s\" not bound - \"esc h\" to view help]" #l2 !abort !endif set-variable #l1 &lget "|%osd-vm-help osd|vm-del-windows|scroll-down|.... ....vm-goto-list|vm-Archive-box|vm-archive-box|.... vm-cut-all-data|0 vm-extract-data|...|vm-forward|" #l0 execute-line #l1 !emacro
(c) Copyright JASSPA 1999
Last Modified: 1998/07/04
Generated On: 1999/12/01