[flang-commits] [PATCH] D83098: [flang] External I/O runtime work, repackaged (part 1)
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Jul 2 15:41:45 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37f98f6f4c85: [flang] External I/O runtime work, repackaged (part 1) (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83098/new/
https://reviews.llvm.org/D83098
Files:
flang/runtime/connection.h
flang/runtime/internal-unit.cpp
Index: flang/runtime/internal-unit.cpp
===================================================================
--- flang/runtime/internal-unit.cpp
+++ flang/runtime/internal-unit.cpp
@@ -17,6 +17,7 @@
template <Direction DIR>
InternalDescriptorUnit<DIR>::InternalDescriptorUnit(
Scalar scalar, std::size_t length) {
+ isFixedRecordLength = true;
recordLength = length;
endfileRecordNumber = 2;
void *pointer{reinterpret_cast<void *>(const_cast<char *>(scalar))};
@@ -33,6 +34,7 @@
terminator, that.SizeInBytes() <= d.SizeInBytes(maxRank, true, 0));
new (&d) Descriptor{that};
d.Check();
+ isFixedRecordLength = true;
recordLength = d.ElementBytes();
endfileRecordNumber = d.Elements() + 1;
}
@@ -123,8 +125,7 @@
}
}
++currentRecordNumber;
- positionInRecord = 0;
- furthestPositionInRecord = 0;
+ BeginRecord();
return true;
}
@@ -132,8 +133,7 @@
void InternalDescriptorUnit<DIR>::BackspaceRecord(IoErrorHandler &handler) {
RUNTIME_CHECK(handler, currentRecordNumber > 1);
--currentRecordNumber;
- positionInRecord = 0;
- furthestPositionInRecord = 0;
+ BeginRecord();
}
template class InternalDescriptorUnit<Direction::Output>;
Index: flang/runtime/connection.h
===================================================================
--- flang/runtime/connection.h
+++ flang/runtime/connection.h
@@ -26,9 +26,10 @@
// established in an OPEN statement.
struct ConnectionAttributes {
Access access{Access::Sequential}; // ACCESS='SEQUENTIAL', 'DIRECT', 'STREAM'
- std::optional<std::int64_t> recordLength; // RECL= when fixed-length
bool isUnformatted{false}; // FORM='UNFORMATTED'
bool isUTF8{false}; // ENCODING='UTF-8'
+ bool isFixedRecordLength{false}; // RECL= on OPEN
+ std::optional<std::int64_t> recordLength; // RECL= or current record
};
struct ConnectionState : public ConnectionAttributes {
@@ -37,6 +38,12 @@
void HandleAbsolutePosition(std::int64_t);
void HandleRelativePosition(std::int64_t);
+ void BeginRecord() {
+ positionInRecord = 0;
+ furthestPositionInRecord = 0;
+ leftTabLimit.reset();
+ }
+
// Positions in a record file (sequential or direct, not stream)
std::int64_t currentRecordNumber{1}; // 1 is first
std::int64_t positionInRecord{0}; // offset in current record
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83098.275252.patch
Type: text/x-patch
Size: 2304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200702/72f3558a/attachment.bin>
More information about the flang-commits
mailing list