| Message File Format |

A message file consists of a first line which only contains a number - the number of messages in the file. This is followed by as many messages. Messages may be separated by blank lines or comment lines as desired.

A comment line is any line which does not contain a colon ":".

A message is defined by the following syntax.

  message = blank text, ":", [ { text | format descriptor } ] ;

  blank text="any text not containing a colon" ;

  text = ordinary text | escaped text ;

  ordinary text="any sequence of characters not containing an escape character" ;

  escaped text = escape character, special character ;

  escape character="%" ;

  special character = escape character | "n" | "t" | "<" | end of line mark ;

## General Format Syntax

The syntax of a format descriptor is defined as follows :-

  format descriptor="<", [ selector ], [ options ], pad expression, [ selector ], ">" ;

  selector = whole number, ":" ;

  pad expression = ([ sign ] padding, [ decimal padding ]) | anchor padding ;

  anchor padding = [ filling ], padding ;

  filling="F", any character ;

  sign = "+" | "−" ;

  padding = hash characters, [ justify, hash characters ] ;

  decimal padding=".", hash characters ;

  justify="^" ;

  hash characters = hash character, { hash character } ;

  hash character="#" ;

  options = not defined in the library specification ;

## Selectors

A selector (which is a number followed by a colon) should be numbered from 1 upwards, appearing in any order in the message string format descriptors. The provision of this facility indicates by number which of the arguments to the formatting routines is to be used for which format descriptor. An example of the use of selectors is given in the first example below.

## Restrictions

The following general restrictions on the use of format descriptors are as follows :-

- Exponents are possible and considered as an option 'e' to floating point numbers.
- Options can be used by user defined classes to feature special print formats. User defined options should always start with a lower case letter.
- Only numbers can have precisions.
- Fill characters are not allowed with numbers.
- Precision and anchors cannot be used together.

## Examples

In the examples below spaces in the output string are indicated by a low line for clarity only.

With message "<2:&rt; + <1:> %> <3:###>" and arguments 1, 2, 0 the resultant string is "2_+_1_>___0".

With message "<+###.##>" and argument 3.14159 the resultant string is "__+3.14".

With message "<##.##e##>" and argument 3.14159 the resultant string is "_3.14e00".

With message "<^#####>" and argument "left" the resultant string is "left__".

With message "<F*###^###>" and argument "False" the resultant string is "*False*#42;".

## NOTES

1. Hash characters indicate padding only if the value field when represented contains fewer characters than that indicated by the number of hash/anchor, etc chars.
2. Any numeric (or other) value rounding due to precision limitations is defined by the class which is being represented, not by the formatting classes.
3. The presence of a filling specification does not occupy any character positions in the formatted string representation.

| Specification Index |  | Resources Index

Comments or enquiries should be made to Keith Hopper . Page last modified: Tuesday, 16 May 2000. |