Guardian Programmer's Guide

Table Of Contents
Communicating With Processes
Guardian Programmer’s Guide 421922-014
6 - 49
Programming the Requester
!------------------------------------------------------------
! This procedure does the initialization for the program.
! It calls INITIALIZER to dispose of the startup messages.
! It opens the home terminal and the data file used by the
! program.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .SERVER^NAME[0:MAXFLEN - 1]; !name of server
! process
INT SERVERLEN; !length of server
! name
STRING .TERMNAME[0:MAXFLEN - 1]; !terminal file
INT TERMLEN; !length of terminal-
! file name
INT ERROR;
! Read and discard startup messages.
CALL INITIALIZER;
! Open the terminal file. For simplicity we use the home
! terminal; the recommended approach is to use the IN file
! from the Startup message; see Section 8 for details:
CALL PROCESS_GETINFO_(!process^handle!,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
TERMNAME:MAXFLEN,
TERMLEN);
ERROR := FILE_OPEN_(TERMNAME:TERMLEN,TERMNUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Open the server process:
SERVER^NAME ':=' "$SER1" -> @S^PTR;
SERVERLEN := @S^PTR '-' @SERVER^NAME;
ERROR := FILE_OPEN_(SERVER^NAME:SERVERLEN,
SERVER^NUM,
!access!,
!exclusion!,
!nowait^depth!,
1);
IF ERROR <> 0 THEN
CALL FILE^ERRORS^NAME(SERVER^NAME:
@S^PTR '-' @SERVER^NAME,
ERROR);
END;