Mercurial > hg
annotate mcabber/src/utf8.h @ 1642:cd67b29e04e3
Fix not execution of HOOK_INTERNAL
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Mon, 02 Nov 2009 19:11:29 +0200 |
parents | 481b60da99c9 |
children |
rev | line source |
---|---|
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
1 #ifndef __UTF8_H__ |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
2 #define __UTF8_H__ 1 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
3 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
4 #include <config.h> |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
5 |
1089
a61c3311a5bb
Hopefully fix unicode detection on BSD systems
Mikael Berthe <mikael@lilotux.net>
parents:
934
diff
changeset
|
6 #if defined HAVE_UNICODE && defined HAVE_WCHAR_H && defined HAVE_WCTYPE_H |
a61c3311a5bb
Hopefully fix unicode detection on BSD systems
Mikael Berthe <mikael@lilotux.net>
parents:
934
diff
changeset
|
7 # define UNICODE |
a61c3311a5bb
Hopefully fix unicode detection on BSD systems
Mikael Berthe <mikael@lilotux.net>
parents:
934
diff
changeset
|
8 #endif |
a61c3311a5bb
Hopefully fix unicode detection on BSD systems
Mikael Berthe <mikael@lilotux.net>
parents:
934
diff
changeset
|
9 |
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
10 #ifdef HAVE_WCHAR_H |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
11 # include <wchar.h> |
932
fc6aaa223650
Fix a few problems with non-UTF-8 locales
Mikael Berthe <mikael@lilotux.net>
parents:
930
diff
changeset
|
12 # define get_char_width(c) (utf8_mode ? wcwidth(get_char(c)) : 1) |
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
13 #else |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
14 # define wcwidth(c) 1 |
932
fc6aaa223650
Fix a few problems with non-UTF-8 locales
Mikael Berthe <mikael@lilotux.net>
parents:
930
diff
changeset
|
15 # define get_char_width(c) 1 |
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
16 #endif |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
17 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
18 #ifdef HAVE_WCTYPE_H |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
19 # include <wctype.h> |
1571
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
20 |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
21 /* The following bit is a hack for Solaris 8&9 systems that don't have |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
22 * iswblank(). |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
23 * For now i made sure it comes after wctype.h so it doesn't create |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
24 * problems (wctype.h has calls to iswblank() before wctype() is declared). |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
25 * (Sebastian Kayser) |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
26 */ |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
27 # ifndef HAVE_ISWBLANK |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
28 # define iswblank(wc) iswctype(wc, wctype("blank")) |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
29 # endif |
481b60da99c9
Workaround for missing iswblank() on Solaris 8 & 9 (Sebastian Kayser)
Mikael Berthe <mikael@lilotux.net>
parents:
1179
diff
changeset
|
30 |
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
31 #else |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
32 # define iswblank(c) (c == ' ') |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
33 # define iswalnum(c) isalnum(c) |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
34 # define iswprint(c) isprint(c) |
1172
334ae9f498f1
Add some more iline functions (Lego12239)
Mikael Berthe <mikael@lilotux.net>
parents:
1089
diff
changeset
|
35 # define towupper(c) toupper(c) |
334ae9f498f1
Add some more iline functions (Lego12239)
Mikael Berthe <mikael@lilotux.net>
parents:
1089
diff
changeset
|
36 # define towlower(c) tolower(c) |
1179 | 37 # define iswalpha(c) isalpha(c) |
934
a09bf67d1dfb
Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents:
932
diff
changeset
|
38 #endif |
a09bf67d1dfb
Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents:
932
diff
changeset
|
39 |
930
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
40 extern int utf8_mode; |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
41 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
42 char *prev_char(char *str, const char *limit); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
43 char *next_char(char *str); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
44 unsigned get_char(const char *str); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
45 char *put_char(char *str, unsigned c); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
46 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
47 #endif /* __UTF8_H__ */ |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
48 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
49 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |