ISO/IEC 1539-2:2000
(Main)Information technology - Programming languages - Fortran - Part 2: Varying length character strings
Information technology - Programming languages - Fortran - Part 2: Varying length character strings
This part of ISO/IEC 1539 defines facilities in Fortran for the manipulation of character strings of dynamically variable length. This part of ISO/IEC 1539 provides an auxiliary standard for the version of the Fortran language specified by ISO/IEC 1539-1: 1997 and informally known as Fortran 95. A program that conforms with 1539-2: 1994 also conforms with this standard. This part of ISO/IEC 1539 is an auxiliary standard to that defining Fortran 95 in that it defines additional facilities to those defined intrinsically in the primary language standard. A processor conforming to the Fortran 95 standard is not required also to conform to this part of ISO/IEC 1539. However, conformance to this part of ISO/IEC 1539 assumes conformance to the primary Fortran 95 standard. This part of ISO/IEC 1539 prescribes the name of a Fortran module, the name of a derived data type to be used to represent varying-length strings, the interfaces for the procedures and operators to be provided to manipulate objects of this type, and the semantics that are required for each of the entities made accessible by this module. This part of ISO/IEC 1539 does not prescribe the details of any implementation. Neither the method used to represent the data entities of the defined type nor the algorithms used to implement the procedures or operators whose interfaces are defined by this part of ISO/IEC 1539 are prescribed. A conformant implementation may use any representation and any algorithms, subject only to the requirement that the publicly accessible names and interfaces conform to this part of ISO/IEC 1539, and that the semantics are as required by this part of ISO/IEC 1539 and those of ISO/IEC 1539-1 : 1997. It should be noted that a processor is not required to implement this part of ISO/IEC 1539 in order to be a standard conforming Fortran processor, but if a processor implements facilities for manipulating varying length character strings, it is recommended that this be done in a manner that is conformant with this part of ISO/IEC 1539. A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or with ISO/IEC 1539-1 : 1997. A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard conforming Fortran, it provides a portable implementation of the required facilities. This module is referenced for information only and is not intended to constrain implementations in any way. This module is a demonstration that at least one implementation, in standard conforming and hence portable Fortran, is possible. It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for non-default kind characters by a separate, if similar, module for each such character kind. This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations and functions that apply to fixed length character strings have extended meanings defined by this part of ISO/IEC 1539 for varying length character strings. Also a small number of additional facilities are defined that are appropriate because of the essential differences between the intrinsic type and the varying length derived data type.
Technologies de l'information — Langages de programmation — Fortran — Partie 2: Chaînes de caractères de longueur variable
General Information
- Status
- Published
- Publication Date
- 07-Jun-2000
- Technical Committee
- ISO/IEC JTC 1/SC 22 - Programming languages, their environments and system software interfaces
- Drafting Committee
- ISO/IEC JTC 1/SC 22/WG 5 - Fortran
- Current Stage
- 9093 - International Standard confirmed
- Start Date
- 29-Apr-2021
- Completion Date
- 30-Oct-2025
Relations
- Effective Date
- 15-Apr-2008
Overview
ISO/IEC 1539-2:2000 - "Information technology - Programming languages - Fortran - Part 2: Varying length character strings" is an auxiliary ISO standard for Fortran 95. It defines a standard Fortran module and a derived data type for handling dynamically varying-length character strings. The standard prescribes publicly visible names, interfaces and semantics (but not implementation techniques), enabling portable libraries and consistent behavior across implementations that choose to support it.
Key topics and requirements
- Module name: ISO_VARYING_STRING - programs access facilities via
USE ISO_VARYING_STRING. - Derived type: VARYING_STRING - represents strings of default-kind characters whose length can change at runtime; no arbitrary upper length (limited only by processor resources).
- Semantics-prescription: The standard prescribes semantics for names, interfaces and behavior but does not mandate internal representation or algorithms.
- Extended intrinsic operations: Assignment (
=), concatenation (//) and comparisons (==,/=,<,<=,>=,>) are extended to accept combinations ofVARYING_STRINGand intrinsicCHARACTER. - Elemental and pure functions: Many intrinsic procedures are extended or given elemental/pure meanings for
VARYING_STRING, including:- ADJUSTL, ADJUSTR (left/right adjust)
- CHAR, IACHAR, ICHAR (conversion and collating positions)
- INDEX, LEN, LEN_TRIM, TRIM (search and length)
- LGE/LGT/LLE/LLT (lexical comparisons)
- REPEAT, SCAN, VERIFY (string operations)
- Additional procedures: Type conversion (
VAR_STR), I/O helpers (GET, PUT, PUT_LINE), and substring manipulation (EXTRACT, INSERT, REMOVE, REPLACE, SPLIT). - Portability aid: Annex A provides an informative, portable Fortran implementation of the module to demonstrate feasibility (informative only; not normative).
- Default-kind only: Facilities apply to characters of default kind; extensions for other kinds would require separate modules.
Applications and who should use it
- Fortran compiler and runtime implementers who want to offer standardized APIs for dynamic strings.
- Library authors and maintainers creating portable Fortran modules for text processing, I/O and string manipulation.
- Scientific and engineering developers modernizing legacy Fortran code that needs variable-length text handling.
- Tool and language designers ensuring consistent semantics across platforms.
- Standards and quality assurance teams evaluating Fortran implementations for extended string support.
Related standards
- ISO/IEC 1539-1:1997 - Fortran 95 base language (primary standard that 1539-2 supplements).
- ISO/IEC 646:1991 - 7-bit coded character set referenced for IACHAR semantics.
Keywords: ISO/IEC 1539-2:2000, Fortran 95, varying length character strings, VARYING_STRING, ISO_VARYING_STRING, Fortran module, character string manipulation, portable Fortran.
Frequently Asked Questions
ISO/IEC 1539-2:2000 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - Programming languages - Fortran - Part 2: Varying length character strings". This standard covers: This part of ISO/IEC 1539 defines facilities in Fortran for the manipulation of character strings of dynamically variable length. This part of ISO/IEC 1539 provides an auxiliary standard for the version of the Fortran language specified by ISO/IEC 1539-1: 1997 and informally known as Fortran 95. A program that conforms with 1539-2: 1994 also conforms with this standard. This part of ISO/IEC 1539 is an auxiliary standard to that defining Fortran 95 in that it defines additional facilities to those defined intrinsically in the primary language standard. A processor conforming to the Fortran 95 standard is not required also to conform to this part of ISO/IEC 1539. However, conformance to this part of ISO/IEC 1539 assumes conformance to the primary Fortran 95 standard. This part of ISO/IEC 1539 prescribes the name of a Fortran module, the name of a derived data type to be used to represent varying-length strings, the interfaces for the procedures and operators to be provided to manipulate objects of this type, and the semantics that are required for each of the entities made accessible by this module. This part of ISO/IEC 1539 does not prescribe the details of any implementation. Neither the method used to represent the data entities of the defined type nor the algorithms used to implement the procedures or operators whose interfaces are defined by this part of ISO/IEC 1539 are prescribed. A conformant implementation may use any representation and any algorithms, subject only to the requirement that the publicly accessible names and interfaces conform to this part of ISO/IEC 1539, and that the semantics are as required by this part of ISO/IEC 1539 and those of ISO/IEC 1539-1 : 1997. It should be noted that a processor is not required to implement this part of ISO/IEC 1539 in order to be a standard conforming Fortran processor, but if a processor implements facilities for manipulating varying length character strings, it is recommended that this be done in a manner that is conformant with this part of ISO/IEC 1539. A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or with ISO/IEC 1539-1 : 1997. A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard conforming Fortran, it provides a portable implementation of the required facilities. This module is referenced for information only and is not intended to constrain implementations in any way. This module is a demonstration that at least one implementation, in standard conforming and hence portable Fortran, is possible. It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for non-default kind characters by a separate, if similar, module for each such character kind. This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations and functions that apply to fixed length character strings have extended meanings defined by this part of ISO/IEC 1539 for varying length character strings. Also a small number of additional facilities are defined that are appropriate because of the essential differences between the intrinsic type and the varying length derived data type.
This part of ISO/IEC 1539 defines facilities in Fortran for the manipulation of character strings of dynamically variable length. This part of ISO/IEC 1539 provides an auxiliary standard for the version of the Fortran language specified by ISO/IEC 1539-1: 1997 and informally known as Fortran 95. A program that conforms with 1539-2: 1994 also conforms with this standard. This part of ISO/IEC 1539 is an auxiliary standard to that defining Fortran 95 in that it defines additional facilities to those defined intrinsically in the primary language standard. A processor conforming to the Fortran 95 standard is not required also to conform to this part of ISO/IEC 1539. However, conformance to this part of ISO/IEC 1539 assumes conformance to the primary Fortran 95 standard. This part of ISO/IEC 1539 prescribes the name of a Fortran module, the name of a derived data type to be used to represent varying-length strings, the interfaces for the procedures and operators to be provided to manipulate objects of this type, and the semantics that are required for each of the entities made accessible by this module. This part of ISO/IEC 1539 does not prescribe the details of any implementation. Neither the method used to represent the data entities of the defined type nor the algorithms used to implement the procedures or operators whose interfaces are defined by this part of ISO/IEC 1539 are prescribed. A conformant implementation may use any representation and any algorithms, subject only to the requirement that the publicly accessible names and interfaces conform to this part of ISO/IEC 1539, and that the semantics are as required by this part of ISO/IEC 1539 and those of ISO/IEC 1539-1 : 1997. It should be noted that a processor is not required to implement this part of ISO/IEC 1539 in order to be a standard conforming Fortran processor, but if a processor implements facilities for manipulating varying length character strings, it is recommended that this be done in a manner that is conformant with this part of ISO/IEC 1539. A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or with ISO/IEC 1539-1 : 1997. A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard conforming Fortran, it provides a portable implementation of the required facilities. This module is referenced for information only and is not intended to constrain implementations in any way. This module is a demonstration that at least one implementation, in standard conforming and hence portable Fortran, is possible. It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for non-default kind characters by a separate, if similar, module for each such character kind. This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations and functions that apply to fixed length character strings have extended meanings defined by this part of ISO/IEC 1539 for varying length character strings. Also a small number of additional facilities are defined that are appropriate because of the essential differences between the intrinsic type and the varying length derived data type.
ISO/IEC 1539-2:2000 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.
ISO/IEC 1539-2:2000 has the following relationships with other standards: It is inter standard links to ISO/IEC 1539-2:1994. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.
You can purchase ISO/IEC 1539-2:2000 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.
Standards Content (Sample)
INTERNATIONAL ISO/IEC
STANDARD 1539-2
Second edition
2000-06-01
Information technology — Programming
languages — Fortran —
Part 2:
Varying length character strings
Technologies de l'information — Langages de programmation — Fortran —
Partie 2: Chaînes de caractères de longueur variable
Reference number
©
ISO/IEC 2000
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 2000
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic
or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 � CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 734 10 79
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 2000 – All rights reserved
CONTENTS
1 Scope …………………………………………………………………………………………… 1
2 Normative References …………………………………………………………………………… 2
3 Requirements …………………………………………………………………………………… 3
3.1 The Name of the Module ……………………………………………………………… 3
3.2 The Type ………………………………………………………………………………… 3
3.3 Extended Meanings for Intrinsic Operators …………………………………………… 3
3.3.1 Assignment …………………………………………………………………… 3
3.3.2 Concatenation ………………………………………………………………… 4
3.3.3 Comparisons …………………………………………………………………… 4
3.4 Extended Meanings for Generic Intrinsic Procedures ………………………………… 5
3.4.1 ADJUSTL (string) …………………………………………………………… 5
3.4.2 ADJUSTR (string) …………………………………………………………… 5
3.4.3 CHAR (string [, length]) ……………………………………………………… 5
3.4.4 IACHAR (c) …………………………………………………………………… 6
3.4.5 ICHAR (c) …………………………………………………………………… 6
3.4.6 INDEX (string, substring [, back]) …………………………………………… 6
3.4.7 LEN (string) …………………………………………………………………… 7
3.4.8 LEN_TRIM (string) …………………………………………………………… 7
3.4.9 LGE (string_a, string_b) ……………………………………………………… 7
3.4.10 LGT (string_a, string_b) ……………………………………………………… 7
3.4.11 LLE (string_a, string_b) ……………………………………………………… 8
3.4.12 LLT (string_a, string_b) ……………………………………………………… 8
3.4.13 REPEAT (string, ncopies) …………………………………………………… 9
3.4.14 SCAN (string, set [, back]) …………………………………………………… 9
3.4.15 TRIM (string) ………………………………………………………………… 9
3.4.16 VERIFY (string, set [, back]) ……………………………………………… 10
3.5 Additional Generic Procedure for Type Conversion ………………………………… 10
3.5.1 VAR_STR (char) …………………………………………………………… 10
3.6 Additional Generic Procedures for Input/Output …………………………………… 11
3.6.1 GET (string [, maxlen, iostat]) or
GET (unit, string [, maxlen, iostat]) or
GET (string, set [, separator, maxlen, iostat]) or
GET (unit, string, set [, separator, maxlen, iostat]) ………………………… 11
3.6.2 PUT (string [, iostat]) or PUT (unit, string [, iostat]) ……………………… 12
3.6.3 PUT_LINE (string [, iostat]) or PUT_LINE (unit, string [, iostat]) ………… 12
3.7 Additional Generic Procedures for Substring Manipulation ………………………… 12
3.7.1 EXTRACT (string [, start, finish]) …………………………………………… 13
3.7.2 INSERT (string, start, substring) …………………………………………… 13
3.7.3 REMOVE (string [, start, finish]) …………………………………………… 13
3.7.4 REPLACE (string, start, substring) or
REPLACE (string, start, finish, substring) or
REPLACE (string, target, substring [,every, back]) ………………………… 14
ISO/IEC 2000 – All rights reserved iii
3.7.5 SPLIT (string, word, set [, separator, back]) ………………………………… 15
Annex A (informative). Module ISO_VARYING_STRING……………………………………… 16
Annex B (informative). Two examples …………………………………………………………… 17
B.1 Word count ……………………………………………………………………………… 17
B.2 Vocabulary list …………………………………………………………………………… 18
iv ISO/IEC 2000 – All rights reserved
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission)
form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC
participate in the development of International Standards through technical committees established by the
respective organization to deal with particular fields of technical activity. ISO and IEC technical committees
collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in
liaison with ISO and IEC, also take part in the work.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 3.
In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting.
Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this part of ISO/IEC 1539 may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
International Standard ISO/IEC 1539-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information
technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces.
This second edition cancels and replaces the first edition (ISO/IEC 1539-2:1994), which has been technically
revised. The following summarises the changes made to the facilities provided by this part of ISO/IEC 1539:
The assignment, concatenation, and comparison operations are extended to describe elemental semantics.
CHAR is extended to describe pure semantics.
ADJUSTL, ADJUSTR, EXTRACT, IACHAR, ICHAR, INDEX, INSERT, LEN, LEN_TRIM, LGE, LGT, LLE, LLT,
REMOVE, REPEAT, REPLACE, SCAN, SPLIT, TRIM, VAR_STR, and VERIFY are all extended to describe
elemental semantics.
ISO/IEC 1539 consists of the following parts, under the general title Information technology — Programming
languages — Fortran:
� Part 1: Base language
� Part 2: Varying length character strings
Annexes A and B of this part of ISO/IEC 1539 are for information only.
© ISO/IEC 2000 – All rights reserved v
Introduction
This part of ISO/IEC 1539 has been prepared by ISO/IEC JTC1/SC22/WG5, the technical working group for
the Fortran language. This part of ISO/IEC 1539 is an auxiliary standard to ISO/IEC 1539-1 : 1997, which
defines the latest revision of the Fortran language, and is the first part of the multipart Fortran family of
standards; this part of ISO/IEC 1539 is the second part. The revised language defined by ISO/IEC 1539-1 :
1997 is informally known as Fortran 95.
This part of ISO/IEC 1539 defines the interface and semantics for a module that provides facilities for the
manipulation of character strings of arbitrary and dynamically variable length. Annex A refers to a possible
implementation, in Fortran 95, of a module that conforms to this part of ISO/IEC 1539. It should be noted,
however, that this is purely for purposes of demonstrating the feasibility and portability of this standard. The
actual code is not intended in any way to prescribe the method of implementation, nor is there any implication
that this is in any way an optimal portable implementation. The module is merely a fairly straightforward
demonstration that a portable implementation is possible.
This standard is a development from a previous version known as ISO/IEC 1539-2: 1994 that takes account of
the improvements introduced in Fortran 95. The most significant improvements in Fortran 95 for the present
standard were the introduction of pure and elemental procedures. Since pure and elemental functions can be
used in specification expressions, their introduction in this standard enhances the usability of the standard for
the end user. The ability to define many of the functions specified in this standard to be elemental improves the
compatibility of these functions with similar intrinsic functions defined by the main standard.
The improvements in type initialization provided in Fortran 95 have also enabled the sample implementation
referred to in Annex A to be written in such a way that significant leakage of memory is less likely to occur.
vi ISO/IEC 2000 – All rights reserved
length character strings, it is recommended that this be done in a manner that is conformant with this part of
ISO/IEC 1539.
A processor conforming to this part of ISO/IEC 1539 may extend the facilities provided for the manipulation
of varying length character strings as long as such extensions do not conflict with this part of ISO/IEC 1539 or
with ISO/IEC 1539-1 : 1997.
A module, written in standard conforming Fortran, is referenced in Annex A. This module illustrates one way
in which the facilities described in this part of ISO/IEC 1539 could be provided. This module is both
conformant with the requirements of this part of ISO/IEC 1539 and, because it is written in standard
conforming Fortran, it providesa portable implementation of the required facilities. This module is referenced
for information only and is not intended to constrain implementations in any way. This module is a
demonstration that at least one implementation, in standard conforming and hence portable Fortran, is
possible.
It should be noted that this part of ISO/IEC 1539 defines facilities for dynamically varying length strings of
characters of default kind only. Throughout this part of ISO/IEC 1539 all references to intrinsic type
CHARACTER should be read as meaning characters of default kind. Similar facilities could be defined for
non-default kind characters by a separate, if similar, module for each such character kind.
This part of ISO/IEC 1539 has been designed, as far as is reasonable, to provide for varying length character
strings the facilities that are available for intrinsic fixed length character strings. All the intrinsic operations
and functions that apply to fixed length character strings have extended meanings defined by this part of
ISO/IEC 1539 for varying length character strings. Alsoa small number of additional facilities are defined that
are appropriate because of the essential differences between the intrinsic type and the varying length derived
data type.
2 Normative References
The following normative documents contain provisions which, through reference in this text, constitute
provisions of this part of ISO/IEC 1539. For dated references, subsequent amendments to, or revisions of, any
of these publications do not apply. However, parties to agreements based on this part of ISO/IEC 1539 are
encouraged to investigate the possibility of applying the most recent editions of the normative documents
indicated below. For undated references, the latest edition of the normative document referred to applies.
Members of ISO and IEC maintain registers of currently valid International Standards.
ISO/IEC 646 : 1991 Information technology – ISO 7-bit Coded character set for information interchange.
ISO/IEC 1539-1 : 1997 Information technology – Programming languages – Fortran – Part 1: Base
language.
2 ISO/IEC 2000 – All rights reserved
3 Requirements
3.1 The Name of the Module
The name of the module shall be
ISO_VARYING_STRING
Programs shall be able to access the facilities defined by this part of ISO/IEC 1539 by the inclusion of USE
statements of the form
USE ISO_VARYING_STRING
3.2 The Type
The type shall have the name
VARYING_STRING
Entities of this type shall represent values that are strings of characters of default kind. These character strings
may be of any non-negative length and this length may vary dynamically during the execution of a program.
There shall be no arbitrary upper length limit other than that imposed by the size of the processor and the
complexity of the programs it is able to process. The characters representing the value of the string have
positions 1,2,.,N, where N is the length of the string. The internal structure of the type shall bePRIVATE to
the module.
3.3 Extended Meanings for Intrinsic Operators
The meanings for the intrinsic operators of:
assignment =
concatenation //
comparisons ==, /=, <, <=, >=, >
shall be extended to accept any combination of operands of typeVARYING_STRING and typeCHARACTER.
Note that the equivalent comparison operator forms.EQ.,.NE.,.LT.,.LE.,.GE., and.GT. also have
their meanings extended in this manner.
3.3.1 Assignment
An elemental assignment of the form
var = expr
shall be defined with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Action. The characters that are the value of the expressionexpr become the value of the variablevar. There
are two cases:
Case(i): Where the variable is of typeVARYING_STRING, the length of the variable becomes that of the
ISO/IEC 2000 – All rights reserved 3
expression.
Case(ii): Where the variable is of type CHARACTER, the rules of intrinsic assignment to a Fortran
character variable apply. Namely, if the expression string is longer than the declared length of the
character variable, only the left-most characters are assigned. If the character variable is longer
than that of the string expression, it is padded on the right with blanks.
3.3.2 Concatenation
The elemental concatenation operation
string_a//string_b
shall be defined with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
The values of the operands are unchanged by the operation.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is a new string whose characters are the same as those produced by
concatenating the operand character strings in the order given.
3.3.3 Comparisons
Elemental comparisons of the form
string_a == string_b
string_a /= string_b
string_a < string_b
string_a <= string_b
string_a > string_b
string_a >= string_b
shall be defined for operands with the following type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
The values of the operands are unchanged by the operation. Note that the equivalent operator forms .EQ.,
.NE.,.LT.,.LE.,.GE., and.GT. also have their meanings extended in this manner.
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a stands in the indicated relation tostring_b and is false
otherwise. The collating sequence used for the inequality comparisons is that defined by the processor for
characters of default kind. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks.
4 ISO/IEC 2000 – All rights reserved
3.4 Extended Meanings for Generic Intrinsic Procedures
The generic intrinsic proceduresADJUSTL,ADJUSTR,CHAR,IACHAR,ICHAR,INDEX,LEN,LEN_TRIM,
LGE,LGT,LLT,LLE,REPEAT,SCAN,TRIM, andVERIFY shall have their meanings extended to include the
appropriate argument type combinations involving VARYING_STRING and CHARACTER. Detailed
descriptions of the extensions are given in this section.
3.4.1 ADJUSTL (string)
Description. Adjusts to the left, removing any leading blanks and inserting trailing blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the same asstring except that any leading blanks have been deleted and
the same number of trailing blanks inserted.
3.4.2 ADJUSTR (string)
Description. Adjusts to the right, removing any trailing blanks and inserting leading blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the same asstring except that any trailing blanks have been deleted and
the same number of leading blanks inserted.
3.4.3 CHAR (string [, length])
Description. Converts a varying string value to defaultCHARACTER.
Class. Pure transformational function.
Arguments.
string shall be scalar and of typeVARYING_STRING.
length (optional) shall be scalar and of type defaultINTEGER.
Result Characteristics. Scalar of type default CHARACTER. If length is absent, the result has the same
length asstring. Iflength is present, the result has the length specified by the argumentlength.
Result Value.
Case(i): Iflength is absent, the result is a copy of the characters in the argumentstring.
Case(ii): Iflength is present, the result is a copy of the characters in the argumentstring that may have
been truncated or padded. If string is longer than length, the result is truncated on the right. If
string is shorter thanlength, the result is padded on the right with blanks. Iflength is less than
one, the result is of zero length.
Note. This function is elemental in Fortran 95, where it has the formCHAR(i [,kind]), with
i of type integer.
ISO/IEC 2000 – All rights reserved 5
3.4.4 IACHAR (c)
Description. Returns the position of a character in the collating sequence defined by the International
Standard ISO 646 : 1991.
Class. Elemental function.
Argument.c shall be of typeVARYING_STRING and of length exactly one.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the character c in the collating sequence defined by the
International Standard ISO 646 : 1991 for default characters. If the characterc is not defined in the standard
set, the result is processor dependent but is always equal toIACHAR(CHAR(c)).
3.4.5 ICHAR (c)
Description. Returns the position of a character in the processor defined collating sequence.
Class. Elemental function.
Argument.c shall be of typeVARYING_STRING and of length exactly one.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the characterc in the processor defined collating sequence for
default characters. That is, the result value isICHAR(CHAR(c)).
3.4.6 INDEX (string, substring [, back])
Description. Returns an integer that is the starting position of a substring within a string.
Class. Elemental function.
Arguments.
string andsubstring shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
back (optional) shall be of type defaultLOGICAL.
Result Characteristics. Of type defaultINTEGER.
Result Value.
Case(i): Ifback is absent or is present with the value false, the result is the minimum positive value ofI such
that
EXTRACT(string,I,I+LEN(substring)–1)==substring,
(where EXTRACT is defined in Section 3.7) or zero if there is no such value.
Case(ii): If back is present with the value true, the result is the maximum value of I less than or equal to
LEN(string)–LEN(substring)+1 such that
EXTRACT(string,I,I+LEN(substring)–1)==substring,
or zero if there is no such value.
6 ISO/IEC 2000 – All rights reserved
TRIM (string) a, string b) a, string b)
3.4.7 LEN (string)
Description. Returns the length of a character string.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the number of characters instring.
Note. This function is not elemental forstring of typeCHARACTER.
3.4.8 LEN_TRIM (string)
Description. Returns the length of a string not counting any trailing blanks.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of type defaultINTEGER.
Result Value. The result value is the position of the last non-blank character in string. If the argument
string contains only blank characters or is of zero length, the result is zero.
3.4.9 LGE (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true if string_a is lexically greater than or equal to string_b, and is
false otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.10 LGT (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
ISO/IEC 2000 – All rights reserved 7
a, string b) a, string b)
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true if string_a is lexically greater than string_b, and is false
otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.11 LLE (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a is lexically less than or equal tostring_b, and is false
otherwise. The collating sequence used to establish the ordering of characters is that of the International
Standard ISO 646 : 1991. Ifstring_a andstring_b are of different lengths, the comparison is done as if
the shorter string were padded on the right with blanks. If either argument contains a characterc not defined
by the standard, the result value is processor dependent and based on the collating value for IACHAR(c).
Zero length strings are considered to be lexically equal.
3.4.12 LLT (string_a, string_b)
Description. Compares the lexical ordering of two strings based on the ISO 646 : 1991 collating sequence.
Class. Elemental function.
Arguments.
string_a andstring_b shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
Result Characteristics. Of type defaultLOGICAL.
Result Value. The result value is true ifstring_a is lexically less thanstring_b, and is false otherwise.
The collating sequence used to establish the ordering of characters is that of the International Standard ISO
646 : 1991. If string_a and string_b are of different lengths, the comparison is done as if the shorter
string were padded on the right with blanks. If either argument contains a character c not defined by the
standard, the result value is processor dependent and based on the collating value for IACHAR(c). Zero
8 ISO/IEC 2000 – All rights reserved
length strings are considered to be lexically equal.
3.4.13 REPEAT (string, ncopies)
Description. Concatenates several copies of a string.
Class. Elemental function.
Arguments.
string – shall be of typeVARYING_STRING,
ncopies – shall be of type defaultINTEGER.
Result Characteristics. Of typeVARYING_STRING.
Result Value. The result value is the string produced by repeated concatenation of the argument string,
producing a string containing ncopies copies of string. If the value of ncopies is not positive, the
result is of zero length.
Note. This function is not elemental forstring of typeCHARACTER.
3.4.14 SCAN (string, set [, back])
Description. Scans a string for any one of the characters in a set of characters.
Class. Elemental function.
Arguments.
string andset shall be of one of the type combinations:
VARYING_STRING andVARYING_STRING
VARYING_STRING andCHARACTER
CHARACTER andVARYING_STRING
back (optional) shall be of type defaultLOGICAL.
Result Characteristics. Of type defaultINTEGER.
Result Value.
Case(i): Ifback is absent or is present with the value false and ifstring contains at least one character that
is inset, the value of the result is the position of the left-most character ofstring that is inset.
Case(ii): Ifback is present with the value true and ifstring contains at least one character that is inset,
the value of the result is the position of the right-most character ofstring that is inset.
Case(iii): The value of the result is zero if no character of string is in set or if the length of either
string orset is zero.
3.4.15 TRIM (string)
Description. Removes trailing blanks from a string.
Class. Elemental function.
Argument.string shall be of typeVARYING_STRING.
Result Characteristics. Of typeVARYI
...
ISO/IEC 1539-2:2000は、Fortranプログラミング言語で可変長の文字列を操作するための施設を定義する規格です。これはFortran 95言語規格の補助規格として機能しますが、プロセッサがFortran 95規格に準拠するためには必ずしも実装する必要はありません。この規格では、Fortranモジュールの名前、可変長文字列を表す派生データ型の名前、この型のオブジェクトを操作するために提供される手続きと演算子のインターフェース、およびこのモジュールを通じてアクセス可能な各エンティティに必要な意味論的要件を規定しています。この規格は、実装の詳細などの実装の詳細は規定していませんが、準拠する実装は、この規格に準拠する公開可能な名前とインターフェースを持つ必要があり、意味論的要件もこの規格とISO/IEC 1539-1:1997と一致する必要があります。この規格を満たさないプロセッサは、標準準拠Fortranプロセッサではないかもしれませんが、可変長の文字列を操作する機能を実装する場合は、この規格に準拠する方法で行うことが推奨されます。ISO/IEC 1539-2に準拠するプロセッサは、この規格やISO/IEC 1539-1:1997と競合しない範囲で可変長文字列の操作のための施設を拡張することができます。この規格を説明するために、標準準拠のFortranで書かれたモジュールが参照として提供されます。このモジュールは、この規格の要件に準拠するだけでなく、標準適合性のFortranで書かれているため、必要な施設の移植可能な実装を提供するものです。このモジュールは情報提供のために参照されるものであり、実装を制約することを意図したものではありません。このモジュールは、少なくとも1つの標準準拠であり、移植可能なFortranによる実装が可能であることを示すデモンストレーションです。ISO/IEC 1539-2は、デフォルトの種類の文字の可変長文字列に対する施設を定義しています。ISO/IEC 1539-2全体で、組み込み型CHARACTERの参照はデフォルトの種類の文字と解釈されるべきです。非デフォルトの種類の文字に対しては、それぞれの文字種ごとに別個のモジュールで同様な施設を定義することができます。この規格は、Fortranで固定長の文字列に対して利用可能な施設と同様の施設を可変長の文字列に提供することを合理的に設計しており、可変長文字列のために固定長文字列の内在的な操作と関数の意味を拡張し、本質的な違いによる追加の施設を定義しています。
ISO/IEC 1539-2:2000은 Fortran 프로그래밍 언어에서 가변 길이 문자열을 조작하기 위한 시설을 정의하는 표준입니다. 이는 Fortran 95 언어 표준의 보조 표준으로 작용하지만 프로세서가 Fortran 95 표준에 부합하려면 필수적으로 구현할 필요는 없습니다. 이 표준은 Fortran 모듈의 이름, 가변 길이 문자열을 나타내는 파생 데이터 타입의 이름, 이 타입의 객체를 조작하기 위해 제공되는 절차 및 연산자의 인터페이스, 그리고 이 모듈을 통해 접근 가능한 각 개체에 대해 필요한 의미론적인 요구 사항을 정의합니다. 이 표준은 구현 세부사항인 표현 방법이나 알고리즘은 규정하지 않지만, 준수하는 구현체는 이 표준에 준하는 공개적으로 접근 가능한 이름과 인터페이스를 가져야하며, 의미론적인 요구 사항 역시 이 표준 및 ISO/IEC 1539-1:1997과 일치해야 합니다. 이 표준을 준수하지 않더라도 프로세서가 표준 준수 Fortran 프로세서인 것은 아니지만, 가변 길이 문자열을 조작하기 위한 기능을 구현하는 경우 이 표준에 준하는 방식으로 구현하는 것이 권장됩니다. ISO/IEC 1539-2에 준수하는 프로세서는 이 표준 또는 ISO/IEC 1539-1:1997과 충돌하지 않는 한 가변 길이 문자열의 조작을 위한 시설을 확장할 수 있습니다. 이 표준을 설명하기 위해 표준 준수 Fortran으로 작성된 모듈이 참조로 제공됩니다. 이 모듈은 이 표준의 요구 사항을 준수하기 때문에 포함된 정의 및 방법을 제한하기 위한 것이 아니라, 최소한 하나의 표준 준수이며 이식 가능한 Fortran을 통한 구현을 제공하는 방법을 보여주기 위한 것입니다. 이 표준은 기본 종류의 문자에 대해서만 가변 길이 문자열에 대한 시설을 정의하며, ISO/IEC 1539-2의 모든 참조는 기본 종류인 문자에 해당되는 것으로 해석되어야 합니다. 비슷한 시설을 비기본 종류 문자에 대해서도 별도의 모듈로 정의할 수 있습니다. 이 표준은 기본 고정 길이 문자열의 사용 가능한 시설과 유사한 시설을 가변 길이 문자열을 위해 제공하도록 합리적으로 설계되었으며, 가변 길이 문자열에서 고정 길이 문자열의 내재적인 연산 및 기능에 확장된 의미를 정의합니다. 또한 기본 타입과 가변 길이 파생 데이터 타입의 본질적인 차이로 인해 적절한 추가 시설이 정의됩니다.
ISO/IEC 1539-2:2000 is a standard that defines facilities in the Fortran programming language for manipulating character strings of varying length. It serves as an auxiliary standard to the Fortran 95 language standard but is not required for a processor to conform to the Fortran 95 standard. This standard specifies the name of a Fortran module, a derived data type for varying-length strings, procedures and operators for manipulating this type, and the required semantics for each entity accessible through this module. The standard does not prescribe implementation details such as representation or algorithms, but a conformant implementation should have publicly accessible names and interfaces that conform to this standard. While processors are not required to implement this standard, it is recommended that implementations for manipulating varying length character strings conform to it. Processors conforming to this standard may also extend the facilities for manipulating varying length character strings as long as the extensions do not conflict with this standard or the Fortran 95 standard. The standard provides a module written in standard conforming Fortran as a reference to illustrate one possible implementation. This module only defines facilities for default kind characters and separate modules would be needed for non-default kind characters. The standard aims to provide the same facilities for varying length character strings as are available for fixed length character strings in Fortran, extending the meanings of intrinsic operations and functions for varying length strings and defining additional facilities appropriate for this type.










Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.
Loading comments...