xref: /llvm-project/flang/runtime/format.cpp (revision 1f8790050b0e99e7b46cc69518aa84f46f50738e)
1 //===-- runtime/format.cpp --------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "format-implementation.h"
10 
11 namespace Fortran::runtime::io {
12 
13 DataEdit DefaultFormatControlCallbacks::GetNextDataEdit(int) {
14   Crash("DefaultFormatControlCallbacks::GetNextDataEdit() called for "
15         "non-formatted I/O statement");
16   return {};
17 }
18 bool DefaultFormatControlCallbacks::Emit(const char *, std::size_t) {
19   Crash("DefaultFormatControlCallbacks::Emit(char) called for non-output I/O "
20         "statement");
21   return {};
22 }
23 bool DefaultFormatControlCallbacks::Emit(const char16_t *, std::size_t) {
24   Crash("DefaultFormatControlCallbacks::Emit(char16_t) called for non-output "
25         "I/O statement");
26   return {};
27 }
28 bool DefaultFormatControlCallbacks::Emit(const char32_t *, std::size_t) {
29   Crash("DefaultFormatControlCallbacks::Emit(char32_t) called for non-output "
30         "I/O statement");
31   return {};
32 }
33 std::optional<char32_t> DefaultFormatControlCallbacks::GetCurrentChar() {
34   Crash("DefaultFormatControlCallbacks::GetCurrentChar() called for non-input "
35         "I/O "
36         "statement");
37   return {};
38 }
39 bool DefaultFormatControlCallbacks::AdvanceRecord(int) {
40   Crash("DefaultFormatControlCallbacks::AdvanceRecord() called unexpectedly");
41   return {};
42 }
43 void DefaultFormatControlCallbacks::BackspaceRecord() {
44   Crash("DefaultFormatControlCallbacks::BackspaceRecord() called unexpectedly");
45 }
46 void DefaultFormatControlCallbacks::HandleAbsolutePosition(std::int64_t) {
47   Crash("DefaultFormatControlCallbacks::HandleAbsolutePosition() called for "
48         "non-formatted I/O statement");
49 }
50 void DefaultFormatControlCallbacks::HandleRelativePosition(std::int64_t) {
51   Crash("DefaultFormatControlCallbacks::HandleRelativePosition() called for "
52         "non-formatted I/O statement");
53 }
54 
55 template class FormatControl<
56     InternalFormattedIoStatementState<Direction::Output>>;
57 template class FormatControl<
58     InternalFormattedIoStatementState<Direction::Input>>;
59 template class FormatControl<
60     ExternalFormattedIoStatementState<Direction::Output>>;
61 template class FormatControl<
62     ExternalFormattedIoStatementState<Direction::Input>>;
63 } // namespace Fortran::runtime::io
64