TEXTFILE

Purpose

An object for reading or writing ASCII textfiles

Synopsis

TEXTFILE is a line-oriented formatted sequential advancing file. It can handle input and output, including input from standard input, and output to standard output.

The TEXTFILE object is a FILE with a BUFFER and a REALFMT formatting object. The input/output proceeds via a line buffer. It is forbidden to open a TEXTFILE simultaneously for input and output.

There is a default internal standard input object, stdin, and a default standard output object, stdout. Usually these are connected to real files with those names, not the terminal.

A line count is maintained to allow back-tracking to previous lines, and particular items on each line. This is useful for input.

For output, items can be put in columns of a specified width, with double precision numbers having a specified precision and "style" (set using fortran conventions). This is useful for dynamic tables, which the user can change at run time. Rewind and backtracking are not allowed for output files.

It is possible to redirect the input or output to a new file using the "redirect" command. The previous file can be recovered using "revert", or it will revert back automatically to the previous file if the redirected file ends. It is also possibile to redirect input to an internal file. This is useful for processing a list of text as if it were a file. Output to an internal file is not allowed.

Note that the input buffer is limited to size BSTR_SIZE, set in the macros file.

The system information in the system variable tonto is updated whenever a I/O operation or a buffer operation is performed, so that TONTO knows where it is at and can tell you where it was up to in processing any file.

Important note

Keywords are normally inputted from stdin using the read routine and processed by the conventional routine process_input.

In the case of TEXTFILE, these keywords are processed by process(word,in). There is no input from stdin since this file defined the properties of stdin.

The keywords in this module only affect the way output is presented.

Default input data order

There is no associated TEXTFILEVEC module.

Listing of keywords

real_precision= INT

Equivalent to precision=

real_style= STR

Read a character indicating the style of output wanted for real numbers

  • The default is f

  • The style symbols are those used in the fortran language: f, g, e, etc.

real_width= INT

Equivalent to field_width=

fields= INT

Read a number indicating the number of fields across the page wanted when outputting a vector or matrix

  • The default is 5

field_width= INT

Read an integer indicating the width of a field required for real numbers

  • The default is 20

int_width= INT

Read an integer indicating the width of a field required for an integer, or string variable

  • The default is 9

labels= BIN

If set TRUE, integer labels are used on the columns or rows of vectords and matrices when they are outputted

  • The default is TRUE

margin= INT

Read an integer setting the number of blank characters used in the margin when outputting text

  • The default is 0

precision= INT

Read an integer telling the number of significant figures desired when outputting real number

  • The default is 9

style= STR

Equivalent to real_style=