Lines Matching defs:io
1 //===-- runtime/descriptor-io.h ---------------------------------*- C++ -*-===//
19 #include "io-stmt.h"
29 namespace Fortran::runtime::io::descr {
31 inline RT_API_ATTRS A &ExtractElement(IoStatementState &io,
35 io.GetIoErrorHandler().Crash("Bad address for I/O item -- null base "
48 inline RT_API_ATTRS bool FormattedIntegerIO(IoStatementState &io,
56 if (auto edit{io.GetNextDataEdit()}) {
57 IntType &x{ExtractElement<IntType>(io, descriptor, subscripts)};
59 if (!EditIntegerOutput<KIND>(io, *edit, x, isSigned)) {
64 io, *edit, reinterpret_cast<void *>(&x), KIND, isSigned)) {
71 io.GetIoErrorHandler().Crash(
83 IoStatementState &io, const Descriptor &descriptor) {
90 if (auto edit{io.GetNextDataEdit()}) {
91 RawType &x{ExtractElement<RawType>(io, descriptor, subscripts)};
93 if (!RealOutputEditing<KIND>{io, x}.Edit(*edit)) {
97 if (EditRealInput<KIND>(io, *edit, reinterpret_cast<void *>(&x))) {
104 io.GetIoErrorHandler().Crash(
116 IoStatementState &io, const Descriptor &descriptor) {
121 io.get_if<ListDirectedStatementState<Direction::Output>>() != nullptr};
125 RawType *x{&ExtractElement<RawType>(io, descriptor, subscripts)};
130 rEdit.modes = iEdit.modes = io.mutableModes();
131 if (!RealOutputEditing<KIND>{io, x[0]}.Edit(rEdit) ||
132 !RealOutputEditing<KIND>{io, x[1]}.Edit(iEdit)) {
137 auto edit{io.GetNextDataEdit()};
141 if (!RealOutputEditing<KIND>{io, *x}.Edit(*edit)) {
147 io, *edit, reinterpret_cast<void *>(x))) {
155 io.GetIoErrorHandler().Crash(
164 IoStatementState &io, const Descriptor &descriptor) {
169 auto *listOutput{io.get_if<ListDirectedStatementState<Direction::Output>>()};
172 A *x{&ExtractElement<A>(io, descriptor, subscripts)};
174 if (!ListDirectedCharacterOutput(io, *listOutput, x, length)) {
177 } else if (auto edit{io.GetNextDataEdit()}) {
179 if (!EditCharacterOutput(io, *edit, x, length)) {
184 if (EditCharacterInput(io, *edit, x, length)) {
195 io.GetIoErrorHandler().Crash(
204 IoStatementState &io, const Descriptor &descriptor) {
208 auto *listOutput{io.get_if<ListDirectedStatementState<Direction::Output>>()};
212 IntType &x{ExtractElement<IntType>(io, descriptor, subscripts)};
214 if (!ListDirectedLogicalOutput(io, *listOutput, x != 0)) {
217 } else if (auto edit{io.GetNextDataEdit()}) {
219 if (!EditLogicalOutput(io, *edit, x != 0)) {
225 if (EditLogicalInput(io, *edit, truth)) {
237 io.GetIoErrorHandler().Crash(
250 static RT_API_ATTRS bool DefaultComponentIO(IoStatementState &io,
261 return DescriptorIO<DIR>(io, desc, table);
269 return DescriptorIO<DIR>(io, compDesc, table);
277 static RT_API_ATTRS bool DefaultComponentwiseFormattedIO(IoStatementState &io,
280 IoErrorHandler &handler{io.GetIoErrorHandler()};
291 io, component, descriptor, subscripts, handler, table)) {
294 io.get_if<ListDirectedStatementState<Direction::Input>>()};
303 static RT_API_ATTRS bool DefaultComponentwiseUnformattedIO(IoStatementState &io,
306 IoErrorHandler &handler{io.GetIoErrorHandler()};
322 io, component, descriptor, subscripts, handler, table)) {
335 static RT_API_ATTRS bool FormattedDerivedTypeIO(IoStatementState &io,
337 IoErrorHandler &handler{io.GetIoErrorHandler()};
376 result = DefinedFormattedIo(io, descriptor, *type, *special, subscripts);
380 io, descriptor, *type, table, subscripts);
385 io.get_if<ListDirectedStatementState<Direction::Input>>()};
398 static RT_API_ATTRS bool UnformattedDescriptorIO(IoStatementState &io,
400 IoErrorHandler &handler{io.GetIoErrorHandler()};
416 DefinedUnformattedIo(io, descriptor, *type, special)}) {
421 io, descriptor, *type, table);
431 return DefinedUnformattedIo(io, descriptor, *type, *special);
438 return DefaultComponentwiseUnformattedIO<DIR>(io, descriptor, *type, table);
441 auto *externalUnf{io.get_if<ExternalUnformattedIoStatementState<DIR>>()};
442 auto *childUnf{io.get_if<ChildUnformattedIoStatementState<DIR>>()};
444 DIR == Direction::Output ? io.get_if<InquireIOLengthState>() : nullptr};
477 char &x{ExtractElement<char>(io, descriptor, subscripts)};
481 char &x{ExtractElement<char>(io, descriptor, subscripts)};
496 static RT_API_ATTRS bool DescriptorIO(IoStatementState &io,
498 IoErrorHandler &handler{io.GetIoErrorHandler()};
502 if (!io.get_if<IoDirectionState<DIR>>()) {
507 if (!io.BeginReadingRecord()) {
511 if (!io.get_if<FormattedIoStatementState<DIR>>()) {
512 return UnformattedDescriptorIO<DIR>(io, descriptor, table);
521 return FormattedIntegerIO<1, DIR>(io, descriptor, true);
523 return FormattedIntegerIO<2, DIR>(io, descriptor, true);
525 return FormattedIntegerIO<4, DIR>(io, descriptor, true);
527 return FormattedIntegerIO<8, DIR>(io, descriptor, true);
529 return FormattedIntegerIO<16, DIR>(io, descriptor, true);
538 return FormattedIntegerIO<1, DIR>(io, descriptor, false);
540 return FormattedIntegerIO<2, DIR>(io, descriptor, false);
542 return FormattedIntegerIO<4, DIR>(io, descriptor, false);
544 return FormattedIntegerIO<8, DIR>(io, descriptor, false);
546 return FormattedIntegerIO<16, DIR>(io, descriptor, false);
555 return FormattedRealIO<2, DIR>(io, descriptor);
557 return FormattedRealIO<3, DIR>(io, descriptor);
559 return FormattedRealIO<4, DIR>(io, descriptor);
561 return FormattedRealIO<8, DIR>(io, descriptor);
563 return FormattedRealIO<10, DIR>(io, descriptor);
566 return FormattedRealIO<16, DIR>(io, descriptor);
575 return FormattedComplexIO<2, DIR>(io, descriptor);
577 return FormattedComplexIO<3, DIR>(io, descriptor);
579 return FormattedComplexIO<4, DIR>(io, descriptor);
581 return FormattedComplexIO<8, DIR>(io, descriptor);
583 return FormattedComplexIO<10, DIR>(io, descriptor);
586 return FormattedComplexIO<16, DIR>(io, descriptor);
595 return FormattedCharacterIO<char, DIR>(io, descriptor);
597 return FormattedCharacterIO<char16_t, DIR>(io, descriptor);
599 return FormattedCharacterIO<char32_t, DIR>(io, descriptor);
608 return FormattedLogicalIO<1, DIR>(io, descriptor);
610 return FormattedLogicalIO<2, DIR>(io, descriptor);
612 return FormattedLogicalIO<4, DIR>(io, descriptor);
614 return FormattedLogicalIO<8, DIR>(io, descriptor);
621 return FormattedDerivedTypeIO<DIR>(io, descriptor, table);
628 } // namespace Fortran::runtime::io::descr