Mercurial > hg
comparison mcabber/src/utf8.h @ 1089:a61c3311a5bb
Hopefully fix unicode detection on BSD systems
The ncurses library's unicode support wasn't correctly detected on some
systems (FreeBSD for example).
This patch adds a HAVE_UNICODE define with autoconf.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 07 Dec 2006 21:18:48 +0100 |
parents | a09bf67d1dfb |
children | 334ae9f498f1 |
comparison
equal
deleted
inserted
replaced
1088:c55b24818546 | 1089:a61c3311a5bb |
---|---|
1 #ifndef __UTF8_H__ | 1 #ifndef __UTF8_H__ |
2 #define __UTF8_H__ 1 | 2 #define __UTF8_H__ 1 |
3 | 3 |
4 #include <config.h> | 4 #include <config.h> |
5 | 5 |
6 #if defined HAVE_UNICODE && defined HAVE_WCHAR_H && defined HAVE_WCTYPE_H | |
7 # define UNICODE | |
8 #endif | |
9 | |
6 #ifdef HAVE_WCHAR_H | 10 #ifdef HAVE_WCHAR_H |
7 # include <wchar.h> | 11 # include <wchar.h> |
8 # define UNICODE | |
9 # define get_char_width(c) (utf8_mode ? wcwidth(get_char(c)) : 1) | 12 # define get_char_width(c) (utf8_mode ? wcwidth(get_char(c)) : 1) |
10 #else | 13 #else |
11 # define wcwidth(c) 1 | 14 # define wcwidth(c) 1 |
12 # define get_char_width(c) 1 | 15 # define get_char_width(c) 1 |
13 #endif | 16 #endif |
16 # include <wctype.h> | 19 # include <wctype.h> |
17 #else | 20 #else |
18 # define iswblank(c) (c == ' ') | 21 # define iswblank(c) (c == ' ') |
19 # define iswalnum(c) isalnum(c) | 22 # define iswalnum(c) isalnum(c) |
20 # define iswprint(c) isprint(c) | 23 # define iswprint(c) isprint(c) |
21 # undef UNICODE | |
22 #endif | |
23 | |
24 #ifndef HAVE_NCURSESW_NCURSES_H | |
25 # undef UNICODE | |
26 #endif | 24 #endif |
27 | 25 |
28 extern int utf8_mode; | 26 extern int utf8_mode; |
29 | 27 |
30 char *prev_char(char *str, const char *limit); | 28 char *prev_char(char *str, const char *limit); |