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