Expand Management Programming Manual

EVENT MANAGEMENT
Additional TAL Source Modules
! Get name of line whose quality is so low it should be
! brought down
spi^err := EMSGETTKN ( event^buf, ZEMS^TKN^LDEVNAME
, ldev^name, 1);
IF (spi^err) THEN CALL DEBUG;
! Translate internal name
! to variable-length external string
line^name.len := FNAMECOLLAPSE ( ldev^name.z^localname
, line^name.objname );
! Bring the line down
CALL abort^line ( line^name );
! Get tokens for the event message
spi^err := EMSGETTKN ( event^buf, zexp^tkn^line^qual
, line^qual, 1 );
IF (spi^err) THEN CALL DEBUG;
spi^err := EMSGETTKN ( event^buf, zems^tkn^ldev
, ldev^num, 1, !cnt!, zems^val^ssid );
IF (spi^err) THEN CALL DEBUG;
! Write event message indicating the line was brought down
spi^err := EMSINIT ( exp^buf, zexp^val^buflen
, myap^val^ssid
, myap^evt^downed^low^line
, ZEMS^TKN^LDEVNAME, ldev^name);
! Build text message
text^buf ':=' "LINE " & line^name.objname for line^name.len
& " ABORTED: LINE QUAL = " -> @eot;
CALL NUMOUT ( eot, line^qual, 10, 2 );
! Add tokens to event message
spi^err := EMSADDTOKENS ( exp^buf, zems^val^ssid
, zems^tkn^text, text^buf
, @eot[2] '-' @text^buf
, zems^tkn^ldev, ldev^num );
IF (spi^err) THEN CALL DEBUG;
spi^err := EMSADDTOKENS ( exp^buf, zexp^val^ssid
, zexp^tkn^line^qual, line^qual );
IF (spi^err) THEN CALL DEBUG;
! Send the event message to the collector
evt^text^buf ':=' "$0" & 0;
CALL FNAMEEXPAND ( evt^text^buf, ldev^name.z^localname
, ldev^name.z^localname );
CALL OPEN ( ldev^name.z^localname, collector );
spi^err := EMSGETTKN ( exp^buf, zspi^tkn^usedlen
, event^len );
IF (spi^err) THEN CALL DEBUG;
8-97