// 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 {
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
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))};
terminator, that.SizeInBytes() <= d.SizeInBytes(maxRank, true, 0));
new (&d) Descriptor{that};
d.Check();
+ isFixedRecordLength = true;
recordLength = d.ElementBytes();
endfileRecordNumber = d.Elements() + 1;
}
}
}
++currentRecordNumber;
- positionInRecord = 0;
- furthestPositionInRecord = 0;
+ BeginRecord();
return true;
}
void InternalDescriptorUnit<DIR>::BackspaceRecord(IoErrorHandler &handler) {
RUNTIME_CHECK(handler, currentRecordNumber > 1);
--currentRecordNumber;
- positionInRecord = 0;
- furthestPositionInRecord = 0;
+ BeginRecord();
}
template class InternalDescriptorUnit<Direction::Output>;