sh: Fix static build with --enable-fortify
[glibc.git] / iconvdata / iso_11548-1.c
blob1f9646432051745d614c716d44e06817a861506f
1 /* Conversion to and from ISO 11548-1.
2 Copyright (C) 1997-2024 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 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.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <dlfcn.h>
20 #include <stdint.h>
22 /* Definitions used in the body of the `gconv' function. */
23 #define CHARSET_NAME "ISO_11548-1//"
24 #define FROM_LOOP from_iso11548_1
25 #define TO_LOOP to_iso11548_1
26 #define DEFINE_INIT 1
27 #define DEFINE_FINI 1
28 #define MIN_NEEDED_FROM 1
29 #define MIN_NEEDED_TO 4
30 #define ONE_DIRECTION 0
32 #define BRAILLE_UCS_BASE 0x2800
34 /* First define the conversion function from ISO 11548-1 to UCS4. */
35 #define MIN_NEEDED_INPUT MIN_NEEDED_FROM
36 #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
37 #define LOOPFCT FROM_LOOP
38 #define BODY \
39 *((uint32_t *) outptr) = BRAILLE_UCS_BASE | (*inptr++); \
40 outptr += sizeof (uint32_t);
41 #define ONEBYTE_BODY \
42 { \
43 return BRAILLE_UCS_BASE | c; \
45 #include <iconv/loop.c>
48 /* Next, define the other direction. */
49 #define MIN_NEEDED_INPUT MIN_NEEDED_TO
50 #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
51 #define LOOPFCT TO_LOOP
52 #define BODY \
53 { \
54 uint32_t ch = *((const uint32_t *) inptr); \
55 if (__glibc_unlikely ((ch & 0xffffff00u) != BRAILLE_UCS_BASE)) \
56 { \
57 UNICODE_TAG_HANDLER (ch, 4); \
59 /* We have an illegal character. */ \
60 STANDARD_TO_LOOP_ERR_HANDLER (4); \
61 } \
62 else \
63 *outptr++ = (unsigned char) (ch & 0xff); \
64 inptr += 4; \
66 #define LOOP_NEED_FLAGS
67 #include <iconv/loop.c>
70 /* Now define the toplevel functions. */
71 #include <iconv/skeleton.c>