Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Conformant array parameters

 

NOTE --- For the status of this subclause see 5.1 a), 5.1 b), 5.1 c), 5.2 a), and 5.2 b).

 

6.6.3.7.1 General

The occurrence of an identifier in the identifier-list contained by a conformant-array-parameter-specification shall constitute its defining-point as a parameter-identifier for the region that is the formal-parameter-list closest-containing it and its defining-point as the associated variable-identifier for the region that is the block, if any, of which it is a formal-parameter. A variable-identifier so defined shall be designated a conformant-array-parameter.

The occurrence of an identifier in an index-type-specification shall constitute its defining-point as a bound-identifier for the region that is the formal-parameter-list closest-containing it and for the region that is the block, if any, whose formal-parameters are specified by that formal-parameter-list.

formal-parameter-section > conformant-array-parameter-specification .

conformant-array-parameter-specification = value-conformant-array-specification

½ variable-conformant-array-specification .

value-conformant-array-specification = identifier-list ':' conformant-array-schema .

variable-conformant-array-specification = 'var' identifier-list ':' conformant-array-schema .

conformant-array-schema = packed-conformant-array-schema

½ unpacked-conformant-array-schema .

packed-conformant-array-schema = 'packed' 'array' '[' index-type-specification ']'

'of' type-identifier .

unpacked-conformant-array-schema =

'array' '[' index-type-specification { ';' index-type-specification } ']'

'of' ( type-identifier ½ conformant-array-schema ) .

index-type-specification = identifier '..' identifier ':' ordinal-type-identifier .

factor > bound-identifier .

bound-identifier = identifier .

 

NOTE --- 1 There are also syntax rules for formal-parameter-section in 6.6.3.1 and for factor in 6.7.1.

 

If a conformant-array-schema closest-contains a conformant-array-schema, then an abbreviated form of definition shall be permitted. In the abbreviated form, a single semicolon shall replace the sequence ] of array [ that occurs in the full form. The abbreviated form and the full form shall be equivalent.

 

Examples:

array [u..v : T1] of array [j..k : T2] of T3

array [u..v : T1; j..k : T2] of T3

 

Within the activation of the block, applied occurrences of the first identifier of an index-type-specification shall denote the smallest value specified by the corresponding index-type (see 6.6.3.8) possessed by the actual-parameter, and applied occurrences of the second identifier of the index-type-specification shall denote the largest value specified by that index-type.

 

NOTE --- 2 The object denoted by a bound-identifier is neither a constant nor a variable.

 

The actual-parameters (see 6.7.3 and 6.8.2.3) corresponding to formal-parameters that occur in a single conformant-array-parameter-specification shall all possess the same type. The type possessed by the actual-parameters shall be conformable (see 6.6.3.8) with the conformant-array-schema, and the formal-parameters shall possess an array-type which shall be distinct from any other type and which shall have a component-type that shall be the fixed-component-type of the conformant-array-parameters defined in the conformant-array-parameter-specification and that shall have the index-types of the type possessed by the actual-parameters that correspond (see 6.6.3.8) to the index-type-specifications contained by the conformant-array-schema contained by the conformant-array-parameter-specification. The type denoted by the type-identifier contained by the conformant-array-schema contained by a conformant-array-parameter-specification shall be designated the fixed-component-type of the conformant-array-parameters defined by that conformant-array-parameter-specification.



 

NOTE --- 3 The type possessed by the formal-parameter cannot be a string-type (see 6.4.3.2) because it is not denoted by an array-type.

 

6.6.3.7.2 Value conformant arrays

The identifier-list in a value-conformant-array-specification shall be a list of value conformant arrays. Each actual-parameter corresponding to a value formal-parameter shall be an expression. The value of the expression shall be attributed before activation of the block to an auxiliary variable that the program does not otherwise contain. The type possessed by this variable shall be the same as that possessed by the expression. This variable shall be accessed before the activation of the block, and this access shall establish a reference to the variable thereby accessed during the entire activation of the block; the corresponding formal-parameter and its associated variable-identifier shall represent the referenced variable during the activation. The fixed-component-type of a value conformant array shall be one that is permitted as the component-type of a file-type.

If the actual-parameter contains an occurrence of a conformant-array-parameter, then for each occurrence of the conformant-array-parameter contained by the actual-parameter, either

a) the occurrence of the conformant-array-parameter shall be contained by a function-designator contained by the actual-parameter; or

b) the occurrence of the conformant-array-parameter shall be contained by an indexed-variable contained by the actual-parameter, such that the type possessed by that indexed-variable is the fixed-component-type of the conformant-array-parameter.

 

NOTE --- This ensures that the type possessed by the expression and the auxiliary variable will always be known and that, as a consequence, the activation record of a procedure can be of a fixed size.

 

6.6.3.7.3 Variable conformant arrays

The identifier-list in a variable-conformant-array-specification shall be a list of variable conformant arrays. The actual-parameter shall be a variable-access. The actual-parameter shall be accessed before the activation of the block, and this access shall establish a reference to the variable thereby accessed during the entire activation of the block; the corresponding formal-parameter and its associated variable-identifier shall denote the referenced variable during the activation.

An actual-parameter shall not denote a component of a variable where that variable possesses a type that is designated packed.

 

Conformability

 

NOTE --- 1 For the status of this subclause see 5.1 a), 5.1 b), 5.1 c), 5.2 a), and 5.2 b).

 

Given a type denoted by an array-type closest-containing a single index-type and a conformant-array-schema closest-containing a single index-type-specification, then the index-type and the index-type-specification shall be designated as corresponding. Given two conformant-array-schemas closest-containing a single index-type-specification, then the two index-type-specifications shall be designated as corresponding. Let T1 be an array-type with a single index-type and let T2 be the type denoted by the ordinal-type-identifier of the index-type-specification of a conformant-array-schema closest-containing a single index-type-specification; then T1 shall be conformable with the conformant-array-schema if all the following four statements are true.

a) The index-type of T1 is compatible with T2.

b) The smallest and largest values specified by the index-type of T1 lie within the closed interval specified by T2.

c) The component-type of T1 denotes the same type as that denoted by the type-identifier of the conformant-array-schema or is conformable to the conformant-array-schema in the conformant-array-schema.

d) Either T1 is not designated packed and the conformant-array-schema is an unpacked-conformant-array-schema, or T1 is designated packed and the conformant-array-schema is a packed-conformant-array-schema.

 

NOTE --- 2 The abbreviated and full forms of a conformant-array-schema are equivalent (see 6.6.3.7). The abbreviated and full forms of an array-type are equivalent (see 6.4.3.2).

 

At any place where the rule of conformability is used, it shall be an error if the smallest or largest value specified by the index-type of T1 lies outside the closed interval specified by T2.

 


Date: 2015-12-24; view: 1022


<== previous page | next page ==>
Function-declarations | File handling procedures
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)