12#ifndef FORTRAN_RUNTIME_CHARACTER_H_
13#define FORTRAN_RUNTIME_CHARACTER_H_
14#include "flang/Runtime/entry-names.h"
18namespace Fortran::runtime {
22template <
typename CHAR>
23RT_API_ATTRS
int CharacterScalarCompare(
24 const CHAR *x,
const CHAR *y, std::size_t xChars, std::size_t yChars);
25extern template RT_API_ATTRS
int CharacterScalarCompare<char>(
26 const char *x,
const char *y, std::size_t xChars, std::size_t yChars);
27extern template RT_API_ATTRS
int CharacterScalarCompare<char16_t>(
28 const char16_t *x,
const char16_t *y, std::size_t xChars,
30extern template RT_API_ATTRS
int CharacterScalarCompare<char32_t>(
31 const char32_t *x,
const char32_t *y, std::size_t xChars,
41void RTDECL(CharacterConcatenate)(Descriptor &accumulator,
42 const Descriptor &from,
const char *sourceFile =
nullptr,
46void RTDECL(CharacterConcatenateScalar1)(
47 Descriptor &accumulator,
const char *from, std::size_t chars);
57int RTDECL(CharacterCompareScalar)(
const Descriptor &,
const Descriptor &);
58int RTDECL(CharacterCompareScalar1)(
59 const char *x,
const char *y, std::size_t xChars, std::size_t yChars);
60int RTDECL(CharacterCompareScalar2)(
const char16_t *x,
const char16_t *y,
61 std::size_t xChars, std::size_t yChars);
62int RTDECL(CharacterCompareScalar4)(
const char32_t *x,
const char32_t *y,
63 std::size_t xChars, std::size_t yChars);
67void RTDECL(CharacterCompare)(
68 Descriptor &result,
const Descriptor &,
const Descriptor &);
74std::size_t RTDECL(CharacterAppend1)(
char *lhs, std::size_t lhsBytes,
75 std::size_t offset,
const char *rhs, std::size_t rhsBytes);
78void RTDECL(CharacterPad1)(
char *lhs, std::size_t bytes, std::size_t offset);
82void RTDECL(Adjustl)(Descriptor &result,
const Descriptor &,
83 const char *sourceFile =
nullptr,
int sourceLine = 0);
84void RTDECL(Adjustr)(Descriptor &result,
const Descriptor &,
85 const char *sourceFile =
nullptr,
int sourceLine = 0);
86std::size_t RTDECL(LenTrim1)(
const char *, std::size_t);
87std::size_t RTDECL(LenTrim2)(
const char16_t *, std::size_t);
88std::size_t RTDECL(LenTrim4)(
const char32_t *, std::size_t);
89void RTDECL(LenTrim)(Descriptor &result,
const Descriptor &,
int kind,
90 const char *sourceFile =
nullptr,
int sourceLine = 0);
91void RTDECL(Repeat)(Descriptor &result,
const Descriptor &string,
92 std::int64_t ncopies,
const char *sourceFile =
nullptr,
int sourceLine = 0);
93void RTDECL(Trim)(Descriptor &result,
const Descriptor &string,
94 const char *sourceFile =
nullptr,
int sourceLine = 0);
96void RTDECL(FCString)(Descriptor &result,
const Descriptor &string,
97 bool asis =
false,
const char *sourceFile =
nullptr,
int sourceLine = 0);
99void RTDECL(CharacterMax)(Descriptor &accumulator,
const Descriptor &x,
100 const char *sourceFile =
nullptr,
int sourceLine = 0);
101void RTDECL(CharacterMin)(Descriptor &accumulator,
const Descriptor &x,
102 const char *sourceFile =
nullptr,
int sourceLine = 0);
104std::size_t RTDECL(Index1)(
const char *, std::size_t,
const char *substring,
105 std::size_t,
bool back =
false);
106std::size_t RTDECL(Index2)(
const char16_t *, std::size_t,
107 const char16_t *substring, std::size_t,
bool back =
false);
108std::size_t RTDECL(Index4)(
const char32_t *, std::size_t,
109 const char32_t *substring, std::size_t,
bool back =
false);
110void RTDECL(Index)(Descriptor &result,
const Descriptor &string,
111 const Descriptor &substring,
const Descriptor *back ,
112 int kind,
const char *sourceFile =
nullptr,
int sourceLine = 0);
114std::size_t RTDECL(Scan1)(
115 const char *, std::size_t,
const char *set, std::size_t,
bool back =
false);
116std::size_t RTDECL(Scan2)(
const char16_t *, std::size_t,
const char16_t *set,
117 std::size_t,
bool back =
false);
118std::size_t RTDECL(Scan4)(
const char32_t *, std::size_t,
const char32_t *set,
119 std::size_t,
bool back =
false);
120void RTDECL(Scan)(Descriptor &result,
const Descriptor &string,
121 const Descriptor &set,
const Descriptor *back ,
int kind,
122 const char *sourceFile =
nullptr,
int sourceLine = 0);
124std::size_t RTDECL(Verify1)(
125 const char *, std::size_t,
const char *set, std::size_t,
bool back =
false);
126std::size_t RTDECL(Verify2)(
const char16_t *, std::size_t,
const char16_t *set,
127 std::size_t,
bool back =
false);
128std::size_t RTDECL(Verify4)(
const char32_t *, std::size_t,
const char32_t *set,
129 std::size_t,
bool back =
false);
130void RTDECL(Verify)(Descriptor &result,
const Descriptor &string,
131 const Descriptor &set,
const Descriptor *back ,
int kind,
132 const char *sourceFile =
nullptr,
int sourceLine = 0);
134void RTDECL(Tokenize)(Descriptor &tokens, Descriptor *separator,
135 const Descriptor &string,
const Descriptor &set,
136 const char *sourceFile =
nullptr,
int sourceLine = 0);
137void RTDECL(TokenizePositions)(Descriptor &first, Descriptor &last,
138 const Descriptor &string,
const Descriptor &set,
139 const char *sourceFile =
nullptr,
int sourceLine = 0);