]> git.ipfire.org Git - thirdparty/glibc.git/blame - iconvdata/iso_11548-1.c
NEWS: mention 16379 as fixed
[thirdparty/glibc.git] / iconvdata / iso_11548-1.c
CommitLineData
a0e3432c 1/* Conversion to and from ISO 11548-1.
568035b7 2 Copyright (C) 1997-2013 Free Software Foundation, Inc.
a0e3432c
UD
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997,
5 Samuel Thibault <samuel.thibault@ens-lyon.org>, 2005.
6
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
a0e3432c
UD
20
21#include <dlfcn.h>
22#include <stdint.h>
23
24/* Definitions used in the body of the `gconv' function. */
25#define CHARSET_NAME "ISO_11548-1//"
26#define FROM_LOOP from_iso11548_1
27#define TO_LOOP to_iso11548_1
28#define DEFINE_INIT 1
29#define DEFINE_FINI 1
30#define MIN_NEEDED_FROM 1
31#define MIN_NEEDED_TO 4
32
33#define BRAILLE_UCS_BASE 0x2800
34
35/* First define the conversion function from ISO 11548-1 to UCS4. */
36#define MIN_NEEDED_INPUT MIN_NEEDED_FROM
37#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
38#define LOOPFCT FROM_LOOP
39#define BODY \
40 *((uint32_t *) outptr) = BRAILLE_UCS_BASE | (*inptr++); \
41 outptr += sizeof (uint32_t);
42#define ONEBYTE_BODY \
43 { \
44 return BRAILLE_UCS_BASE | c; \
45 }
46#include <iconv/loop.c>
47
48
49/* Next, define the other direction. */
50#define MIN_NEEDED_INPUT MIN_NEEDED_TO
51#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
52#define LOOPFCT TO_LOOP
53#define BODY \
54 { \
55 uint32_t ch = *((const uint32_t *) inptr); \
56 if (__builtin_expect ((ch & 0xffffff00u) != BRAILLE_UCS_BASE, 0)) \
57 { \
58 UNICODE_TAG_HANDLER (ch, 4); \
59 \
60 /* We have an illegal character. */ \
61 STANDARD_TO_LOOP_ERR_HANDLER (4); \
62 } \
63 else \
64 *outptr++ = (unsigned char) (ch & 0xff); \
65 inptr += 4; \
66 }
67#define LOOP_NEED_FLAGS
68#include <iconv/loop.c>
69
70
71/* Now define the toplevel functions. */
72#include <iconv/skeleton.c>