Remove "Written by Ben Pfaff <blp@gnu.org>" lines everywhere.
[pspp-builds.git] / src / libpspp / legacy-encoding.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2006 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19 #ifndef LIBPSPP_LEGACY_ENCODING
20 #define LIBPSPP_LEGACY_ENCODING 1
21
22 #include <stddef.h>
23 #include <libpspp/compiler.h>
24
25 /* A legacy character encoding.
26    This exists only to handle the specific legacy EBCDIC-to-ASCII
27    recoding that MODE=360 file handles perform. */
28 enum legacy_encoding
29   {
30     LEGACY_ASCII,         /* ASCII or similar character set. */
31     LEGACY_EBCDIC,        /* IBM EBCDIC character set. */
32
33     /* Native character set. */
34 #if 'A' == 0x41
35     LEGACY_NATIVE = LEGACY_ASCII
36 #elif 'A' == 0xc1
37     LEGACY_NATIVE = LEGACY_EBCDIC
38 #else
39 #error Cannot detect native character set.
40 #endif
41   };
42
43 void legacy_recode (enum legacy_encoding, const char *src,
44                     enum legacy_encoding, char *dst, size_t);
45 char legacy_to_native (enum legacy_encoding from, char) PURE_FUNCTION;
46 char legacy_from_native (enum legacy_encoding to, char) PURE_FUNCTION;
47
48 #endif /* libpspp/legacy-encoding.h */