X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=charset%2Funicode.h;h=7bc6f235812ef3c5529dac1de956e768924eea7f;hb=2b797fef8d8133e5b1cb40706aabc92718da40bd;hp=3246f1346162a33c996a4abd8c08323d4a3b2162;hpb=ef6639d2cf305018f9edb2f7944969c236afbfea;p=libucw.git diff --git a/charset/unicode.h b/charset/unicode.h index 3246f134..7bc6f235 100644 --- a/charset/unicode.h +++ b/charset/unicode.h @@ -42,14 +42,14 @@ static inline uns Uunaccent(uns x) extern const word *Uexpand_lig(uns x); enum unicode_char_type { - _U_LETTER, /* Letters */ - _U_UPPER, /* Upper-case letters */ - _U_LOWER, /* Lower-case letters */ - _U_CTRL, /* Control characters */ - _U_DIGIT, /* Digits */ - _U_XDIGIT, /* Hexadecimal digits */ - _U_SPACE, /* White spaces (spaces, tabs, newlines) */ - _U_LIGATURE, /* Compatibility ligature (to be expanded) */ + _U_LETTER = 1, /* Letters */ + _U_UPPER = 2, /* Upper-case letters */ + _U_LOWER = 4, /* Lower-case letters */ + _U_CTRL = 8, /* Control characters */ + _U_DIGIT = 16, /* Digits */ + _U_XDIGIT = 32, /* Hexadecimal digits */ + _U_SPACE = 64, /* White spaces (spaces, tabs, newlines) */ + _U_LIGATURE = 128, /* Compatibility ligature (to be expanded) */ }; #define _U_LUPPER (_U_LETTER | _U_UPPER) @@ -124,6 +124,8 @@ enum unicode_char_type { p++, c <<= 1; \ } while (0) +#define UTF8_SKIP_BWD(p) while ((--*(p) & 0xc0) == 0x80) + #define UTF8_SPACE(u) ((u) < 0x80 ? 1 : (u) < 0x800 ? 2 : 3) uns ucs2_to_utf8(byte *, word *);