1 //===-- runtime/iostat.cpp ------------------------------------------------===// 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 "flang/Runtime/iostat.h" 10 11 namespace Fortran::runtime::io { IostatErrorString(int iostat)12const 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 case IostatEndfileNonSequential: 37 return "ENDFILE on non-sequential file"; 38 case IostatEndfileUnwritable: 39 return "ENDFILE on read-only file"; 40 case IostatOpenBadRecl: 41 return "OPEN with bad RECL= value"; 42 case IostatOpenUnknownSize: 43 return "OPEN of file of unknown size"; 44 case IostatOpenBadAppend: 45 return "OPEN(POSITION='APPEND') of unpositionable file"; 46 case IostatWriteToReadOnly: 47 return "Attempted output to read-only file"; 48 case IostatReadFromWriteOnly: 49 return "Attempted input from write-only file"; 50 case IostatBackspaceNonSequential: 51 return "BACKSPACE on non-sequential file"; 52 case IostatBackspaceAtFirstRecord: 53 return "BACKSPACE at first record"; 54 case IostatRewindNonSequential: 55 return "REWIND on non-sequential file"; 56 default: 57 return nullptr; 58 } 59 } 60 61 } // namespace Fortran::runtime::io 62