2.5-18.1
[glibc.git] / c_stubs / gconv_stubs.c
blobf4c0b66da2db2dc0ab6cf0f9c3f4013310fa9659
1 /* Provide gconv stub functions for the minimum static binaries.
2 Copyright (C) 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
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
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <features.h>
21 #include <string.h>
22 #include <wchar.h>
23 #include <bits/libc-lock.h>
24 #if __GNUC_PREREQ(3, 3)
25 # include <gconv_int.h>
26 #else
27 # include <gconv.h>
28 #endif
30 __libc_lock_define_initialized (, __gconv_lock)
32 /* hack for self identification */
33 int __c_stubs_is_compiled_in;
35 /* Don't drag in the dynamic linker. */
36 void *__libc_stack_end;
38 int attribute_hidden
39 __gconv_OK (void)
41 #if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
42 return __GCONV_OK;
43 #else
44 return GCONV_OK;
45 #endif
48 int attribute_hidden
49 __gconv_NOCONV (void)
51 #if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
52 return __GCONV_NOCONV;
53 #else
54 return GCONV_NOCONV;
55 #endif
58 void attribute_hidden
59 __gconv_NOOP (void)
63 int
64 internal_function
65 __gconv_compare_alias (const char *name1, const char *name2)
67 return strcmp (name1, name2);
70 wint_t
71 __gconv_btwoc_ascii (struct __gconv_step *step, unsigned char c)
73 if (c < 0x80)
74 return c;
75 else
76 return WEOF;
80 #if __GNUC_PREREQ(3, 3)
81 # undef strong_alias
82 # define strong_alias(impl, name) \
83 __typeof (name) name __attribute__ ((alias (#impl)))
84 #endif
86 strong_alias (__gconv_OK,
87 __gconv_close_transform);
88 strong_alias (__gconv_OK,
89 __gconv_close);
91 strong_alias (__gconv_NOCONV,
92 __gconv);
93 strong_alias (__gconv_NOCONV,
94 __gconv_find_transform);
95 strong_alias (__gconv_NOCONV,
96 __gconv_open);
98 /* These transformations should not fail in normal conditions */
99 strong_alias (__gconv_OK,
100 __gconv_transform_ascii_internal);
101 strong_alias (__gconv_OK,
102 __gconv_transform_utf16_internal);
103 strong_alias (__gconv_OK,
104 __gconv_transform_utf8_internal);
105 strong_alias (__gconv_OK,
106 __gconv_transform_ucs2_internal);
108 /* We can assume no conversion for these ones */
109 strong_alias (__gconv_NOCONV,
110 __gconv_transform_internal_ascii);
111 strong_alias (__gconv_NOCONV,
112 __gconv_transform_internal_ucs2);
113 strong_alias (__gconv_NOCONV,
114 __gconv_transform_internal_ucs4);
115 strong_alias (__gconv_NOCONV,
116 __gconv_transform_internal_utf16);
117 strong_alias (__gconv_NOCONV,
118 __gconv_transform_internal_utf8);
120 strong_alias (__gconv_NOCONV,
121 __gconv_transliterate);
123 strong_alias (__gconv_NOOP,
124 __gconv_release_cache);
125 strong_alias (__gconv_NOOP,
126 __gconv_release_step);