Remove duplicate entries.
[glibc/history.git] / iconvdata / iso8859-1.c
blob632ebd617614642ad39c0682fcbf08345d114482
1 /* Conversion to and from ISO 8859-1.
2 Copyright (C) 1997-1999, 2000-2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <dlfcn.h>
22 #include <stdint.h>
24 /* Definitions used in the body of the `gconv' function. */
25 #define CHARSET_NAME "ISO-8859-1//"
26 #define FROM_LOOP from_iso8859_1
27 #define TO_LOOP to_iso8859_1
28 #define DEFINE_INIT 1
29 #define DEFINE_FINI 1
30 #define MIN_NEEDED_FROM 1
31 #define MIN_NEEDED_TO 4
33 /* First define the conversion function from ISO 8859-1 to UCS4. */
34 #define MIN_NEEDED_INPUT MIN_NEEDED_FROM
35 #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
36 #define LOOPFCT FROM_LOOP
37 #define BODY \
38 *((uint32_t *) outptr) = *inptr++; \
39 outptr += sizeof (uint32_t);
40 #define ONEBYTE_BODY \
41 { \
42 return c; \
44 #include <iconv/loop.c>
47 /* Next, define the other direction. */
48 #define MIN_NEEDED_INPUT MIN_NEEDED_TO
49 #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
50 #define LOOPFCT TO_LOOP
51 #define BODY \
52 { \
53 uint32_t ch = *((const uint32_t *) inptr); \
54 if (__builtin_expect (ch > 0xff, 0)) \
55 { \
56 UNICODE_TAG_HANDLER (ch, 4); \
58 /* We have an illegal character. */ \
59 STANDARD_TO_LOOP_ERR_HANDLER (4); \
60 } \
61 else \
62 *outptr++ = (unsigned char) ch; \
63 inptr += 4; \
65 #define LOOP_NEED_FLAGS
66 #include <iconv/loop.c>
69 /* Now define the toplevel functions. */
70 #include <iconv/skeleton.c>