BROWN%FORUM.VA.GOV@plus5.UUCP (04/24/87)
PROPOSAL FOR $WRITE FUNCTION
By: David B. Brown, COMP Consultants, MGlobal
Many times it is desirable to generate pre-formatted text into
MUMPS globals. Currently this must be done by concatenation of
various items or use of a non-standard "pipe" and write to one
device and read from the corresponding device.
The situation will become more accentuated if we proceed with the
device handling proposals.
The following proposal allows capture of output sequences for all
arguments of a WRITE command. These include format arguments
such as tab (?) and CRLF (!) as well as future items such as
/CUP:y:x to position the cursor.
Note that any limitations on the WRITE command (e.g. device
doesn't allow cursor positioning), would also be true of the
$WRITE function.
PROPOSAL:
add in section 1.2.7:
$WRITE returns a string
add in section 3.2.8:
$WRITE({U}L{u} {U}writeargument{u})
returns the processed results of the {U}writeargument{u}s. Each
{U}writeargument{u} is processed one at a time, in left-to-right
order. Each form of argument defines an output operation to the
accumulating result. The particular character output sequences
generated by each {U}writeargument{u} is the same as would be
output to the current I/O device as specified in section 3.6.18.
change the first paragraph of 3.5.4 to read:
3.5.4 {U}format{u} in READ and WRITE
The {U}format{u}, which can appear in READ and WRITE commands and
in the $WRITE function, specifies output format control. The
parameters of {U}format{u} are processed one at a time, in left-
to-right order.
EXAMPLES:
S ^XXX(I)=$WRITE(#!?20,"THIS IS A HEADING",!)
S ZZZ=$WRITE(/CUP:12:22,"Put this in the middle of the screen")