27
Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared for the BCS FSG AGM on 2 June 2005

Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Embed Size (px)

Citation preview

Page 1: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Parameterized modules, BITS, and other

features that may or may not be included

in the revision of Fortran 2003

David Muxworthy

BSI Fortran Convenor

Prepared for the BCS FSG AGM on 2 June 2005

Page 2: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Repository started 2004-05Preliminary choice of significant features 2005-04Final choice of significant features 2006-02

Completion of separate edits 2006-05First working draft available 2007-05 First CD submitted for registration and approval 2007-10

Final CD submitted for approval 2008-09

WG5 approval of draft DIS 2009-04DIS ballot initiated 2009-05DIS ballot results available 2009-07Standard published 2009-08

F2003+ Revision Schedule

Page 3: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

For further detail

WG5 repository of requirements N1626

WG5 classification of items resolution D6 in N1630

WG5 severity level description N1594

WG5 schedule N1590

WG5 document archive: ftp://www.nag.co.uk/sc22wg5/

J3 document archive: http://j3-fortran.org/doc/

Page 4: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Severity Levels - Editorial

1. Minor editorial (less than 10 lines altered).

2. Significant editorial (up to a page altered) with no technical change.

3. Major editorial (up to a chapter altered) with no technical change.

Page 5: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Severity Levels – Technical (1)

3. Very minor technical change.An example is adding the optional argument KIND to IACHAR.

4. Minor technical change.An example is changing type-bound generics to be sets of specific named type-bound procedures.

5. Technical change likely to need more than two J3 meetings to develop.An example is reallocation of allocatable arrays.

Page 6: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Severity Levels – Technical (2)

6. Technical change likely to need more than a year to develop. The modules and allocatable TRs are examples.

7. Technical change likely to need more than 2 years to develop. The IEEE TR is an example.

8. Technical change likely to need more than 3 years to develop. Interfacing with C and the OO features are examples.

Page 7: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Summary of decisions on requirements

at May 2005 WG5 meeting

To be implemented: 16 itemslevel 6: 1; level 5: 2; level 4: 8; level 3: 5

To be implemented if time permits: 18 itemslevel 7:1; level 6: 1; level 4/5: 1; level 4: 11; level 3: 4

Not to be pursued: 12 itemslevel 5: 2; level '>4': 1, level 4: 7; level 3/4: 2

Decision deferred: 19 itemslevel 4: 2; level 3: 16; level 2: 1

Page 8: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Two large"Do if time" items

- Parameterized modules (ref J3-014)

- BITS renamed from TYPELESS (ref J3-047)

Page 9: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Parameterized modules

Provide a facility whereby a module or subprogram can be developed in a generic form, and then applied to any appropriate type.

A generic module is a template or pattern for generating specific instances.

It has "generic parameters" but is otherwise structurally similar to a nongeneric module. A generic parameter can be a type, a data object, a procedure, a generic interface, a nongeneric module, or a generic module.

Page 10: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Parameterized modulesexamples

Module with type having at least a specified component module LinkedLists ( MyType ) type :: MyType type(myType), pointer :: Next! "next" component is required. ! Type is allowed to have other components, and TBPs. end type MyType ....

Module with type having separately-specified kind parameter module LinkedLists ( MyType, ItsKind ) type :: MyType(itsKind) integer, kind :: itsKind end type MyType integer, kind :: ItsKind

Page 11: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

BITS

The BITS type has values that are contiguous, ordered sequences of bits. The bit_size is the number of bits in the sequence.

A processor shall provide BITS sizes with bit_size values corresponding to the storage sizes of each of the INTEGER kinds provided, as well as the storage sizes of twice and four times the size of the default INTEGER storage size.

Each provided bit_size is characterized by a value for a type parameter called the kind type parameter. The kind type parameter is of type default integer. The kind type parameter of a BITS object is returned by the intrinsic inquiry function KIND. The number of bits of a BITS object is returned by the intrinsic function BIT_SIZE. The intrinsic function SELECTED_BITS_KIND returns a kind value based on the specified number of bits.

Page 12: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

BITS operations

The .and., .or., .xor., and .not. operators are defined for BITS operands. The computations are bitwise operations. The result of the expression evaluation is of type BITS. If the operands are of unequal bit_size, the smaller is padded on the left with zero bits before the operation is performed.

The .eq., .ne., .lt., .le., .gt., .ge., ==, /=, <, <=, >, and >= operators are defined for BITS operands. If the operands are of unequal KIND, the smaller is padded on the left with zero bits before the operation is performed. Operands A and B are equal if their corresponding bits are the same, and are unequal otherwise.If A and B are unequal, and the leftmost unequal corresponding bit of A is 1 and of B is 0, then A > B, otherwise A < B.

Page 13: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

BITS Input/Output

