1 //===-- runtime/namelist.h --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Defines the data structure used for NAMELIST I/O
11 #ifndef FORTRAN_RUNTIME_NAMELIST_H_
12 #define FORTRAN_RUNTIME_NAMELIST_H_
14 #include "non-tbp-dio.h"
18 namespace Fortran::runtime
{
20 class IoStatementState
;
21 } // namespace Fortran::runtime
23 namespace Fortran::runtime::io
{
25 // A NAMELIST group is a named ordered collection of distinct variable names.
26 // It is packaged by lowering into an instance of this class.
27 // If all the items are variables with fixed addresses, the NAMELIST group
28 // description can be in a read-only section.
32 const char *name
; // NUL-terminated lower-case
33 const Descriptor
&descriptor
;
35 const char *groupName
{nullptr}; // NUL-terminated lower-case
37 const Item
*item
{nullptr}; // in original declaration order
39 // When the uses of a namelist group appear in scopes with distinct sets
40 // of non-type-bound defined formatted I/O interfaces, they require the
41 // use of distinct NamelistGroups pointing to distinct NonTbpDefinedIoTables.
42 // Multiple NamelistGroup instances may share a NonTbpDefinedIoTable..
43 const NonTbpDefinedIoTable
*nonTbpDefinedIo
{nullptr};
46 // Look ahead on input for a '/' or an identifier followed by a '=', '(', or '%'
47 // character; for use in disambiguating a name-like value (e.g. F or T) from a
48 // NAMELIST group item name and for coping with short arrays. Always false
49 // when not reading a NAMELIST.
50 bool IsNamelistNameOrSlash(IoStatementState
&);
52 } // namespace Fortran::runtime::io
53 #endif // FORTRAN_RUNTIME_NAMELIST_H_