Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide
Sample User-Written Code for SPIFFY Subsystem
Interface Process
D-24
109759—Distributed Systems Network Management (DSNM) Subsystem Interface
Development Guide
Sample I Process Program Code
INT SUBPROC state^ok (xstate,xcf);
INT xstate, xcf;
BEGIN
CASE xstate OF
BEGIN
ZDSN^STATE^GREEN -> RETURN _ON (xcf,c^greenstate);
ZDSN^STATE^YELLOW -> RETURN _ON (xcf,c^yellowstate);
ZDSN^STATE^RED -> RETURN _ON (xcf,c^redstate);
OTHERWISE -> RETURN _ON (xcf,c^anystate);
END;
END;
! Produce a normal (non-error) output object
_RC^TYPE SUBPROC normal^object (thing^arg);
INT .EXT thing^arg;
INT er;
BEGIN
INT .EXT thing (spiffy^thing^def) = thing^arg;
INT state;
state := dsnmstate (thing);
IF _OFF (inobj.cf, c^starobj) AND NOT state^ok (state, inobj.cf) THEN
RETURN _RC^NULL;
IF _ISNULL (@outobj := _PUT^LM (cx.current^out,,$LEN (outobj))) THEN
RETURN _RC^ABORT (ZDSN^ERR^MEMORY);
outobj.cf := inobj.cf;
outobj.thing ':=' thing for $LEN (outobj.thing) BYTES;
_TURNON (outobj.cf, c^things);
outobj.dsnmstate := state;
IF thing.name = inobj.FOBJ.Z^OBJNAME FOR spiffy^name^len BYTES THEN
BEGIN
! Same as command thing.
IF er := _FOBJECT^INIT (outobj.FOBJ, inobj.FOBJ) THEN
RETURN _RC^ABORT (er);
IF _OFF (inobj.cf, c^things) THEN
BEGIN
inobj.thing ':=' thing FOR $LEN (inobj.thing) BYTES;
inobj.dsnmstate := state;
_TURNON (inobj.cf, c^things);
END;
END
ELSE
BEGIN
! Subordinate of or derived from command thing
IF er := _FOBJECT^INIT (outobj.FOBJ,, inobj.FOBJ) THEN
RETURN _RC^ABORT (er);
outobj.FOBJ.Z^OBJNAME ':=' [ ZDSN^MAX^OBJNAME * [" "]];
outobj.FOBJ.Z^OBJNAME ':=' thing.name FOR spiffy^name^len BYTES;
CALL typename (outobj.FOBJ.Z^OBJTYPE,thing.type);
IF _ON (inobj.cf, c^starobj) THEN _TURNOFF (outobj.cf, c^starobj)
ELSE _TURNOFF (outobj.cf, c^fromcmd + c^subobj);
END;
RETURN _RC^NULL;
END;