From: Martin Mares Date: Thu, 1 Mar 2001 16:57:58 +0000 (+0000) Subject: Defined a GET_TAGGED_CHAR macro to read our internal representation X-Git-Tag: holmes-import~1540 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=91373ee6489fbe08db12bef2cf6df704b31e1378;p=libucw.git Defined a GET_TAGGED_CHAR macro to read our internal representation of tagged text, mapping the tags to character codes >= 0x80000000. --- diff --git a/lib/index.h b/lib/index.h index 6394b65c..70a8186d 100644 --- a/lib/index.h +++ b/lib/index.h @@ -62,3 +62,23 @@ struct fingerprint { }; void fingerprint(byte *string, struct fingerprint *fp); + +/* Reading of tagged text (Unicode values, tags mapped to 0x80000000 and higher) */ + +#define GET_TAGGED_CHAR(p,u) do { \ + u = *p; \ + if (u >= 0xc0) \ + GET_UTF8(p,u); \ + else if (u >= 0x80) \ + { \ + p++; \ + if (u >= 0xb0) \ + u += 0x80020000; \ + else if (u >= 0xa0) \ + u = 0x80010000 + ((u & 0x0f) << 6) + (*p++ & 0x3f); \ + else \ + u += 0x80000000; \ + } \ + else \ + p++; \ +} while (0)