Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 25
List-Directed Formatting
!------------------------------------------------------------
! Main procedure performs initialization.
!------------------------------------------------------------
PROC CALENDAR MAIN;
BEGIN
STRING .TERM^NAME[0:MAXFLEN - 1];
INT TERMLEN;
! Read the Startup message:
CALL INITIALIZER;
! Open the home terminal:
ERROR := PROCESS_GETINFO_(!process^handle!,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
TERM^NAME:MAXFLEN,
TERMLEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
ERROR := FILE_OPEN_(TERM^NAME:TERMLEN,TERM^NUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! Call the DISPLAY^MONTH procedure:
CALL DISPLAY^MONTH;
END;
List-Directed Formatting
List-directed formatting provides the data-conversion capabilities of the formatter
without needing a specified format. The FORMATDATA[X] procedure determines the
details of the data conversion based on the data types specified in the data descriptors.
List-directed formatting can be applied to input or output as follows:
Applied to input, the rules for list-directed formatting permit free-format input of
data values rather than require fixed fields as you would need for format-directed
formatting. The FORMATDATA[X] procedure converts the input data according to
the data types specified in the data descriptor list and stores the converted values
as indicated by the data descriptor.
Applied to output, list-directed formatting has fewer advantages because without a
specified format, the output is not necessarily in a conveniently readable form.