Commit graph

7 commits

Author SHA1 Message Date
Peter Klausler bafbae238a [flang] Initial UTF-8 support in runtime I/O
Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8').  This encoding applies to default
CHARACTER values that are not 7-bit ASCII as well as to
the wide CHARACTER kinds 2 and 4.  Basic testing is in place
via direct calls to the runtime I/O APIs, but serious checkout
awaits lowering support of the wide CHARACTER kinds.

Differential Revision: https://reviews.llvm.org/D122038
2022-03-22 11:48:14 -07:00
Peter Klausler d1b09adeeb [flang] Fix rounding edge case in F output editing
When an Fw.d output edit descriptor has a "d" value exactly
equal to the number of zeroes after the decimal point for a value
(e.g., 0.07 with F5.1), the Fw.d output editing code needs to
do the rounding itself to either 0.0 or 0.1 after performing
a conversion without rounding (to avoid 0.04999 rounding up twice).

Differential Revision: https://reviews.llvm.org/D113698
2021-11-12 11:16:25 -08:00
peter klausler f65f830e5f [flang] runtime: fix output B/O/Z editing of "negative" values
B/O/Z integer output editing must not reflect any sign extension
of scalar output values.  Add more size-dependent OutputInteger
I/O APIs and kind instantiations of EditIntegerOutput.

Differential Revision: https://reviews.llvm.org/D111678
2021-10-12 16:02:07 -07:00
peter klausler d56fdc8e95 [flang][msvc] Avoid dependence on long double
MSVC does not support a distinct 80-bit extended precision
"long double" type.  Rework the I/O runtime to avoid using
native C/C++ type names.  Centralize the mappings between
the KIND= type parameters of REAL and their binary precisions
in the common real.h header file, and use KIND type parameter
values rather than binary precisions for clarity where
appropriate.

This patch, if successful, should obviate the need for
Differential review D88511.

(This patch anticipates a successful review of D88688, which
fixes the function that maps each kind of real to its maximum
number of significant decimal digits.)

Differential revision: https://reviews.llvm.org/D88752
2020-10-07 15:12:08 -07:00
peter klausler 0df6f8fe8e [flang] Fix F5.3 formatting of 0.025
Fix F output editing in the Fortran runtime so that it
respects the 'd' count of digits after the decimal mark.

Reviewed By: tskeith

Differential Revision: https://reviews.llvm.org/D82242
2020-06-19 18:09:10 -07:00
Tim Keith 1f8790050b [flang] Reformat with latest clang-format and .clang-format
Original-commit: flang-compiler/f18@9fe84f45d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/1094
2020-03-28 21:00:16 -07:00
peter klausler 3b63571425 [flang] Use hash table for UnitMap, avoid C++ STL binary dependence
Scan FORMAT strings locally to avoid C++ binary runtime dependence when computing deepest parenthesis nesting

Remove a dependency on ostream from runtime

Remove remaining direct external references from runtime to C++ library binaries

Remove runtime dependences on lib/common

SetPos() and SetRec()

Instantiate templates for input

Begin input; rearrange locking, deal with CLOSE races

View()

Update error message in test to agree with compiler change

First cut at real input

More robust I/O runtime error handling

Debugging of REAL input

Add iostat.{h,cpp}

Rename runtime/numeric-* to runtime/edit-*

Move templates around, templatize integer output editing

Move LOGICAL and CHARACTER output from io-api.cpp to edit-output.cpp

Change pointer argument to reference

More list-directed input

Complex list-directed input

Use enum class Direction rather than bool for templates

Catch up with changes to master

Undo reformatting of Lower code

Use record number instead of subscripts for internal unit

Unformatted sequential backspace

Testing and debugging

Dodge bogus GCC warning

Add <cstddef> for std::size_t to fix CI build

Address review comments

Original-commit: flang-compiler/f18@50406b3496
Reviewed-on: https://github.com/flang-compiler/f18/pull/1053
2020-03-11 13:23:39 -07:00