• Keine Ergebnisse gefunden

RULES FOR STRUCTURE TYPE:

Im Dokument HAL/S LANGUAGE SPECIFICATION (Seite 57-60)

1. The condition for the <type spec> indicating a minor structure is described in General Semantic Rule 1.

2. The phrase <template name>-STRUCTURE defines an <identifier> to be a major structure whose tree organization is described by a previously defined template called <template name>.

3. The parenthesized expression or asterisk optionally following the keyword

STRUCTURE specifies the structure to have multiple copies. The value specifies the number of copies, which may range from 2 to an implementation dependent

maximum.

4. The copy specification may only be an asterisk if the structure is a formal parameter of a procedure or function. The actual number of copies is supplied by the

corresponding argument of an invocation of the procedure or function and must be greater than 1.

5. If the <identifier> named is the same as the <template name> of the template of the structure, then the structure is said to be unqualified; otherwise, the structure is said to be qualified. Templates used for non-qualified declarations may not contain nested structure references. Section 5.2 contains material on some further implications of structure qualification.6

6. If the <type spec> of a function is STRUCTURE, then no specification of multiple copies is allowed.

7. If the <type spec> of a structure terminal is STRUCTURE, then no specification of multiple copies is allowed.

4.8 Initialization.

The <initialization> attribute specifies the initial values to be applied to an <identifier>.

The circumstances under which the attribute is legal have been described in Section 4.5.

6. Declarations of non-qualified STRUCTUREs must occur in the same name scope as the template definition.

SYNTAX:

Figure 4-14 initialization specification - #18 GENERAL SEMANTIC RULES

1. The <initialization> starts with the keyword INITIAL or CONSTANT. If it starts with CONSTANT, the value of the <identifier> initialized may never be changed. It is illegal for <identifier>s with CONSTANT <initialization> to appear in an assignment context.

2. The simplest form of an <initial list> is a sequence of one or more <expression>s computable at compile time (see Appendix F).

3. A simple <initial list> of the form given in Rule 2 may appear enclosed in parentheses, and preceded by <arith exp>#, where <arith exp> is any unarrayed integer or scalar expression computable at compile time. The value, rounded to the nearest integer, is a repetition factor for the initial values contained within the parentheses. This

repeated <initial list> may itself become a component of an <initial list>, and so on to some arbitrary nesting depth.

4. In addition to preceding a parenthesized <initial list>, <arith exp># may also precede certain unparenthesized items denoted collectively in the syntax diagram by §. These items are:

• a single literal;

• a single unsubscripted variable name;

• blank (i.e., the component(s) of the <identifier> should not be initialized).

5. The presence of an asterisk at the end of an <initial list> implies the partial initialization of an <identifier>.

6. The order of initialization is the “natural sequence” specified in Section 5.5.

CONSTANT (

RULES FOR INTEGER AND SCALAR TYPES:

1. If the <identifier> has no array specification, the <initial list> must contain exactly one value.

2. If the <identifier> has an array specification, then one of the following must hold:

• the number of values in the <initial list> is exactly one, in which case all elements of the array are initialized to that value;

• the number of values in the <initial list> is exactly equal to the number of array elements to be initialized;

• the <initial list> ends with an asterisk, in which case the number of values must be less than the number of array elements to be initialized, and partial initialization is indicated.

3. <expression> must be an unarrayed INTEGER or SCALAR, or expression computable at compile time (see Appendix F). Type conversion between INTEGER and SCALAR is allowed where necessary.

4. Non-aggregate (unarrayed and not in a structure) INTEGER and SCALAR single precision CONSTANTs initialized with a double precision value remain double precision.

RULES FOR VECTOR AND MATRIX TYPES:

1. If the <identifier> has no array specification, then one of the following must hold:

• the number of values in the <initial list> is exactly one, in which case all components of the VECTOR or MATRIX are initialized to the value;

• the number of values in the <initial list> is exactly equal to the number of components to be initialized;

• the <initial list> ends with an asterisk, in which case the number of values must be less than the number of components to be initialized, and partial initialization is indicated.

2. If the <identifier> has an array specification, then one of the following must hold:

• the number of values in the <initial list> is exactly one, in which case all the

components of all the array elements of the VECTOR or MATRIX are initialized to that value;

• the number of values in the <initial list> is exactly equal to the number of

components of the VECTOR or MATRIX, in which case every array element takes on the same set of values;

• the number of values in the <initial list> is equal to the total number of components in all array elements;

• the <initial list> ends with an asterisk, in which case the number of values must be less than the total number of components in all array elements, and partial

initialization is indicated.

3. <expression> must be an unarrayed integer or scalar expression computable at compile time (see Appendix F). The conversion between integer and scalar is allowed where necessary.

Im Dokument HAL/S LANGUAGE SPECIFICATION (Seite 57-60)