summaryrefslogtreecommitdiffstats
path: root/lib/widechar.h
blob: a8d288298aa129dd2d67f9500b19a02ddb74bfc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Declarations for wide characters */
/* This file must be included last because the redefinition of wchar_t may
   cause conflicts when system include files were included after it. */

#include "../defines.h"  /* for ENABLE_WIDECHAR */

#ifdef ENABLE_WIDECHAR

# include <wchar.h>
# include <wctype.h>
#if 0 /* for testing on platforms without built-in wide character support */
#  include <libutf8.h>
#endif

#else

# include <ctype.h>
  /* Fallback for types */
# define wchar_t char
# define wint_t int
# define WEOF EOF
  /* Fallback for input operations */
# define fgetwc fgetc
# define getwc getc
# define getwchar getchar
# define fgetws fgets
  /* Fallback for output operations */
# define fputwc fputc
# define putwc putc
# define putwchar putchar
# define fputws fputs
  /* Fallback for character classification */
# define iswgraph isgraph
# define iswprint isprint
# define iswspace isspace
  /* Fallback for string functions */
# define wcschr strchr
# define wcsdup strdup
# define wcslen strlen

#endif