1 //===-- runtime/iostat.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 "iostat.h" 10 11 namespace Fortran::runtime::io { 12 const char *IostatErrorString(int iostat) { 13 switch (iostat) { 14 case IostatOk: 15 return "No error"; 16 case IostatEnd: 17 return "End of file during input"; 18 case IostatEor: 19 return "End of record during non-advancing input"; 20 case IostatUnflushable: 21 return "FLUSH not possible"; 22 case IostatInquireInternalUnit: 23 return "INQUIRE on internal unit"; 24 case IostatGenericError: 25 return "I/O error"; // dummy value, there's always a message 26 case IostatRecordWriteOverrun: 27 return "Excessive output to fixed-size record"; 28 case IostatRecordReadOverrun: 29 return "Excessive input from fixed-size record"; 30 case IostatInternalWriteOverrun: 31 return "Internal write overran available records"; 32 case IostatErrorInFormat: 33 return "Invalid FORMAT"; 34 case IostatErrorInKeyword: 35 return "Bad keyword argument value"; 36 default: 37 return nullptr; 38 } 39 } 40 41 } // namespace Fortran::runtime::io 42