Lines Matching defs:io
1 //===-- runtime/io-api.cpp ------------------------------------------------===//
11 // template function BeginExternalListIo<> is in runtime/io-api-common.h.
14 // are in runtime/io-api-minimal.cpp.
16 #include "flang/Runtime/io-api.h"
17 #include "descriptor-io.h"
22 #include "io-api-common.h"
23 #include "io-stmt.h"
33 namespace Fortran::runtime::io {
264 IoStatementState &io{
272 io.Emit("\0\0\0\0", 4); // placeholder for record length header
275 return &io;
530 IoStatementState &io{*cookie};
531 IoErrorHandler &handler{io.GetIoErrorHandler()};
533 if (nonAdvancing && io.GetConnectionState().access == Access::Direct) {
536 auto *unit{io.GetExternalFileUnit()};
540 io.mutableModes().nonAdvancing = nonAdvancing;
547 IoStatementState &io{*cookie};
551 io.mutableModes().editingFlags &= ~blankZero;
554 io.mutableModes().editingFlags |= blankZero;
557 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
564 IoStatementState &io{*cookie};
568 io.mutableModes().editingFlags |= decimalComma;
571 io.mutableModes().editingFlags &= ~decimalComma;
574 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
581 IoStatementState &io{*cookie};
585 io.mutableModes().delim = '\'';
588 io.mutableModes().delim = '"';
591 io.mutableModes().delim = '\0';
594 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
601 IoStatementState &io{*cookie};
602 IoErrorHandler &handler{io.GetIoErrorHandler()};
603 io.mutableModes().pad = YesOrNo(keyword, length, "PAD", handler);
608 IoStatementState &io{*cookie};
609 IoErrorHandler &handler{io.GetIoErrorHandler()};
610 if (auto *unit{io.GetExternalFileUnit()}) {
612 } else if (!io.get_if<ErroneousIoStatementState>()) {
619 IoStatementState &io{*cookie};
620 IoErrorHandler &handler{io.GetIoErrorHandler()};
621 if (auto *unit{io.GetExternalFileUnit()}) {
629 } else if (!io.get_if<ErroneousIoStatementState>()) {
636 IoStatementState &io{*cookie};
641 io.mutableModes().round = decimal::RoundUp;
644 io.mutableModes().round = decimal::RoundDown;
647 io.mutableModes().round = decimal::RoundToZero;
650 io.mutableModes().round = decimal::RoundNearest;
653 io.mutableModes().round = decimal::RoundCompatible;
656 io.mutableModes().round = executionEnvironment.defaultOutputRoundingMode;
659 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
666 IoStatementState &io{*cookie};
671 io.mutableModes().editingFlags |= signPlus;
675 io.mutableModes().editingFlags &= ~signPlus;
678 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
685 IoStatementState &io{*cookie};
686 auto *open{io.get_if<OpenStatementState>()};
688 if (!io.get_if<NoopStatementState>() &&
689 !io.get_if<ErroneousIoStatementState>()) {
690 io.GetIoErrorHandler().Crash(
695 io.GetIoErrorHandler().Crash(
721 IoStatementState &io{*cookie};
722 auto *open{io.get_if<OpenStatementState>()};
724 if (!io.get_if<NoopStatementState>() &&
725 !io.get_if<ErroneousIoStatementState>()) {
726 io.GetIoErrorHandler().Crash(
731 io.GetIoErrorHandler().Crash(
751 RUNTIME_CHECK(io.GetIoErrorHandler(), action.has_value());
764 IoStatementState &io{*cookie};
765 IoErrorHandler &handler{io.GetIoErrorHandler()};
767 if (auto *open{io.get_if<OpenStatementState>()}) {
775 } else if (auto *ext{io.get_if<ExternalIoStatementBase>()}) {
781 } else if (!io.get_if<NoopStatementState>() &&
782 !io.get_if<ErroneousIoStatementState>()) {
791 IoStatementState &io{*cookie};
792 auto *open{io.get_if<OpenStatementState>()};
794 if (!io.get_if<NoopStatementState>() &&
795 !io.get_if<ErroneousIoStatementState>()) {
796 io.GetIoErrorHandler().Crash(
801 io.GetIoErrorHandler().Crash(
822 IoStatementState &io{*cookie};
823 auto *open{io.get_if<OpenStatementState>()};
825 if (!io.get_if<NoopStatementState>() &&
826 !io.get_if<ErroneousIoStatementState>()) {
827 io.GetIoErrorHandler().Crash(
832 io.GetIoErrorHandler().Crash(
847 IoStatementState &io{*cookie};
848 auto *open{io.get_if<OpenStatementState>()};
850 if (!io.get_if<NoopStatementState>() &&
851 !io.get_if<ErroneousIoStatementState>()) {
852 io.GetIoErrorHandler().Crash(
857 io.GetIoErrorHandler().Crash(
878 IoStatementState &io{*cookie};
879 auto *open{io.get_if<OpenStatementState>()};
881 if (!io.get_if<NoopStatementState>() &&
882 !io.get_if<ErroneousIoStatementState>()) {
883 io.GetIoErrorHandler().Crash(
887 io.GetIoErrorHandler().Crash(
907 IoStatementState &io{*cookie};
908 auto *open{io.get_if<OpenStatementState>()};
910 if (!io.get_if<NoopStatementState>() &&
911 !io.get_if<ErroneousIoStatementState>()) {
912 io.GetIoErrorHandler().Crash(
917 io.GetIoErrorHandler().Crash(
932 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
939 IoStatementState &io{*cookie};
940 auto *open{io.get_if<OpenStatementState>()};
942 if (!io.get_if<NoopStatementState>() &&
943 !io.get_if<ErroneousIoStatementState>()) {
944 io.GetIoErrorHandler().Crash(
949 io.GetIoErrorHandler().Crash(
953 io.GetIoErrorHandler().SignalError("RECL= must be greater than zero");
966 IoStatementState &io{*cookie};
967 if (auto *open{io.get_if<OpenStatementState>()}) {
969 io.GetIoErrorHandler().Crash(
991 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
996 if (auto *close{io.get_if<CloseStatementState>()}) {
1006 io.GetIoErrorHandler().SignalError(IostatErrorInKeyword,
1011 if (io.get_if<NoopStatementState>() ||
1012 io.get_if<ErroneousIoStatementState>()) {
1015 io.GetIoErrorHandler().Crash(
1020 IoStatementState &io{*cookie};
1021 if (auto *open{io.get_if<OpenStatementState>()}) {
1023 io.GetIoErrorHandler().Crash(
1028 } else if (!io.get_if<NoopStatementState>() &&
1029 !io.get_if<ErroneousIoStatementState>()) {
1030 io.GetIoErrorHandler().Crash(
1037 IoStatementState &io{*cookie};
1038 auto *open{io.get_if<OpenStatementState>()};
1040 if (!io.get_if<NoopStatementState>() &&
1041 !io.get_if<ErroneousIoStatementState>()) {
1042 io.GetIoErrorHandler().Crash(
1174 IoStatementState &io{*cookie};
1175 IoErrorHandler &handler{io.GetIoErrorHandler()};
1177 io.CompleteOperation();
1180 io.get_if<FormattedIoStatementState<Direction::Input>>()}) {
1182 } else if (!io.get_if<NoopStatementState>() &&
1183 !io.get_if<ErroneousIoStatementState>()) {
1191 IoStatementState &io{*cookie};
1192 IoErrorHandler &handler{io.GetIoErrorHandler()};
1194 io.CompleteOperation();
1196 if (const auto *inq{io.get_if<InquireIOLengthState>()}) {
1198 } else if (!io.get_if<NoopStatementState>() &&
1199 !io.get_if<ErroneousIoStatementState>()) {
1207 IoStatementState &io{*cookie};
1208 IoErrorHandler &handler{io.GetIoErrorHandler()};
1210 io.CompleteOperation();
1218 IoStatementState &io{*cookie};
1219 IoErrorHandler &handler{io.GetIoErrorHandler()};
1220 if (auto *ext{io.get_if<ExternalIoStatementBase>()}) {
1222 } else if (!io.get_if<NoopStatementState>() &&
1223 !io.get_if<ErroneousIoStatementState>()) {
1232 IoStatementState &io{*cookie};
1233 return io.Inquire(inquiry, result, length);
1238 IoStatementState &io{*cookie};
1239 return io.Inquire(inquiry, result);
1243 IoStatementState &io{*cookie};
1244 return io.Inquire(HashInquiryKeyword("PENDING"), id, result);
1249 IoStatementState &io{*cookie};
1251 if (io.Inquire(inquiry, n)) {
1255 io.GetIoErrorHandler().SignalError(
1315 } // namespace Fortran::runtime::io