ViewPoint Manual
Sample Custom Status Server
ViewPoint Manual—426801-001
D-6
Custom Server Code
        "N",      ! reverse signify
        0,       ! scale
        0,       ! low threshold
        100,     ! high threshold
        "N", "N",    ! low/high threshold enabled
        "CV"     ! type (busy-timer or counter-value)
        );
END;
?PAGE "SERVER^SHUTDOWN"
PROC Server^Shutdown;
BEGIN
-------------------------------------------------------------------------------
--
-- This procedure is called right before the server stops.  A server
-- may do any relevant housecleaning here.
--
-------------------------------------------------------------------------------
 CALL CLOSE ( Rcv^Fnum );
END;
?PAGE "FIND^ITEM^PROCEDURE"
INT PROC Find^Item^Type ( Item^Name, Index );
INT .EXT Item^Name ( Zvpt^Item^Name^Def ); ! Input: Item to search.
INT .Index;        ! Output: Index of Item
BEGIN
-----------------------------------------------------------------------------
--
-- Procedure searches allocated status item types for one matching the
-- type passed as a parameter. If a match is found, the index of the
-- matching status item is set, and TRUE is returned.
--
-----------------------------------------------------------------------------
LITERAL Item^Type^Len = Len^Bsz ( Item^Name.Z^Item^Type );
STRING .Item^Type [ 0:Item^Type^Len - 1 ];
 Item^Type ':=' Item^Name.Z^Item^Type FOR Item^Type^Len BYTES;
 CALL SHIFTSTRING ( Item^Type, Item^Type^Len, 0 );
 USE i;
 FOR i := 1 TO Defined^Items DO
 BEGIN
  IF Item^Array[i].Z^Item^Name.Z^Item^Type = Item^Type FOR
                    Item^Type^Len BYTES THEN
  BEGIN
   Index := i;
   RETURN TRUE;
  END;
 END;
 DROP i;
 RETURN FALSE;
END; ! Find^item^type
?PAGE "CHECK^VALID^PROCESS^NAME"
INT  PROC Check^Valid^Process^Name ( Request, Reply );
INT .EXT Request ( Zvpt^Check^Item^Request^Def ); ! Input
INT .EXT Reply;              ! Output
BEGIN
------------------------------------------------------------------------
--
-- Procedure checks that the configured name for Processname is Valid.
-- First we check only for a valid process name
-- Later we could implement the process check for <CPU,PIN>
--
-- We do not require that the process is running.
-- The external form of the name should not be less than 2 characters ($a)
-- or greater than 14 (\remote7.$long).
-- The expanded internal form must have blank fill in subvol/name fields.
--
------------------------------------------------------------------------
INT   .Processname [ 0:Fname^Wsz - 1 ];   ! Internal form of name.
INT   .Temp^Fname [ 0:Fname^Wsz - 1 ];   ! Temp file name.
STRUCT .Item^Name ( Zvpt^Item^Name^Def );  ! Local structure.
INT   Length;             ! Length of external name.
 Return^Error := 0;
 Return^Error^Detail := 0;
 Item^Name ':=' Request.Z^Status^Item.Z^Item^Name
       FOR Len^Wsz ( Item^Name ) WORDS;
 CALL PROGRAMFILENAME ( Temp^Fname );










