Mercurial > ~mikael > mcabber > hg
annotate mcabber/src/utf8.h @ 930:a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
This is a patch from Reimar Döffinger, slightly modified,
which makes mcabber work better on UTF-8 terminals.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 08 Jul 2006 09:40:05 +0200 |
parents | |
children | fc6aaa223650 |
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 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
6 #ifdef HAVE_WCHAR_H |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
7 # include <wchar.h> |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
8 # define UNICODE |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
9 #else |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
10 # define wcwidth(c) 1 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
11 #endif |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
12 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
13 #ifdef HAVE_WCTYPE_H |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
14 # include <wctype.h> |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
15 #else |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
16 # define iswblank(c) (c == ' ') |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
17 # define iswalnum(c) isalnum(c) |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
18 # define iswprint(c) isprint(c) |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
19 # undef UNICODE |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
20 #endif |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
21 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
22 extern int utf8_mode; |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
23 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
24 char *prev_char(char *str, const char *limit); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
25 char *next_char(char *str); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 unsigned get_char(const char *str); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
27 char *put_char(char *str, unsigned c); |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
28 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
29 #endif /* __UTF8_H__ */ |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
30 |
a75f7a13df7b
UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
31 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |