Update.
[glibc.git] / iconvdata / iso8859-1.c
blobdb6cbdf0f9b4c18864141773c7547f31841e101e
1 /* Conversion to and from ISO 8859-1.
2 Copyright (C) 1997, 1998 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 Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #include <stdint.h>
23 /* Definitions used in the body of the `gconv' function. */
24 #define CHARSET_NAME "ISO-8859-1//"
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
32 /* First define the conversion function from ISO 8859-1 to UCS4. */
33 #define MIN_NEEDED_INPUT MIN_NEEDED_FROM
34 #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
35 #define LOOPFCT FROM_LOOP
36 #define BODY \
37 *((uint32_t *) outptr)++ = *inptr++;
38 #include <iconv/loop.c>
41 /* Next, define the other direction. */
42 #define MIN_NEEDED_INPUT MIN_NEEDED_TO
43 #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
44 #define LOOPFCT TO_LOOP
45 #define BODY \
46 { \
47 uint32_t ch = *((uint32_t *) inptr); \
48 if (ch > 0xff) \
49 { \
50 /* We have an illegal character. */ \
51 result = GCONV_ILLEGAL_INPUT; \
52 break; \
53 } \
54 *outptr++ = (unsigned char) ch; \
55 inptr += 4; \
57 #include <iconv/loop.c>
60 /* Now define the toplevel functions. */
61 #include <iconv/skeleton.c>