X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Findex.h;h=70a8186d7e2eaf6078811ba45cd4ff4264acba34;hb=91373ee6489fbe08db12bef2cf6df704b31e1378;hp=8a97529380954be6fe4f87cb8ddcc151605a6c03;hpb=cf4e067a500425b1e40602f87150b7b2eae05bd1;p=libucw.git diff --git a/lib/index.h b/lib/index.h index 8a975293..70a8186d 100644 --- a/lib/index.h +++ b/lib/index.h @@ -53,6 +53,8 @@ enum card_flag { CARD_FLAG_MERGED = 8, /* Destination of a merge [merger] */ }; +#define CARD_POS_SHIFT 5 /* Card positions are shifted this # of bytes to the right */ + /* String fingerprints */ struct fingerprint { @@ -60,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)