1 /* String intrinsics helper functions.
2 Copyright 2008 Free Software Foundation, Inc.
4 This file is part of the GNU Fortran runtime library (libgfortran).
6 Libgfortran is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file. (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
20 Libgfortran is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public
26 License along with libgfortran; see the file COPYING. If not,
27 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 Boston, MA 02110-1301, USA. */
31 /* Unlike what the name of this file suggests, we don't actually
32 implement the Fortran intrinsics here. At least, not with the
33 names they have in the standard. The functions here provide all
34 the support we need for the standard string intrinsics, and the
35 compiler translates the actual intrinsics calls to calls to
36 functions in this file. */
38 #include "libgfortran.h"
45 /* Helper function to set parts of wide strings to a constant (usually
49 memset_char4 (gfc_char4_t *b, gfc_char4_t c, size_t len)
53 for (i = 0; i < len; i++)
60 /* All other functions are defined using a few generic macros in
61 string_intrinsics_inc.c, so we avoid code duplication between the
62 various character type kinds. */
67 #define UCHARTYPE unsigned char
73 #include "string_intrinsics_inc.c"
77 #define CHARTYPE gfc_char4_t
79 #define UCHARTYPE gfc_char4_t
81 #define SUFFIX(x) x ## _char4
83 #define MEMSET memset_char4
85 #include "string_intrinsics_inc.c"