Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 52
The Order-Query Server ($SER3)
!------------------------
!Other global variables:
!------------------------
STRING .S^PTR; !pointer to end of string
INT TERM^NUM; !file number for terminal
INT .BUFFER[0:BUFSIZE/2 - 1];!I/O buffer
STRING .SBUFFER := @BUFFER[0] '<<' 1; !string pointer to I/O
! buffer
INT REPLY^LEN; !length of reply string
INT REPLY^ERROR; !error value returned to
! requester
INT ORD^FNUM; !file number for orders
! file
INT RECV^NUM; !file number for $RECEIVE file
INT .RECEIVE^INFO[0:16]; !returned by
! FILE_GETRECEIVEINFO_
?NOLIST
?SOURCE
$SYSTEM.SYSTEM.EXTDECS0(INITIALIZER,FILE_OPEN_,FILE_GETINFO_,
? PROCESS_STOP_,FILE_GETRECEIVEINFO_,
? KEYPOSITION,DNUMOUT,WRITEX,
? OLDFILENAME_TO_FILENAME_,READUPDATEX,
? REPLYX)
?LIST
!------------------------------------------------------------
! Here are a few DEFINEs to make it a little easier to
! format and print messages.
!------------------------------------------------------------
! Initialize for a new line:
DEFINE START^LINE = @S^PTR := @SBUFFER #;
! Put a string into the line:
DEFINE PUT^STR(S) = S^PTR ':=' S -> @S^PTR #;
! Put an integer into the line:
DEFINE PUT^INT(N) =
@S^PTR := @S^PTR '+' DNUMOUT(S^PTR,$DBL(N),10) #;