1 //===-- runtime/namelist.h --------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // Defines the data structure used for NAMELIST I/O
10 
11 #ifndef FORTRAN_RUNTIME_NAMELIST_H_
12 #define FORTRAN_RUNTIME_NAMELIST_H_
13 
14 #include <cstddef>
15 
16 namespace Fortran::runtime {
17 class Descriptor;
18 } // namespace Fortran::runtime
19 
20 namespace Fortran::runtime::io {
21 
22 // A NAMELIST group is a named ordered collection of distinct variable names.
23 // It is packaged by lowering into an instance of this class.
24 // If all the items are variables with fixed addresses, the NAMELIST group
25 // description can be in a read-only section.
26 class NamelistGroup {
27 public:
28   struct Item {
29     const char *name; // NUL-terminated lower-case
30     const Descriptor &descriptor;
31   };
32   const char *groupName; // NUL-terminated lower-case
33   std::size_t items;
34   const Item *item; // in original declaration order
35 };
36 } // namespace Fortran::runtime::io
37 #endif // FORTRAN_RUNTIME_NAMELIST_H_
38