[flang-commits] [PATCH] D129679: [flang][runtime] Complete list-directed character input with DECIMAL='COMMA'
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Jul 13 11:48:57 PDT 2022
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
Most of the infrastructure for DECIMAL='COMMA' mode was in place
in the I/O runtime support library, but I dropped the ball for
list-directed character input, which has its own detection of
input separators. Finish the job.
https://reviews.llvm.org/D129679
Files:
flang/runtime/edit-input.cpp
flang/runtime/io-stmt.cpp
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -630,7 +630,6 @@
switch (*next) {
case ' ':
case '\t':
- case ';':
case '/':
case '(':
case ')':
@@ -640,11 +639,15 @@
case '\n': // for stream access
return std::nullopt;
case ',':
+ if (!(edit.modes.editingFlags & decimalComma)) {
+ return std::nullopt;
+ }
+ break;
+ case ';':
if (edit.modes.editingFlags & decimalComma) {
- break;
- } else {
return std::nullopt;
}
+ break;
default:
break;
}
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -654,15 +654,25 @@
// in NextInField.
std::optional<int> remaining{length > 0 ? maxUTF8Bytes : 0};
while (std::optional<char32_t> next{io.NextInField(remaining, edit)}) {
+ bool isSep{false};
switch (*next) {
case ' ':
case '\t':
+ case '/':
+ isSep = true;
+ break;
case ',':
+ isSep = !(edit.modes.editingFlags & decimalComma);
+ break;
case ';':
- case '/':
- remaining = 0; // value separator: stop
+ isSep = !!(edit.modes.editingFlags & decimalComma);
break;
default:
+ break;
+ }
+ if (isSep) {
+ remaining = 0;
+ } else {
*x++ = *next;
remaining = --length > 0 ? maxUTF8Bytes : 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129679.444362.patch
Type: text/x-patch
Size: 1675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220713/16963e7f/attachment.bin>
More information about the flang-commits
mailing list