EMS Manual
Example of Retrieving Event Messages
EMS Manual—426909-005
A-10
TAL Source File
etxt^stat :=
EMSTEXT(event^buf,
EVT^TEXT^BUF,
evt^text^len, ! Displayable line length
num^evt^lines, ! Number of display lines
actual^len, ! Line lens stored here
, ! Reserved
, ! Indent default
1); ! Console compatible
! Check for EMSTEXT calling errors
IF $HIGH (etxt^stat) = 0 and $INT (etxt^stat) <> 0
THEN CALL DEBUG;
! Display the text
FOR i := 0 TO num^evt^lines-1 DO
BEGIN
IF (actual^len[i] <> -1) THEN
BEGIN
retry1:
CALL WRITE (term,
evt^text^buf[i*evt^text^len/2],
actual^len[i]);
IF <> THEN
BEGIN
IF FILEERROR(term) THEN
GOTO retry1;
CALL DEBUG;
END;
END;
END;
END;
?PAGE
PROC getevent^loop;
BEGIN
INT .EXT event^buf(zems^ddl^msg^buffer^def);
INT(32) tkn;
INT ivalue;
! This procedure consists of a loop to retrieve event
! messages. Each time through the loop, the procedure
! gets an event message and calls displ^event to display
! it at your terminal.
! Initialize spi^buf for GETEVENT command message
spi^err := SSINIT(spi^buf, ZEMS^VAL^BUFLEN,
zems^val^ssid, ZSPI^VAL^CMDHDR,
ZEMS^CMD^GETEVENT);
IF spi^err <> ZSPI^ERR^OK THEN
CALL DEBUG;
! Save the original command message
sav^buf ':=' spi^buf FOR $LEN(sav^buf) BYTES;
! Begin loop that gets and displays event messages