M[UMPS] Commands

W[RITE]

Introduced in the 1977 ANSI M[UMPS] language standard.

WRITE # ; Start at a new page
WRITE "This appears at the top of the page."
WRITE !!!!!
WRITE "Now we are 5 lines further down."
WRITE ?10,"And this line is indented (10 positions)."

The most common usages of the WRITE command.

WRITE 3+4,A_B,!
WRITE !,$JUSTIFY(X,9)

Expressions are allowed in arguments of the WRITE command.

Note: The exclamation mark may appear anywhere in a sequence of arguments of the WRITE command. Choose one standard for your application (always at the beginning, or always the end) and stick to that. Which one you choose is not important; being consistent is.

WRITE *65
Although most implementations will interprete this command as WRITE $CHAR(65), the effect of this command is implementation-specific and device specific. In general, this syntax is not considered to be portable.

Addition in the 1995 ANSI M[UMPS] language standard.

USE DEVICE::"X3.64" WRITE /CUP(5,10)
Position the cursor at location (5,10) and update $X and $Y accordingly ($X=5, $Y=10).

USE DEVICE::"X3.64" WRITE /SGR(0),"Reset"
USE DEVICE::"X3.64" WRITE /SGR(1),"Bold"
USE DEVICE::"X3.64" WRITE /SGR(2),"Faint"
USE DEVICE::"X3.64" WRITE /SGR(3),"Italic"
USE DEVICE::"X3.64" WRITE /SGR(4),"Underscore"
USE DEVICE::"X3.64" WRITE /SGR(5),"Slow blink"
USE DEVICE::"X3.64" WRITE /SGR(6),"Rapid blink"
USE DEVICE::"X3.64" WRITE /SGR(7),"Reverse video"

Turn on the various graphic renditions. Of course, not all devices can realize all attributes (it would be a neat trick to implement blinking on a laserprinter...), but these are the rendition codes that are defined in ANSI X3.64.

Sample function to erase a display:
OPEN TTY USE TTY::"X3.64"
USE $PRINCIPAL WRITE !,"Cursor to left upper corner."
USE TTY WRITE /CUP(1,1)
USE $PRINCIPAL WRITE !,"Erase screen."
USE TTY WRITE /ED

Create a display with questions in bold-face and answers in reverse video:
WRITE /CUP(1,1) WRITE /ED
FOR I=1:1:QUESTIONS DO
. WRITE /CUP(YQ(I),XQ(I))
. WRITE /SGR(1),QUESTION(I)
. WRITE /CUP(YA(I),XA(I))
. WRITE /SGR(7),ANSWER(I)
. QUIT

The most common functions in ANSI X3.64 are itemized in X3.64 description.

Approved for addition in a future ANSI M[UMPS] language standard.

The ability to specify an "output time-out" is added. An output time-out is specified as a device parameter in an OPEN or USE command. Examples are shown with the USE command.

The addition of a binding to TCP/IP socket devices includes a number of new controlmnemonics.

USE DEVICE::"SOCKET" WRITE /LISTEN
Switch to the mnemonicspace that handles TCP/IP connections (sockets), and establish the implementation-default queue depth for listening to incoming requests.

WRITE /LISTEN(depth)
Switch to the mnemonicspace that handles TCP/IP connections (sockets), and use the specified value for the queue depth for listening to incoming requests.

WRITE /WAIT
Wait for an event to occur on any socket associated with the current device. When an event occurs, the value of special variable $KEY will indicate the nature of the event.

WRITE /WAIT(duration)
Wait for an event to occur on any socket associated with the current device, or until the time-out specified in the parameter elapses (whichever occurs first). When an event occurs, the value of special variable $KEY will indicate the nature of the event.

Whether or not a duration is specified, the value of $KEY will contain the substring "CONNECT" when a connection request is received by a "listening" server, and the value of $KEY will contain the substring "READ" when a message is received through a connectionless protocol.

More examples are shown with the USE command.

Approved for addition in a future ANSI M[UMPS] Language standard.

User-definable I/O handling has been added. When user-definable I/O handling is active:

Examples with naked references:

WRITE VALUE
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
WRITE ^(3,4)

; Naked indicator is now: ^ABC(1,3,
; Actual reference is: ^ABC(1,3,4)

Addition in the 1994 ANSI M[UMPS] GKS Binding.

STAR(DEVICE,DISPLAY) ;
 NEW BLUE,YELLOW,GREEN,A,B,C,WK1
 ;
 ; This routine draws a yellow star on a blue
 ; background and writes the title 'STAR' in
 ; green under the star.
 ;
 ; GKS level: ma
 ; The implementation must support at least one
 ; workstation of category output or outin.
 ;
 OPEN DEVICE,DISPLAY ; Implementation dependent
 USE DEVICE::"GKS"
 SET WK1="Workstation one"
 ; OPEN virtual GKS display
 WRITE /GOPGS(DISPLAY,32)
 WRITE /GOPWK(WK1,64,1)
 WRITE /ACWK(WK1)
 ; Center the window and the origin
 WRITE /GSWN(1,"(-1.25,1.25,-1.25,1.25)")
 WRITE /GSELNT(1)
 ; Define the colours to be used
 SET BLUE="0,0,1"
 SET YELLOW="1,1,0"
 SET GREEN="0,1,0"
 WRITE /GSCR(WK1,0,BLUE)
 WRITE /GSCR(WK1,1,YELLOW)
 WRITE /GSCR(WK1,2,GREEN)
 ; Draw the star
 SET A="INDIVIDUAL",B="BUNDLED"
 WRITE /GSASF(B,B,B,B,B,B,B,B,B,B,A,B,A)
 WRITE /GSFAIS("SOLID"),/GSFACI(1)
 SET A=0.951057,B=0.309017,C=0.58775
 WRITE /GFA(+A,+B,-A,+B,+C,-A,0,1,-C,+A)
 ; Title of graph
 WRITE /GSCHH(0.15)
 WRITE /GSTXAL("CENTRE","HALF")
 WRITE /GSTXCI(2)
 WRITE /GTX((0,1.1),"STAR")
 ; Close the graph and the virtual display
 WRITE /GDAWK(WK1)
 WRITE /GCLWK(WK1)
 WRITE /GCLKS
 CLOSE DEVICE,DISLAY
 QUIT


This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.

This document describes the various commands that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).

The information in this document is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

In this document, information is included that will appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.