mcabber/src/utf8.h
author Mikael Berthe <mikael@lilotux.net>
Fri, 29 Sep 2006 21:50:28 +0200
changeset 968 d3bfa9e9d88c
parent 934 a09bf67d1dfb
child 1089 a61c3311a5bb
permissions -rw-r--r--
Use split_arg() in do_roster()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
932
fc6aaa223650 Fix a few problems with non-UTF-8 locales
Mikael Berthe <mikael@lilotux.net>
parents: 930
diff changeset
     9
# 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
    10
#else
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
# define wcwidth(c) 1
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) 1
930
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
#endif
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
#ifdef HAVE_WCTYPE_H
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
# include <wctype.h>
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
#else
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
# define iswblank(c) (c == ' ')
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
# define iswalnum(c) isalnum(c)
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
# define iswprint(c) isprint(c)
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
# undef UNICODE
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
#endif
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
934
a09bf67d1dfb Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents: 932
diff changeset
    24
#ifndef HAVE_NCURSESW_NCURSES_H
a09bf67d1dfb Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents: 932
diff changeset
    25
# undef UNICODE
a09bf67d1dfb Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents: 932
diff changeset
    26
#endif
a09bf67d1dfb Unicode support depends on having ncursesw
Mikael Berthe <mikael@lilotux.net>
parents: 932
diff changeset
    27
930
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
extern int utf8_mode;
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    29
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    30
char *prev_char(char *str, const char *limit);
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    31
char *next_char(char *str);
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    32
unsigned get_char(const char *str);
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    33
char *put_char(char *str, unsigned c);
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    34
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    35
#endif /* __UTF8_H__ */
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    36
a75f7a13df7b UTF-8 terminal support (Reimar Döffinger)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    37
/* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */