Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 19
Using DEFINEs: An Example
!--------------------------------------------------------
! Here are some DEFINEs to make it 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) #;
! Print a line:
DEFINE PRINT^LINE =
CALL WRITE^LINE(SBUFFER,@S^PTR '-' @SBUFFER) #;
! Print a blank line:
DEFINE PRINT^BLANK =
CALL WRITE^LINE (SBUFFER, 0) #;
! Print a string:
DEFINE PRINT^STR (S) = BEGIN START^LINE;
PUT^STR (S);
PRINT^LINE; END #;