1/* Copyright (C) 1998-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _WCSMBSLOAD_H
19#define _WCSMBSLOAD_H 1
20
21#include <locale.h>
22#include <wchar.h>
23#include <locale/localeinfo.h>
24
25
26/* Contains pointers to the used functions in the `gconv' modules. */
27struct gconv_fcts
28 {
29 struct __gconv_step *towc;
30 size_t towc_nsteps;
31 struct __gconv_step *tomb;
32 size_t tomb_nsteps;
33 };
34
35/* Set of currently active conversion functions. */
36extern const struct gconv_fcts __wcsmbs_gconv_fcts_c attribute_hidden;
37
38/* Load conversion functions for the currently selected locale. */
39extern void __wcsmbs_load_conv (struct __locale_data *new_category)
40 attribute_hidden;
41
42/* Clone the current `__wcsmbs_load_conv' value. */
43extern void __wcsmbs_clone_conv (struct gconv_fcts *copy)
44 attribute_hidden;
45
46/* Find the conversion functions for converting to and from NAME. */
47extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
48 attribute_hidden;
49
50/* Function used for the `private.cleanup' hook. */
51extern void _nl_cleanup_ctype (struct __locale_data *) attribute_hidden;
52
53
54#include <iconv/gconv_int.h>
55
56
57/* Load the function implementation if necessary. */
58extern struct __gconv_step *__wcsmbs_getfct (const char *to, const char *from,
59 size_t *nstepsp)
60 attribute_hidden;
61
62extern const struct __locale_data _nl_C_LC_CTYPE attribute_hidden;
63
64/* Check whether the LC_CTYPE locale changed since the last call.
65 Update the pointers appropriately. */
66static inline const struct gconv_fcts *
67get_gconv_fcts (struct __locale_data *data)
68{
69 if (__glibc_unlikely (data->private.ctype == NULL))
70 {
71 if (__glibc_unlikely (data == &_nl_C_LC_CTYPE))
72 return &__wcsmbs_gconv_fcts_c;
73 __wcsmbs_load_conv (data);
74 }
75 return data->private.ctype;
76}
77
78#endif /* wcsmbsload.h */
79

source code of glibc/wcsmbs/wcsmbsload.h