ViewPoint Manual
Sample Custom Status Server
ViewPoint Manual—426801-001
D-11
Custom Server Code
 RETURN ( Z^All^Ok^Code );
END; ! Sample^Disk^Fragmentation
?PAGE "SCAN ITEM"
INT  PROC Scan^Item ( Request, Request^Len, Reply, Reply^Len );
INT .EXT Request ( Zvpt^Scan^Item^Request^Def ); ! Input
INT .EXT Request^Len;            ! Length of data in 'Request'
INT .EXT Reply ( Zvpt^Scan^Item^Reply^Def );  ! Output
INT .EXT Reply^Len;             ! Length of data in 'Reply'.
BEGIN
------------------------------------------------------------------------
--
-- Scan^Item procedure searches the defined items in this server for one
-- matching the requested item^type. If the requested item^type is blank
-- then the first defined type is returned.
-- The item index is included in the reply to allow "Scan^Next" to work.
-- Defined item indexes start at 1 and go to "defined^items".
--
------------------------------------------------------------------------
STRUCT .Blank^Name ( Zvpt^Item^Name^Def );
INT Item^Index;
INT Object^Index;
 Blankw ( Blank^Name );
 Return^Error := 0;
 IF Request.Z^Item^Name.Z^Item^Type = Blank^Name.Z^Item^Type FOR
            Len^Wsz ( Blank^Name.Z^Item^Type ) THEN
 Item^Index := 1
 ELSE
 BEGIN
  IF NOT Find^Item^Type ( Request.Z^Item^Name, Item^Index ) THEN
  RETURN ( Zerr^Stat^No^Such^Type );
 END;
 Reply.Z^Status^Item ':=' Item^Array [ Item^Index ] FOR
           Len^Bsz ( Reply.Z^Status^Item ) BYTES;
 Reply.Z^Item^Index := Item^Index;
 Reply^Len := Len^Bsz ( Zvpt^Scan^Item^Reply^Def );
 RETURN ( Z^All^Ok^Code );
END; ! Scan^Item.
?PAGE "SCAN NEXT ITEM"
INT PROC Scan^Next^Item ( Request, Request^Len, Reply, Reply^Len );
INT .EXT Request ( Zvpt^Next^Item^Request^Def ); ! Input
INT .EXT Request^Len;            ! Length of data in 'Request'
INT .EXT Reply  ( Zvpt^Next^Item^Reply^Def ); ! Output
INT .EXT Reply^Len;             ! Length of data in 'Reply'.
BEGIN
------------------------------------------------------------------------
--
-- Scan^Next^Item procedure is used after Scan^Next to retrieve the
-- next item in the list of defined items. The index value is incremented
-- and the status item to which the new index value corresponds is returned.
-- The new index value is returned with the status item (for subsequent
-- calls to "scan^next").
-- If the new (incremented) index exceeds defined^items then Item^Index
-- is set back to 1 and so we start back at the beginning of the list.
--
------------------------------------------------------------------------
INT Item^Index;
INT Object^Index;
 Return^Error := 0;
 Item^Index := Request.Z^Item^Index + 1;
 IF Item^Index > Defined^Items THEN Item^Index := 1;
 Reply.Z^Status^Item ':=' Item^Array [ Item^Index ] FOR
           Len^Bsz ( Reply.Z^Status^Item ) BYTES;
 Reply.Z^Item^Index := Item^Index;
 Reply^Len := Len^Bsz ( Zvpt^Next^Item^Reply^Def );
 RETURN ( Z^All^Ok^Code );
END; ! Scan^Next^Item.
?PAGE "CHECK ITEM"
INT PROC Check^Item ( Request, Request^Len, Reply, Reply^Len );
INT .EXT Request ( Zvpt^Check^Item^Request^Def ); ! Input
INT .EXT Request^Len;            ! Length of data in 'Request
INT .EXT Reply  ( Zvpt^Check^Item^Reply^Def ); ! Output
INT .EXT Reply^Len;             ! Length of data in 'Reply'.
BEGIN
-------------------------------------------------------------------------------










