]>
Commit | Line | Data |
---|---|---|
47852e8f CW |
1 | /* |
2 | * This program is free software; you can redistribute it and/or | |
3 | * modify it under the terms of the GNU General Public License | |
4 | * as published by the Free Software Foundation; either version 2 | |
5 | * of the License, or (at your option) any later version. | |
6 | * | |
7 | * This program is distributed in the hope that it will be useful, | |
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | * GNU General Public License for more details. | |
11 | * | |
12 | * You should have received a copy of the GNU General Public License | |
13 | * along with this program; if not, write to the Free Software | |
14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
15 | * | |
16 | * See the COPYING file for license information. | |
17 | */ | |
18 | #ifndef WIDECHAR_H | |
19 | #define WIDECHAR_H | |
20 | /* Declarations for wide characters */ | |
21 | /* This file must be included last because the redefinition of wchar_t may | |
22 | cause conflicts when system include files were included after it. */ | |
23 | #if HAVE_CONFIG_H | |
24 | # include "config.h" /* for ENABLE_WIDECHAR */ | |
25 | #endif | |
26 | /* don't include "common.h" here */ | |
27 | ||
28 | #ifdef ENABLE_WIDECHAR | |
29 | ||
30 | # include <wchar.h> | |
31 | # include <wctype.h> | |
32 | #if 0 /* for testing on platforms without built-in wide character support */ | |
33 | # include <libutf8.h> | |
34 | #endif | |
35 | ||
36 | #if 1 | |
37 | /* explicit prototypes, since sometimes <wchar.h> does not give them */ | |
38 | extern int wcwidth (wint_t c); | |
39 | extern int wcswidth (const wchar_t *s, size_t n); | |
40 | extern size_t wcslen (const wchar_t *s); | |
41 | extern wchar_t *wcsdup (const wchar_t *s); | |
42 | #endif | |
43 | ||
44 | #else | |
45 | ||
46 | # include <ctype.h> | |
47 | /* Fallback for types */ | |
48 | # define wchar_t char | |
49 | # define wint_t int | |
50 | # define WEOF EOF | |
51 | /* Fallback for input operations */ | |
52 | # define fgetwc fgetc | |
53 | # define getwc getc | |
54 | # define getwchar getchar | |
55 | # define fgetws fgets | |
56 | /* Fallback for output operations */ | |
57 | # define fputwc fputc | |
58 | # define putwc putc | |
59 | # define putwchar putchar | |
60 | # define fputws fputs | |
61 | /* Fallback for character classification */ | |
62 | # define iswgraph isgraph | |
63 | # define iswprint isprint | |
64 | # define iswspace isspace | |
65 | /* Fallback for string functions */ | |
66 | # define wcschr strchr | |
67 | # define wcsdup strdup | |
68 | # define wcslen strlen | |
69 | ||
70 | # define wcwidth(c) 1 | |
71 | ||
72 | #endif | |
73 | #endif |