next up previous
Next: 7 Other Standards and Up: The SIF Reference Report Previous: 5.3 Two Further Examples


6 Free Form Input

So far, we have been quite specific in the format that we allow. In this section, we consider a second format which, though closely connected to the first, allows one to input problems in a less rigid fashion. Although we refer to this second format as free format, the freedom really lies in how the data can be laid out in an input file, not in any extra enhancements to the content of a file.

The input style discussed in Sections 3-5 is known as fixed format. Each SDIF/SEIF/SGIF file is assumed to be in fixed format unless otherwise specified. A fixed format file has data arranged in specified fields of given length and normally does not allow for much data on a single card. A free form file, on the other hand, is one where considerable data may be conveyed on a single line. The data does not have to lie in prespecified fields. However, we shall insist that any free form file can be translated to fixed format and interpreted correctly, in this format, in a single sequential pass through the file.

We allow a further pair of indicator cards in any SDIF/SEIF/SGIF file. These cards, like those described in Section 3.1, Section 4.2 and Section 5.1.2, contain a single keyword starting in column 1. The new keywords are given in Figure 6.1.

Figure 6.1: Additional indicator cards
\begin{figure}\begin{center}
\begin{tabular}{ll}
\multicolumn{1}{c}{Keyword} &...
...al \\
{\tt FIXED FORMAT} & optional \\
\end{tabular} \end{center} \end{figure}

Any data that lies between a FREE FORMAT card and the next FIXED FORMAT or ENDATA card is considered to be in free format. Likewise, any data that lies between a FIXED FORMAT card and the next FREE FORMAT or ENDATA card is considered to be in fixed format. The file is considered to be in fixed format when the NAME (SDIF file), ELEMENTS (SEIF file) or GROUPS (SGIF file) card is first encountered and thus no initial FIXED FORMAT card is required.

Fixed format data is exactly as described in Sections 3-5. The data on a free format data card consists of a number of strings separated by separators. The characters ``-'', ``;'', ``$'' and `` '' (blank) are separators and should not therefore be used as significant characters within strings. For example, in free format, X1;2 will be interpreted as two strings X1 and 2. The separators have the following meanings:

 
(blank) indicates that the previous string has finished and that a new string will follow. One or more blanks is interpreted as a single blank.

;
indicates that the previous string has finished and that a new string will follow. Moreover, if the file is translated into fixed format, the new string will appear on a new card.

_
indicates that the previous string has finished and that the next string is empty. Each - indicates a separate empty string so that ___ indicates three empty strings.

$
indicates that the previous string has finished and that the remainder of the card is to be considered as a comment (and thus ignored when the file is interpreted).

A free format card may contain up to 160 characters. On translation into fixed format, a free format card will be divided into one or more fixed format cards depending on how many card separators ``;'' are encountered. Each fixed format card may hold up to six strings; these strings are numbered 1 to 6.

String 1 is examined to see if the first 12 characters identify the card as an indicator. If so, these characters are placed in columns 1 to 12 on the card and the remaining strings discarded. Otherwise, the card is a data card and the first two-characters of string 1, together with the most recently identified indicator card are used to determine the structure of the remainder of the card; two character code must occur as field 1 in the indicated section of Sections 3-5 of this report. The first 2, 10, 10, 12 (41 on some SEIF/SGIF cards), 10, and 12 characters of strings 1-6, respectively, are extracted and placed on a single data card starting in columns 2, 5, 15, 25, 40, and 50, respectively. Left-over parts of strings are discarded. The assembled card is now in fixed format and may be interpreted as such. Thus although a free format card may appear to allow more flexibility, the requirement that the translated card conforms to the fixed input format places considerable responsibility on the user to specify the content of strings correctly.

As an example, a free format variant of the SDIF file given in Figure 3.21 might be:

NAME          DOC
FREE FORMAT
GROUPS;E GROUP1;E GROUP2;E GROUP3
VARIABLES;_X1 GROUP1 1.0;_X2 GROUP3 1.0;_X3
BOUNDS;FR BN1 X1;LO BN1 X2 -1.0;LO BN1 X3 1.0
       UP BN1 X2 1.0;UP BN1 X3 2.0
ELEMENT TYPE
EV ETYPE1 V1;EV ETYPE1 V2
EV ETYPE2 V1;EV ETYPE2 V2;EV ETYPE2 V3
IV ETYPE2 U1;IV ETYPE2 U2
ELEMENT USES
T G2E1 ETYPE1;V G2E1 V1_X2;V G2E1 V2_X3
T G3E1 ETYPE2;V G3E1 V1_X2;V G3E1 V2_X1;V G3E1 V3_X3
T G3E2 ETYPE1;V G2E1 V1_X1;V G2E1 V2_X3
GROUP TYPE;GV GTYPE1 ALPHA;GV GTYPE2 ALPHA
GROUP USES
T GROUP1 GTYPE1; GROUP2 GTYPE2
E GROUP2 G2E1;E GROUP3 G3E1;E GROUP3 G2E2
ENDATA


next up previous
Next: 7 Other Standards and Up: The SIF Reference Report Previous: 5.3 Two Further Examples