U - Repeat Until.

Syntax:

U commands
Un commands
UT commands
UF commands
UE commands
UnT commands
UnF commands
UnE commands

Examples:

u2 s1/"/'/
ue +1s/$/./ +1z
uf b(\c\n(x)) r file\c\n(x) n(x)+1

Options:

commands
is a list of FRED commands.
n
is a positive integer. U will repeat the list of commands n times.
UT
begins by setting the condition register FALSE. It then repeats the entire list of commands until the condition register is TRUE at the end of one of the repetitions of the list. If a number n is also specified (UnT), the list of commands is executed n times unless the TRUE condition is met first.
UF
begins by setting the condition register TRUE. It then repeats the entire list of commands until the condition register is FALSE at the end of one of the repetitions of the list. If a number n is also specified (UnF), the list of commands is executed n times unless the FALSE condition is met first.
UE
begins by setting the count register to zero. It then repeats the entire list of commands until an error occurs. Any error will stop the UE command, except for errors which can be detected by testing the condition register (e.g. "unable to access file" and "no text changed"). When an error finally occurs, FRED sets the count register to a negative number that indicates the type of error that stopped the loop. Possible values and their meanings are:
  0 -- internal error
 -1 -- context search failed
 -2 -- unknown command
 -3 -- syntax error in pattern
 -4 -- incorrectly constructed address
 -5 -- address wrap around
 -6 -- value out of range
 -7 -- buff/reg name invalid
 -9 -- command syntax error
-10 -- file error
-11 -- too many alternatives
-12 -- internal table overflow
-14 -- system command not allowed
-15 -- address/command conflict
-16 -- cannot grow workfile
-17 -- invalid parameter
-18 -- missing closing delimiter
-19 -- BREAK key was pushed

If a number n is specified (UnE), the list of commands is executed n times unless an error occurs first.

Description:

U repeats a list of commands until a given condition is satisfied. Due to editor limitations, a maximum of 262,143 (2**18 - 1) repetitions are permitted.

If you specify an address, "." will be set to that line before U begins repeating the commands. Otherwise, "." is unchanged at the beginning of execution.

U copies the commands into a hidden buffer, then executes the buffer repeatedly until the given condition is satisfied. The new-line character that ends the command line is copied into this hidden buffer along with everything else. Stream directives like \B and \N are expanded as the commands are copied. You must put \C in front of any new-lines inside the list of commands, since the first unescaped new-line character ends the list. This does not apply to new-line characters that are taken from a buffer using the \B construction; the terminating new-line must occur at the same input level as the U command it terminates.

U saves the name of the current buffer before starting execution and returns to that buffer upon leaving, even if it enters another buffer in the course of its operation. If the last command in a U list calculates an address, "." will be set to that value upon completion of the U loop.

U commands may be nested to any level.

Copyright © 1998, Thinkage Ltd.