[all-commits] [llvm/llvm-project] b8452d: [flang] Support NAMELIST input of short arrays

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Oct 22 13:38:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8452dba28e7449d0b1e47b5341ddf0bef55be68
      https://github.com/llvm/llvm-project/commit/b8452dba28e7449d0b1e47b5341ddf0bef55be68
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-10-22 (Fri, 22 Oct 2021)

  Changed paths:
    M flang/runtime/connection.h
    M flang/runtime/descriptor-io.h
    M flang/runtime/edit-input.cpp
    M flang/runtime/format.h
    M flang/runtime/io-stmt.h
    M flang/runtime/namelist.cpp
    M flang/runtime/namelist.h
    M flang/unittests/Runtime/Namelist.cpp

  Log Message:
  -----------
  [flang] Support NAMELIST input of short arrays

NAMELIST array input does not need to fully define an array.
If another input item begins after at least one element,
it ends input into the array and the remaining items are
not modified.

The tricky part of supporting this feature is that it's not
always easy to determine whether the next non-blank thing in
the input is a value or the next item's name, esp. in the case
of logical data where T and F can be names.  E.g.,

  &group logicalArray = t f f t
      = 1 /

should read three elements into "logicalArray" and then read
an integer or real variable named "t".

So the I/O runtime has to do some look-ahead to determine whether
the next thing in the input is a name followed by '=', '(', or '%'.
Since the '=' may be on a later record, possibly with intervening
NAMELIST comments, the runtime has to support a general form of
saving and restoring its current position.  The infrastructure
in the I/O runtime already has to support repositioning for
list-directed repetition, even on non-positionable input sources
like terminals and sockets; this patch adds an internal RAII API
to make it easier to save a position and then do arbitrary
look-ahead.

Differential Revision: https://reviews.llvm.org/D112245




More information about the All-commits mailing list