1 //===-- runtime/edit-output.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 "edit-output.h" 10 #include "utf.h" 11 #include "flang/Common/uint128.h" 12 #include <algorithm> 13 14 namespace Fortran::runtime::io { 15 16 template <int KIND> 17 bool EditIntegerOutput(IoStatementState &io, const DataEdit &edit, 18 common::HostSignedIntType<8 * KIND> n) { 19 char buffer[130], *end{&buffer[sizeof buffer]}, *p{end}; 20 bool isNegative{n < 0}; 21 using Unsigned = common::HostUnsignedIntType<8 * KIND>; 22 Unsigned un{static_cast<Unsigned>(n)}; 23 int signChars{0}; 24 switch (edit.descriptor) { 25 case DataEdit::ListDirected: 26 case 'G': 27 case 'I': 28 if (isNegative) { 29 un = -un; 30 } 31 if (isNegative || (edit.modes.editingFlags & signPlus)) { 32 signChars = 1; // '-' or '+' 33 } 34 while (un > 0) { 35 auto quotient{un / 10u}; 36 *--p = '0' + static_cast<int>(un - Unsigned{10} * quotient); 37 un = quotient; 38 } 39 break; 40 case 'B': 41 for (; un > 0; un >>= 1) { 42 *--p = '0' + (static_cast<int>(un) & 1); 43 } 44 break; 45 case 'O': 46 for (; un > 0; un >>= 3) { 47 *--p = '0' + (static_cast<int>(un) & 7); 48 } 49 break; 50 case 'Z': 51 for (; un > 0; un >>= 4) { 52 int digit = static_cast<int>(un) & 0xf; 53 *--p = digit >= 10 ? 'A' + (digit - 10) : '0' + digit; 54 } 55 break; 56 case 'A': // legacy extension 57 return EditCharacterOutput( 58 io, edit, reinterpret_cast<char *>(&n), sizeof n); 59 default: 60 io.GetIoErrorHandler().Crash( 61 "Data edit descriptor '%c' may not be used with an INTEGER data item", 62 edit.descriptor); 63 return false; 64 } 65 66 int digits = end - p; 67 int leadingZeroes{0}; 68 int editWidth{edit.width.value_or(0)}; 69 if (edit.digits && digits <= *edit.digits) { // Iw.m 70 if (*edit.digits == 0 && n == 0) { 71 // Iw.0 with zero value: output field must be blank. For I0.0 72 // and a zero value, emit one blank character. 73 signChars = 0; // in case of SP 74 editWidth = std::max(1, editWidth); 75 } else { 76 leadingZeroes = *edit.digits - digits; 77 } 78 } else if (n == 0) { 79 leadingZeroes = 1; 80 } 81 int subTotal{signChars + leadingZeroes + digits}; 82 int leadingSpaces{std::max(0, editWidth - subTotal)}; 83 if (editWidth > 0 && leadingSpaces + subTotal > editWidth) { 84 return io.EmitRepeated('*', editWidth); 85 } 86 if (edit.IsListDirected()) { 87 int total{std::max(leadingSpaces, 1) + subTotal}; 88 if (io.GetConnectionState().NeedAdvance(static_cast<std::size_t>(total)) && 89 !io.AdvanceRecord()) { 90 return false; 91 } 92 leadingSpaces = 1; 93 } 94 return io.EmitRepeated(' ', leadingSpaces) && 95 io.Emit(n < 0 ? "-" : "+", signChars) && 96 io.EmitRepeated('0', leadingZeroes) && io.Emit(p, digits); 97 } 98 99 // Formats the exponent (see table 13.1 for all the cases) 100 const char *RealOutputEditingBase::FormatExponent( 101 int expo, const DataEdit &edit, int &length) { 102 char *eEnd{&exponent_[sizeof exponent_]}; 103 char *exponent{eEnd}; 104 for (unsigned e{static_cast<unsigned>(std::abs(expo))}; e > 0;) { 105 unsigned quotient{e / 10u}; 106 *--exponent = '0' + e - 10 * quotient; 107 e = quotient; 108 } 109 if (edit.expoDigits) { 110 if (int ed{*edit.expoDigits}) { // Ew.dEe with e > 0 111 while (exponent > exponent_ + 2 /*E+*/ && exponent + ed > eEnd) { 112 *--exponent = '0'; 113 } 114 } else if (exponent == eEnd) { 115 *--exponent = '0'; // Ew.dE0 with zero-valued exponent 116 } 117 } else { // ensure at least two exponent digits 118 while (exponent + 2 > eEnd) { 119 *--exponent = '0'; 120 } 121 } 122 *--exponent = expo < 0 ? '-' : '+'; 123 if (edit.expoDigits || edit.IsListDirected() || exponent + 3 == eEnd) { 124 *--exponent = edit.descriptor == 'D' ? 'D' : 'E'; // not 'G' 125 } 126 length = eEnd - exponent; 127 return exponent; 128 } 129 130 bool RealOutputEditingBase::EmitPrefix( 131 const DataEdit &edit, std::size_t length, std::size_t width) { 132 if (edit.IsListDirected()) { 133 int prefixLength{edit.descriptor == DataEdit::ListDirectedRealPart ? 2 134 : edit.descriptor == DataEdit::ListDirectedImaginaryPart ? 0 135 : 1}; 136 int suffixLength{edit.descriptor == DataEdit::ListDirectedRealPart || 137 edit.descriptor == DataEdit::ListDirectedImaginaryPart 138 ? 1 139 : 0}; 140 length += prefixLength + suffixLength; 141 ConnectionState &connection{io_.GetConnectionState()}; 142 return (!connection.NeedAdvance(length) || io_.AdvanceRecord()) && 143 io_.Emit(" (", prefixLength); 144 } else if (width > length) { 145 return io_.EmitRepeated(' ', width - length); 146 } else { 147 return true; 148 } 149 } 150 151 bool RealOutputEditingBase::EmitSuffix(const DataEdit &edit) { 152 if (edit.descriptor == DataEdit::ListDirectedRealPart) { 153 return io_.Emit(edit.modes.editingFlags & decimalComma ? ";" : ",", 1); 154 } else if (edit.descriptor == DataEdit::ListDirectedImaginaryPart) { 155 return io_.Emit(")", 1); 156 } else { 157 return true; 158 } 159 } 160 161 template <int binaryPrecision> 162 decimal::ConversionToDecimalResult RealOutputEditing<binaryPrecision>::Convert( 163 int significantDigits, enum decimal::FortranRounding rounding, int flags) { 164 auto converted{decimal::ConvertToDecimal<binaryPrecision>(buffer_, 165 sizeof buffer_, static_cast<enum decimal::DecimalConversionFlags>(flags), 166 significantDigits, rounding, x_)}; 167 if (!converted.str) { // overflow 168 io_.GetIoErrorHandler().Crash( 169 "RealOutputEditing::Convert : buffer size %zd was insufficient", 170 sizeof buffer_); 171 } 172 return converted; 173 } 174 175 // 13.7.2.3.3 in F'2018 176 template <int binaryPrecision> 177 bool RealOutputEditing<binaryPrecision>::EditEorDOutput(const DataEdit &edit) { 178 int editDigits{edit.digits.value_or(0)}; // 'd' field 179 int editWidth{edit.width.value_or(0)}; // 'w' field 180 int significantDigits{editDigits}; 181 int flags{0}; 182 if (edit.modes.editingFlags & signPlus) { 183 flags |= decimal::AlwaysSign; 184 } 185 if (editWidth == 0) { // "the processor selects the field width" 186 if (edit.digits.has_value()) { // E0.d 187 editWidth = editDigits + 6; // -.666E+ee 188 } else { // E0 189 flags |= decimal::Minimize; 190 significantDigits = 191 sizeof buffer_ - 5; // sign, NUL, + 3 extra for EN scaling 192 } 193 } 194 bool isEN{edit.variation == 'N'}; 195 bool isES{edit.variation == 'S'}; 196 int scale{isEN || isES ? 1 : edit.modes.scale}; // 'kP' value 197 int zeroesAfterPoint{0}; 198 if (scale < 0) { 199 zeroesAfterPoint = -scale; 200 significantDigits = std::max(0, significantDigits - zeroesAfterPoint); 201 } else if (scale > 0) { 202 ++significantDigits; 203 scale = std::min(scale, significantDigits + 1); 204 } 205 // In EN editing, multiple attempts may be necessary, so it's in a loop. 206 while (true) { 207 decimal::ConversionToDecimalResult converted{ 208 Convert(significantDigits, edit.modes.round, flags)}; 209 if (IsInfOrNaN(converted)) { 210 return EmitPrefix(edit, converted.length, editWidth) && 211 io_.Emit(converted.str, converted.length) && EmitSuffix(edit); 212 } 213 if (!IsZero()) { 214 converted.decimalExponent -= scale; 215 } 216 if (isEN && scale < 3 && (converted.decimalExponent % 3) != 0) { 217 // EN mode: boost the scale and significant digits, try again; need 218 // an effective exponent field that's a multiple of three. 219 ++scale; 220 ++significantDigits; 221 continue; 222 } 223 // Format the exponent (see table 13.1 for all the cases) 224 int expoLength{0}; 225 const char *exponent{ 226 FormatExponent(converted.decimalExponent, edit, expoLength)}; 227 int signLength{*converted.str == '-' || *converted.str == '+' ? 1 : 0}; 228 int convertedDigits{static_cast<int>(converted.length) - signLength}; 229 int zeroesBeforePoint{std::max(0, scale - convertedDigits)}; 230 int digitsBeforePoint{std::max(0, scale - zeroesBeforePoint)}; 231 int digitsAfterPoint{convertedDigits - digitsBeforePoint}; 232 int trailingZeroes{flags & decimal::Minimize 233 ? 0 234 : std::max(0, 235 significantDigits - (convertedDigits + zeroesBeforePoint))}; 236 int totalLength{signLength + digitsBeforePoint + zeroesBeforePoint + 237 1 /*'.'*/ + zeroesAfterPoint + digitsAfterPoint + trailingZeroes + 238 expoLength}; 239 int width{editWidth > 0 ? editWidth : totalLength}; 240 if (totalLength > width) { 241 return io_.EmitRepeated('*', width); 242 } 243 if (totalLength < width && digitsBeforePoint == 0 && 244 zeroesBeforePoint == 0) { 245 zeroesBeforePoint = 1; 246 ++totalLength; 247 } 248 return EmitPrefix(edit, totalLength, width) && 249 io_.Emit(converted.str, signLength + digitsBeforePoint) && 250 io_.EmitRepeated('0', zeroesBeforePoint) && 251 io_.Emit(edit.modes.editingFlags & decimalComma ? "," : ".", 1) && 252 io_.EmitRepeated('0', zeroesAfterPoint) && 253 io_.Emit( 254 converted.str + signLength + digitsBeforePoint, digitsAfterPoint) && 255 io_.EmitRepeated('0', trailingZeroes) && 256 io_.Emit(exponent, expoLength) && EmitSuffix(edit); 257 } 258 } 259 260 // 13.7.2.3.2 in F'2018 261 template <int binaryPrecision> 262 bool RealOutputEditing<binaryPrecision>::EditFOutput(const DataEdit &edit) { 263 int fracDigits{edit.digits.value_or(0)}; // 'd' field 264 const int editWidth{edit.width.value_or(0)}; // 'w' field 265 enum decimal::FortranRounding rounding{edit.modes.round}; 266 int flags{0}; 267 if (edit.modes.editingFlags & signPlus) { 268 flags |= decimal::AlwaysSign; 269 } 270 if (editWidth == 0) { // "the processor selects the field width" 271 if (!edit.digits.has_value()) { // F0 272 flags |= decimal::Minimize; 273 fracDigits = sizeof buffer_ - 2; // sign & NUL 274 } 275 } 276 // Multiple conversions may be needed to get the right number of 277 // effective rounded fractional digits. 278 int extraDigits{0}; 279 bool canIncrease{true}; 280 while (true) { 281 decimal::ConversionToDecimalResult converted{ 282 Convert(extraDigits + fracDigits, rounding, flags)}; 283 if (IsInfOrNaN(converted)) { 284 return EmitPrefix(edit, converted.length, editWidth) && 285 io_.Emit(converted.str, converted.length) && EmitSuffix(edit); 286 } 287 int scale{IsZero() ? 1 : edit.modes.scale}; // kP 288 int expo{converted.decimalExponent + scale}; 289 int signLength{*converted.str == '-' || *converted.str == '+' ? 1 : 0}; 290 int convertedDigits{static_cast<int>(converted.length) - signLength}; 291 int trailingOnes{0}; 292 if (expo > extraDigits && extraDigits >= 0 && canIncrease) { 293 extraDigits = expo; 294 if (!edit.digits.has_value()) { // F0 295 fracDigits = sizeof buffer_ - extraDigits - 2; // sign & NUL 296 } 297 canIncrease = false; // only once 298 continue; 299 } else if (expo == -fracDigits && convertedDigits > 0) { 300 if (rounding != decimal::FortranRounding::RoundToZero) { 301 // Convert again without rounding so that we can round here 302 rounding = decimal::FortranRounding::RoundToZero; 303 continue; 304 } else if (converted.str[signLength] >= '5') { 305 // Value rounds up to a scaled 1 (e.g., 0.06 for F5.1 -> 0.1) 306 ++expo; 307 convertedDigits = 0; 308 trailingOnes = 1; 309 } else { 310 // Value rounds down to zero 311 expo = 0; 312 convertedDigits = 0; 313 } 314 } else if (expo < extraDigits && extraDigits > -fracDigits) { 315 extraDigits = std::max(expo, -fracDigits); 316 continue; 317 } 318 int digitsBeforePoint{std::max(0, std::min(expo, convertedDigits))}; 319 int zeroesBeforePoint{std::max(0, expo - digitsBeforePoint)}; 320 int zeroesAfterPoint{std::min(fracDigits, std::max(0, -expo))}; 321 int digitsAfterPoint{convertedDigits - digitsBeforePoint}; 322 int trailingZeroes{flags & decimal::Minimize 323 ? 0 324 : std::max(0, 325 fracDigits - 326 (zeroesAfterPoint + digitsAfterPoint + trailingOnes))}; 327 if (digitsBeforePoint + zeroesBeforePoint + zeroesAfterPoint + 328 digitsAfterPoint + trailingOnes + trailingZeroes == 329 0) { 330 zeroesBeforePoint = 1; // "." -> "0." 331 } 332 int totalLength{signLength + digitsBeforePoint + zeroesBeforePoint + 333 1 /*'.'*/ + zeroesAfterPoint + digitsAfterPoint + trailingOnes + 334 trailingZeroes}; 335 int width{editWidth > 0 ? editWidth : totalLength}; 336 if (totalLength > width) { 337 return io_.EmitRepeated('*', width); 338 } 339 if (totalLength < width && digitsBeforePoint + zeroesBeforePoint == 0) { 340 zeroesBeforePoint = 1; 341 ++totalLength; 342 } 343 return EmitPrefix(edit, totalLength, width) && 344 io_.Emit(converted.str, signLength + digitsBeforePoint) && 345 io_.EmitRepeated('0', zeroesBeforePoint) && 346 io_.Emit(edit.modes.editingFlags & decimalComma ? "," : ".", 1) && 347 io_.EmitRepeated('0', zeroesAfterPoint) && 348 io_.Emit( 349 converted.str + signLength + digitsBeforePoint, digitsAfterPoint) && 350 io_.EmitRepeated('1', trailingOnes) && 351 io_.EmitRepeated('0', trailingZeroes) && 352 io_.EmitRepeated(' ', trailingBlanks_) && EmitSuffix(edit); 353 } 354 } 355 356 // 13.7.5.2.3 in F'2018 357 template <int binaryPrecision> 358 DataEdit RealOutputEditing<binaryPrecision>::EditForGOutput(DataEdit edit) { 359 edit.descriptor = 'E'; 360 int significantDigits{ 361 edit.digits.value_or(BinaryFloatingPoint::decimalPrecision)}; // 'd' 362 if (!edit.width.has_value() || (*edit.width > 0 && significantDigits == 0)) { 363 return edit; // Gw.0 -> Ew.0 for w > 0 364 } 365 int flags{0}; 366 if (edit.modes.editingFlags & signPlus) { 367 flags |= decimal::AlwaysSign; 368 } 369 decimal::ConversionToDecimalResult converted{ 370 Convert(significantDigits, edit.modes.round, flags)}; 371 if (IsInfOrNaN(converted)) { 372 return edit; 373 } 374 int expo{IsZero() ? 1 : converted.decimalExponent}; // 's' 375 if (expo < 0 || expo > significantDigits) { 376 return edit; // Ew.d 377 } 378 edit.descriptor = 'F'; 379 edit.modes.scale = 0; // kP is ignored for G when no exponent field 380 trailingBlanks_ = 0; 381 int editWidth{edit.width.value_or(0)}; 382 if (editWidth > 0) { 383 int expoDigits{edit.expoDigits.value_or(0)}; 384 trailingBlanks_ = expoDigits > 0 ? expoDigits + 2 : 4; // 'n' 385 *edit.width = std::max(0, editWidth - trailingBlanks_); 386 } 387 if (edit.digits.has_value()) { 388 *edit.digits = std::max(0, *edit.digits - expo); 389 } 390 return edit; 391 } 392 393 // 13.10.4 in F'2018 394 template <int binaryPrecision> 395 bool RealOutputEditing<binaryPrecision>::EditListDirectedOutput( 396 const DataEdit &edit) { 397 decimal::ConversionToDecimalResult converted{Convert(1, edit.modes.round)}; 398 if (IsInfOrNaN(converted)) { 399 return EditEorDOutput(edit); 400 } 401 int expo{converted.decimalExponent}; 402 if (expo < 0 || expo > BinaryFloatingPoint::decimalPrecision) { 403 DataEdit copy{edit}; 404 copy.modes.scale = 1; // 1P 405 return EditEorDOutput(copy); 406 } 407 return EditFOutput(edit); 408 } 409 410 // 13.7.5.2.6 in F'2018 411 template <int binaryPrecision> 412 bool RealOutputEditing<binaryPrecision>::EditEXOutput(const DataEdit &) { 413 io_.GetIoErrorHandler().Crash( 414 "not yet implemented: EX output editing"); // TODO 415 } 416 417 template <int KIND> bool RealOutputEditing<KIND>::Edit(const DataEdit &edit) { 418 switch (edit.descriptor) { 419 case 'D': 420 return EditEorDOutput(edit); 421 case 'E': 422 if (edit.variation == 'X') { 423 return EditEXOutput(edit); 424 } else { 425 return EditEorDOutput(edit); 426 } 427 case 'F': 428 return EditFOutput(edit); 429 case 'B': 430 case 'O': 431 case 'Z': 432 return EditIntegerOutput<KIND>(io_, edit, 433 static_cast<common::HostSignedIntType<8 * KIND>>( 434 decimal::BinaryFloatingPointNumber<binaryPrecision>{x_}.raw())); 435 case 'G': 436 return Edit(EditForGOutput(edit)); 437 case 'A': // legacy extension 438 return EditCharacterOutput( 439 io_, edit, reinterpret_cast<char *>(&x_), sizeof x_); 440 default: 441 if (edit.IsListDirected()) { 442 return EditListDirectedOutput(edit); 443 } 444 io_.GetIoErrorHandler().SignalError(IostatErrorInFormat, 445 "Data edit descriptor '%c' may not be used with a REAL data item", 446 edit.descriptor); 447 return false; 448 } 449 return false; 450 } 451 452 bool ListDirectedLogicalOutput(IoStatementState &io, 453 ListDirectedStatementState<Direction::Output> &list, bool truth) { 454 return list.EmitLeadingSpaceOrAdvance(io) && io.Emit(truth ? "T" : "F", 1); 455 } 456 457 bool EditLogicalOutput(IoStatementState &io, const DataEdit &edit, bool truth) { 458 switch (edit.descriptor) { 459 case 'L': 460 case 'G': 461 return io.EmitRepeated(' ', std::max(0, edit.width.value_or(1) - 1)) && 462 io.Emit(truth ? "T" : "F", 1); 463 default: 464 io.GetIoErrorHandler().SignalError(IostatErrorInFormat, 465 "Data edit descriptor '%c' may not be used with a LOGICAL data item", 466 edit.descriptor); 467 return false; 468 } 469 } 470 471 template <typename CHAR> 472 bool ListDirectedCharacterOutput(IoStatementState &io, 473 ListDirectedStatementState<Direction::Output> &list, const CHAR *x, 474 std::size_t length) { 475 bool ok{true}; 476 MutableModes &modes{io.mutableModes()}; 477 ConnectionState &connection{io.GetConnectionState()}; 478 if (modes.delim) { 479 ok = ok && list.EmitLeadingSpaceOrAdvance(io); 480 // Value is delimited with ' or " marks, and interior 481 // instances of that character are doubled. 482 auto EmitOne{[&](CHAR ch) { 483 if (connection.NeedAdvance(1)) { 484 ok = ok && io.AdvanceRecord(); 485 } 486 ok = ok && io.EmitEncoded(&ch, 1); 487 }}; 488 EmitOne(modes.delim); 489 for (std::size_t j{0}; j < length; ++j) { 490 // Doubled delimiters must be put on the same record 491 // in order to be acceptable as list-directed or NAMELIST 492 // input; however, this requirement is not always possible 493 // when the records have a fixed length, as is the case with 494 // internal output. The standard is silent on what should 495 // happen, and no two extant Fortran implementations do 496 // the same thing when tested with this case. 497 // This runtime splits the doubled delimiters across 498 // two records for lack of a better alternative. 499 if (x[j] == static_cast<CHAR>(modes.delim)) { 500 EmitOne(x[j]); 501 } 502 EmitOne(x[j]); 503 } 504 EmitOne(modes.delim); 505 } else { 506 // Undelimited list-directed output 507 ok = ok && list.EmitLeadingSpaceOrAdvance(io, length > 0 ? 1 : 0, true); 508 std::size_t put{0}; 509 std::size_t oneIfUTF8{connection.isUTF8 ? 1 : length}; 510 while (ok && put < length) { 511 if (std::size_t chunk{std::min<std::size_t>( 512 std::min<std::size_t>(length - put, oneIfUTF8), 513 connection.RemainingSpaceInRecord())}) { 514 ok = io.EmitEncoded(x + put, chunk); 515 put += chunk; 516 } else { 517 ok = io.AdvanceRecord() && io.Emit(" ", 1); 518 } 519 } 520 list.set_lastWasUndelimitedCharacter(true); 521 } 522 return ok; 523 } 524 525 template <typename CHAR> 526 bool EditCharacterOutput(IoStatementState &io, const DataEdit &edit, 527 const CHAR *x, std::size_t length) { 528 switch (edit.descriptor) { 529 case 'A': 530 case 'G': 531 break; 532 default: 533 io.GetIoErrorHandler().SignalError(IostatErrorInFormat, 534 "Data edit descriptor '%c' may not be used with a CHARACTER data item", 535 edit.descriptor); 536 return false; 537 } 538 int len{static_cast<int>(length)}; 539 int width{edit.width.value_or(len)}; 540 return io.EmitRepeated(' ', std::max(0, width - len)) && 541 io.EmitEncoded(x, std::min(width, len)); 542 } 543 544 template bool EditIntegerOutput<1>( 545 IoStatementState &, const DataEdit &, std::int8_t); 546 template bool EditIntegerOutput<2>( 547 IoStatementState &, const DataEdit &, std::int16_t); 548 template bool EditIntegerOutput<4>( 549 IoStatementState &, const DataEdit &, std::int32_t); 550 template bool EditIntegerOutput<8>( 551 IoStatementState &, const DataEdit &, std::int64_t); 552 template bool EditIntegerOutput<16>( 553 IoStatementState &, const DataEdit &, common::int128_t); 554 555 template class RealOutputEditing<2>; 556 template class RealOutputEditing<3>; 557 template class RealOutputEditing<4>; 558 template class RealOutputEditing<8>; 559 template class RealOutputEditing<10>; 560 // TODO: double/double 561 template class RealOutputEditing<16>; 562 563 template bool ListDirectedCharacterOutput(IoStatementState &, 564 ListDirectedStatementState<Direction::Output> &, const char *, 565 std::size_t chars); 566 template bool ListDirectedCharacterOutput(IoStatementState &, 567 ListDirectedStatementState<Direction::Output> &, const char16_t *, 568 std::size_t chars); 569 template bool ListDirectedCharacterOutput(IoStatementState &, 570 ListDirectedStatementState<Direction::Output> &, const char32_t *, 571 std::size_t chars); 572 573 template bool EditCharacterOutput( 574 IoStatementState &, const DataEdit &, const char *, std::size_t chars); 575 template bool EditCharacterOutput( 576 IoStatementState &, const DataEdit &, const char16_t *, std::size_t chars); 577 template bool EditCharacterOutput( 578 IoStatementState &, const DataEdit &, const char32_t *, std::size_t chars); 579 580 } // namespace Fortran::runtime::io 581