The format specifiers for BITS objects are I, B, O, and Z. For output, if the .d part of the Bw.d, Ow.d, or Zw.d specifier is omitted, the value assumed for d is >= 1 and large enough to represent the bits in the I/O list item excluding leading 0 bits.

For the I format specifier, the object value is interpreted as an unsigned base 10 integer. For input using the B, O, and Z edit descriptors, the character string shall consist of binary, octal, or hexadecimal digits in the respective input field. For input using the I format, the input character string shall consist of an unsigned decimal integer. For list directed output, the format used is Zw.d where d is (bit_size of the I/O list item + 3)/4 and w = d+1.

For list directed input, hexadecimal constants are valid for BITS I/O list items.

Page 14: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

BITS Intrinsic Functions

Some existing intrinsic functions, especially those dealing withboz-literal-constants, are extended to deal with variables of type BITS.

Some new intrinsic functions are introduced to deal with such things as shifting, masking, merging and counting the number of leading and trailing zero bits.

Page 15: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Source form

decision deferred:

- Allow SUBROUTINE name & FUNCTION name to be (ref J3-025) optional for module and internal subprograms

- Allow semicolon to start a line (ref J3-035)

Page 16: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Types and declarations

do if time:

- Non-null initial targets for pointers (ref J3-018)- Determine named array constant length from its (ref J3-023) initialization expression- Rewrite the requirements on attributes (editorial) (ref J3-008)

decision deferred:

- Find all available logical & character kinds (ref J3-006)- Simplified means to select the most commonly desired real and integer kinds (ref J3-030)- KIND environment specification (ref UK-004)- Provide a table of attribute compatibility (editorial) (ref RU-006)- Allow forward type for allocatable components (ref J3-028)- Add MOLD keyword to ALLOCATE (ref J3-034)

Page 17: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Execution control

do if time:

- EXIT from any labelled construct (ref J3-024and RU-002)

Page 18: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Expressions and assignment

do if time:

- Updating complex parts (ref J3-015)- Allow polymorphic allocatable variable in intrinsic (ref J3-022) assignment- Pointer function references on lhs in assignment (ref UK-008)

decision deferred:

- Multiple Nonzero-Rank Part References (ref UK-006)

Page 19: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Input/Output

do if time:

- Write files in comma separated values (CSV) format (ref J3-048)

- Standard derived type for I/O units (ref J3-009)

decision deferred:

- Intrinsic procedure to get I/O unit (ref J3-002)

Page 20: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Generic resolution

do if time:

- Use ALLOCATABLE and POINTER attributes in (ref J3-012) generic resolution

- Use procedureness in generic resolution (ref UK-009)

Page 21: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Argument association

decision deferred:

- Disassociated or deallocated actual argument associated with nonpointer nonallocatable optional dummy argument is considered not to be present (ref J3-016)

Page 22: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Intrinsic procedures

do if time:

- Add array reduction functions from HPF (ref RU-005)

- Add Bessel functions, erf, etc as in C (ref J3-038)

decision deferred:

- Add STORAGE_SIZE procedure (ref J3-004)

- Allow ATAN with two arguments (ref J3-026)

- Get more information on GET_COMMAND failure (ref J3-029)

- Procedure to return compiler version (ref J3-033)

- FINDLOC procedure (ref J3-032)

Page 23: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Arithmetic

do if time:

- Conformance to IEEE 754R (ref UK-003)

Page 24: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Interoperability

do if time:

- Interoperability of pointers, allocatables, (ref J3-041) assumed-shape arrays- Interoperability of optional arguments (ref J3-042)

decision deferred:

- Add C_SIZEOF, same as sizeof in C (ref J3-005)

Page 25: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Items not to be pursued

J3-007 Construct Name Local to ConstructJ3-011 CoroutinesJ3-017 Default initial values for absent optional dummy argumentsJ3-021 Resolve generic without invoking a procedure or evaluating

argumentsJ3-031 ANDTHEN and ORELSE pseudo-functionsJ3-036 Use, ExceptJ3-037 Pointers and TargetsJ3-040 Compute if actual arg is presentJ3-045 Same Assumed Shape declarationJ3-049 Select between expressionsRU-004 Subset of Fortran Standard which does not include

redundant featuresUK-010 Partial initialization of PARAMETERs

Page 26: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Outcome of items by countrywhich proposed them

WG5 classification

Source must do do if time defer drop total

J3 11 14 14 10 49 RU 1 1 3 1 6 UK 4 3 2 1 10 total 16 18 19 12 65

Page 27: Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared

Outcome of items byJ3 classification

of its own submissions

WG5 classification J3 classification must do do if time defer drop

total

must do 5 2 0 1 8 do if time 5 11 11 6 33 do not allocate resources 1 1 3 3 8 total 11 14 14 10 49