ViewPoint Manual

Sample Custom Status Server
ViewPoint Manual426801-001
D-4
Custom Server Code
?PAGE "STATUS COLLECTION SERVER GLOBAL VARIABLES AND DEFINITION"
-------------------------------------------------------------------------------
--
-- This section allocate global variables and initialize them.
--
-- The Defined^Items define will be initialized to the number of item
-- types supported by this server.
--
-- STATUS ITEMS implemented by this server are defined in the table
-- Item^Array who contains an element for each implemented item.
-- The default values for the fields of each status item are provided
-- in this array.
--
-- Finally we will load all GUARDIAN Procedures Declarations from the
-- C00 EXTDECS0 file.
--
-------------------------------------------------------------------------------
DEFINE Current^Version = "C00"#; ! Current version of this server
DEFINE Defined^Items = 6#; ! Number of Items supported by this server.
LITERAL Zvpt^Ipc^Len = 4000; ! Viewpoint Maximum Ipc Length
STRUCT .EXT Item^Array ( Zvpt^Status^Item^Def ) [ 1:Defined^Items ];
INT Rcv^Fnum; ! $RECEIVE file number
INT Num^Requesters := 0; ! Number of requesters opening us
INT Return^Error := 0; ! This is use for the implementation of
INT Return^Error^Detail := 0; ! error detection and reporting to the
! requester.
?NOLIST, SOURCE Extdecs0 ( ABEND, AWAITIO, CLOSE, CREATEPROCESSNAME,
? CONVERTTIMESTAMP, DEVICEINFO, KEYPOSITION, FILEINFO,
? FNAMEEXPAND, JULIANTIMESTAMP, MYPID, MYSYSTEMNUMBER, NEWPROCESS,
? NUMIN, OPEN, PROCESSACCESSID, PROCESSINFO, PROCESSORSTATUS,
? PROCESSORTYPE, PROCESSTIME,LOOKUPPROCESSNAME, PROGRAMFILENAME,
? READ, READUPDATE, REPLY, SETMODE, SHIFTSTRING , WRITE, WRITEREAD,
? COMPUTETIMESTAMP, STOP, DISKINFO, INITIALIZER )
?LIST
?PAGE "PROCEDURE SERVER^STARTUP"
PROC Server^Startup;
BEGIN
---------------------------------------------------------------------
--
-- This procedure is called before anything else happens.
-- It is responsible for processing any startup messages and prepare
-- the process for accepting messages on $RECEIVE.
-- Note the use of the INITIALIZER procedure who will take care of the
-- startup message protocol.
-- We will then open $RECEIVE for real work processing.
--
---------------------------------------------------------------------
INT Rcv^Fname[0:11] := ["$RECEIVE", 8 * [" "]];
INT Rcv^Error;
LITERAL Want^Sysmsgs = %040000; ! Means we want to see OPEN, CLOSE Msgs.
LITERAL Receive^Depth = %000001; ! Means we want to Reply to Readupdate
CALL INITIALIZER;
CALL OPEN ( Rcv^Fname, Rcv^fnum, Want^Sysmsgs, Receive^Depth );
IF <> THEN BEGIN
CALL FILEINFO ( Rcv^Fnum, Rcv^Error );
CALL ABEND;
END;
CALL SETMODE ( Rcv^Fnum, 36, 1 );
IF < THEN BEGIN
CALL FILEINFO ( Rcv^Fnum,Rcv^Error );
CALL ABEND;
END;
END; ! Server^Startup
?PAGE " SERVER^INITIALIZE"
PROC Server^Initialize;
BEGIN
-------------------------------------------------------------------------------
--
-- This procedure is called before the first IPC request is received.
-- This is where a server typically does most of its initialization.
-- Here, we will initialize the global structure Item^Array with the
-- following objects supported by this server.
-- The Item pointer is used to help initialize all fields of the
-- Item^Array extended structure.