]> git.ipfire.org Git - thirdparty/glibc.git/blame - iconvdata/iso8859-1.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / iconvdata / iso8859-1.c
CommitLineData
f4017d20 1/* Conversion to and from ISO 8859-1.
b168057a 2 Copyright (C) 1997-2015 Free Software Foundation, Inc.
f4017d20
UD
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5
6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
f4017d20
UD
10
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
41bdb6e2 14 Lesser General Public License for more details.
f4017d20 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
f4017d20 19
55985355 20#include <dlfcn.h>
8619129f
UD
21#include <stdint.h>
22
23/* Definitions used in the body of the `gconv' function. */
9b26f5c4 24#define CHARSET_NAME "ISO-8859-1//"
8619129f
UD
25#define FROM_LOOP from_iso8859_1
26#define TO_LOOP to_iso8859_1
27#define DEFINE_INIT 1
28#define DEFINE_FINI 1
29#define MIN_NEEDED_FROM 1
30#define MIN_NEEDED_TO 4
13e402e7 31#define ONE_DIRECTION 0
8619129f
UD
32
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 \
33ed6903
AJ
38 *((uint32_t *) outptr) = *inptr++; \
39 outptr += sizeof (uint32_t);
f9ad060c
UD
40#define ONEBYTE_BODY \
41 { \
42 return c; \
43 }
8619129f
UD
44#include <iconv/loop.c>
45
46
47/* Next, define the other direction. */
5aa8ff62
UD
48#define MIN_NEEDED_INPUT MIN_NEEDED_TO
49#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
8619129f
UD
50#define LOOPFCT TO_LOOP
51#define BODY \
52 { \
a1620a4c 53 uint32_t ch = *((const uint32_t *) inptr); \
a1ffb40e 54 if (__glibc_unlikely (ch > 0xff)) \
8619129f 55 { \
601d2942
UD
56 UNICODE_TAG_HANDLER (ch, 4); \
57 \
8619129f 58 /* We have an illegal character. */ \
e438a468 59 STANDARD_TO_LOOP_ERR_HANDLER (4); \
8619129f 60 } \
85830c4c
UD
61 else \
62 *outptr++ = (unsigned char) ch; \
8619129f
UD
63 inptr += 4; \
64 }
55985355 65#define LOOP_NEED_FLAGS
8619129f
UD
66#include <iconv/loop.c>
67
68
69/* Now define the toplevel functions. */
70#include <iconv/skeleton.c>