FLANG

tools.h
1 //===-- runtime/tools.h -----------------------------------------*- 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 #ifndef FORTRAN_RUNTIME_TOOLS_H_
10 #define FORTRAN_RUNTIME_TOOLS_H_
11
12 #include "memory.h"
13 #include <functional>
14 #include <map>
15 #include <type_traits>
16
17 namespace Fortran::runtime {
18
19 class Terminator;
20
21 OwningPtr<char> SaveDefaultCharacter(
22 const char *, std::size_t, const Terminator &);
23
24 // For validating and recognizing default CHARACTER values in a
25 // case-insensitive manner. Returns the zero-based index into the
26 // null-terminated array of upper-case possibilities when the value is valid,
27 // or -1 when it has no match.
28 int IdentifyValue(
29 const char *value, std::size_t length, const char *possibilities[]);
30
31 // Truncates or pads as necessary
32 void ToFortranDefaultCharacter(
33 char *to, std::size_t toLength, const char *from);
34 } // namespace Fortran::runtime
35 #endif // FORTRAN_RUNTIME_TOOLS_H_