Processing math: 100%

CHR_PFORM

Reformat a paragraph to a new width

Description:

This subroutine is called repeatedly to reformat the given paragraph to a new width (given by the declared length of the returned character variable). The output may be optionally justified to the right margin (i.e. the end of the returned character variable). This routine should be called repeatedly to generate successive returned lines from the given paragraph array. Initially, the context argument IPOSN should be set to zero; it will be updated after each call, ready to generate the next output line. A value of zero is returned for IPOSN when there are no more lines to return. Any unprintable characters (e.g. tabs) are treated as if they were spaces for the purpose of generating line-breaks.

Invocation

CALL CHR_PFORM( MXPAR, PARRAY, JUSTFY, IPOSN, STRING )

Arguments

MXPAR = INTEGER (Given)
The maximum length of the given paragraph array, PARRAY.
PARRAY( MXPAR ) = CHARACTER ( ) (Given)
The character array which contains the paragraph text to be reformatted, one line per array element. Leading blanks are ignored. A line-break is interpreted as the start of a new word.
JUSTFY = LOGICAL (Given)
The right justification flag: if this is given as .TRUE., the text is returned right justified; otherwise the text is returned with a ragged right margin.
IPOSN = INTEGER (Given and Returned)
On entry, this argument specifies the character position in PARRAY from which to start generating the next returned line. It is given as the number of characters from the start of the first character in the first element in PARRAY. If a value less than 1 is used, then 1 will be used.

On exit, this argument is set to one more than the character offset of the start of PARRAY of the last non-blank character which appears in the returned line STRING (i.e. the position at which the generation of the next output line should start). If STRING is blank because there are no more characters to process, then IPOSN is returned set to zero.

STRING = CHARACTER ( ) (Returned)
The returned line of text in the paragraph, left justified. The length of this argument defines the maximum length of the returned paragraph line.