Guardian Programmer's Guide

Table Of Contents
Writing a Requester Program
Guardian Programmer’s Guide 421922-014
21 - 46
Coding the Requester Program
!------------------------------------------------------------
! Procedure handles creating and opening servers. If the
! server already exists it calls OPEN^SERVER to open it. If
! it does not exist, it creates the server and sends it the
! standard process initialization sequence.
!------------------------------------------------------------
PROC CREATE^AND^OPEN^SERVER(SERVER^NUM,SERVER^OBJECT^NAME,
OBJFILE^NAMELEN,PROCESS^NAME,
PROCESS^NAMELEN);
INT .SERVER^NUM; !file number of server process
STRING .SERVER^OBJECT^NAME; !name of server object file
INT OBJFILE^NAMELEN;
STRING .PROCESS^NAME; !name of server process
INT PROCESS^NAMELEN;
BEGIN
INT ERROR;
INT ERROR^DETAIL;
! Check whether process already running. If so, open it.
! If not, create it and open it:
ERROR := PROCESS_GETPAIRINFO_(
!process^handle!,
PROCESS^NAME:PROCESS^NAMELEN);
! If the process exists, open the server:
CASE ERROR OF
BEGIN
0, 4 -> BEGIN
! The process already exists; open it:
CALL OPEN^SERVER(PROCESS^NAME,PROCESS^NAMELEN,
SERVER^NUM)
END;
9 -> BEGIN
! The process does not exist; create it and open it,
! send it a Startup message, close it, and then reopen
! it: