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(CharacterMax)(Descriptor &accumulator,
const Descriptor &x,
97 const char *sourceFile =
nullptr,
int sourceLine = 0);
98void RTDECL(CharacterMin)(Descriptor &accumulator,
const Descriptor &x,
99 const char *sourceFile =
nullptr,
int sourceLine = 0);
101std::size_t RTDECL(Index1)(
const char *, std::size_t,
const char *substring,
102 std::size_t,
bool back =
false);
103std::size_t RTDECL(Index2)(
const char16_t *, std::size_t,
104 const char16_t *substring, std::size_t,
bool back =
false);
105std::size_t RTDECL(Index4)(
const char32_t *, std::size_t,
106 const char32_t *substring, std::size_t,
bool back =
false);
107void RTDECL(Index)(Descriptor &result,
const Descriptor &string,
108 const Descriptor &substring,
const Descriptor *back ,
109 int kind,
const char *sourceFile =
nullptr,
int sourceLine = 0);
111std::size_t RTDECL(Scan1)(
112 const char *, std::size_t,
const char *set, std::size_t,
bool back =
false);
113std::size_t RTDECL(Scan2)(
const char16_t *, std::size_t,
const char16_t *set,
114 std::size_t,
bool back =
false);
115std::size_t RTDECL(Scan4)(
const char32_t *, std::size_t,
const char32_t *set,
116 std::size_t,
bool back =
false);
117void RTDECL(Scan)(Descriptor &result,
const Descriptor &string,
118 const Descriptor &set,
const Descriptor *back ,
int kind,
119 const char *sourceFile =
nullptr,
int sourceLine = 0);
121std::size_t RTDECL(Verify1)(
122 const char *, std::size_t,
const char *set, std::size_t,
bool back =
false);
123std::size_t RTDECL(Verify2)(
const char16_t *, std::size_t,
const char16_t *set,
124 std::size_t,
bool back =
false);
125std::size_t RTDECL(Verify4)(
const char32_t *, std::size_t,
const char32_t *set,
126 std::size_t,
bool back =
false);
127void RTDECL(Verify)(Descriptor &result,
const Descriptor &string,
128 const Descriptor &set,
const Descriptor *back ,
int kind,
129 const char *sourceFile =
nullptr,
int sourceLine = 0);