HELP VEDBLOCKREPEATER A.Sloman Dec 1989
vedblockrepeater(<vector of strings>) -> <procedure>
Given a vector of strings all of the same length, such as might be
produced by * VEDCUTBLOCK, this returns a procedure that is a character
repeater for those strings.
An example of its use might be a procedure to add up all the numbers in
a given text block, assuming that ved_stb copies the text block
indicated by the top two stacked positions and saves it in
vvedblockdump.
lib vedblocks; ;;; make ved_stb available
define ved_addblock;
;;; Add up the numbers in the block between two stacked positions and
;;; print total to right of the current position of the cursor
lvars num, total = 0, procedure items;
;;; Copy block of text between stacked positions
ved_stb();
incharitem(vedblockrepeater(vvedblockdump)) -> items;
repeat
items() -> num;
quitif(num == termin);
if isnumber(num) then num + total -> total endif;
endrepeat;
dlocal cucharout = vedcharinsert; ;;; printing goes in VED buffer
pr(' = ');
pr(total)
enddefine;
After this the has been compiled the command
<ENTER> addblock
will add up all the numbers between two stacked positions, and will
print on the current VED cursor line "=" and the number.
See also
HELP * VEDBLOCKS
HELP * VEDCUTBLOCK
--- C.all/help/vedblockrepeater
--- Copyright University of Sussex 1991. All rights reserved. ----------Author: A.Sloman Dec 1989