1 /* Runtime conversion of strings from one character kind to another.
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. */
30 #include "libgfortran.h"
36 extern void convert_char1_to_char4 (gfc_char4_t
**, gfc_charlen_type
,
37 const unsigned char *);
38 export_proto(convert_char1_to_char4
);
40 extern void convert_char4_to_char1 (unsigned char **, gfc_charlen_type
,
42 export_proto(convert_char4_to_char1
);
46 convert_char1_to_char4 (gfc_char4_t
**dst
, gfc_charlen_type len
,
47 const unsigned char *src
)
49 gfc_charlen_type i
, l
;
51 l
= len
> 0 ? len
: 0;
52 *dst
= get_mem ((l
+ 1) * sizeof (gfc_char4_t
));
54 for (i
= 0; i
< l
; i
++)
62 convert_char4_to_char1 (unsigned char **dst
, gfc_charlen_type len
,
63 const gfc_char4_t
*src
)
65 gfc_charlen_type i
, l
;
67 l
= len
> 0 ? len
: 0;
68 *dst
= get_mem ((l
+ 1) * sizeof (unsigned char));
70 for (i
= 0; i
< l
; i
++)