[Groonga-commit] groonga/groonga [master] Added rk_conv() to pat.c

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2010年 8月 16日 (月) 10:02:07 JST


Daijiro MORI	2010-08-16 01:02:07 +0000 (Mon, 16 Aug 2010)

  New Revision: 5648c3b27c4abcbf171fb269a7d44ea50ae5869b

  Log:
    Added rk_conv() to pat.c

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+312 -0)
===================================================================
--- lib/pat.c    2010-08-16 00:33:21 +0000 (40e503f)
+++ lib/pat.c    2010-08-16 01:02:07 +0000 (ba3768d)
@@ -2362,3 +2362,315 @@ grn_pat_cursor_inspect(grn_ctx *ctx, grn_pat_cursor *c, grn_obj *buf)
 
   GRN_TEXT_PUTS(ctx, buf, ">");
 }
+
+typedef struct {
+  uint8_t code;
+  uint8_t next;
+  uint8_t emit;
+  uint8_t attr;
+} rk_tree_node;
+
+uint16_t rk_str_idx[] = {
+  0x0003, 0x0006, 0x0009, 0x000c, 0x0012, 0x0015, 0x0018, 0x001e, 0x0024, 0x002a,
+  0x0030, 0x0036, 0x003c, 0x0042, 0x0048, 0x004e, 0x0054, 0x005a, 0x0060, 0x0066,
+  0x006c, 0x0072, 0x0078, 0x007e, 0x0084, 0x008a, 0x0090, 0x0096, 0x009c, 0x00a2,
+  0x00a8, 0x00ae, 0x00b4, 0x00ba, 0x00c0, 0x00c3, 0x00c6, 0x00c9, 0x00cc, 0x00cf,
+  0x00d2, 0x00d5, 0x00db, 0x00e1, 0x00e7, 0x00ea, 0x00f0, 0x00f6, 0x00fc, 0x00ff,
+  0x0105, 0x0108, 0x010e, 0x0111, 0x0114, 0x0117, 0x011a, 0x011d, 0x0120, 0x0123,
+  0x0129, 0x012f, 0x0135, 0x013b, 0x013e, 0x0144, 0x014a, 0x0150, 0x0156, 0x0159,
+  0x015c, 0x015f, 0x0162, 0x0165, 0x0168, 0x016b, 0x016e, 0x0171, 0x0177, 0x017d,
+  0x0183, 0x0189, 0x018c, 0x0192, 0x0198, 0x019e, 0x01a1, 0x01a4, 0x01aa, 0x01b0,
+  0x01b6, 0x01bc, 0x01bf, 0x01c2, 0x01c8, 0x01ce, 0x01d1, 0x01d7, 0x01dd, 0x01e0,
+  0x01e6, 0x01e9, 0x01ef, 0x01f2, 0x01f5, 0x01fb, 0x0201, 0x0207, 0x020d, 0x0213,
+  0x0216, 0x0219, 0x021c, 0x021f, 0x0222, 0x0225, 0x0228, 0x022e, 0x0234, 0x023a,
+  0x023d, 0x0243, 0x0249, 0x024f, 0x0252, 0x0258, 0x025e, 0x0264, 0x0267, 0x026d,
+  0x0273, 0x0279, 0x027f, 0x0285, 0x0288, 0x028b, 0x028e, 0x0291, 0x0294, 0x0297,
+  0x029a, 0x029d, 0x02a0, 0x02a3, 0x02a9, 0x02af, 0x02b5, 0x02b8, 0x02bb, 0x02be,
+  0x02c1, 0x02c4, 0x02c7, 0x02ca, 0x02cd, 0x02d0, 0x02d3, 0x02d6, 0x02dc, 0x02e2,
+  0x02e8, 0x02eb, 0x02ee, 0x02f1, 0x02f4, 0x02f7, 0x02fa, 0x02fd, 0x0300, 0x0303,
+  0x0309, 0x030c, 0x0312, 0x0318, 0x031e, 0x0324, 0x0327, 0x032a, 0x032d
+};
+char rk_str[] = {
+  0xe3, 0x82, 0xa1, 0xe3, 0x82, 0xa2, 0xe3, 0x82, 0xa3, 0xe3, 0x82, 0xa4, 0xe3,
+  0x82, 0xa4, 0xe3, 0x82, 0xa7, 0xe3, 0x82, 0xa5, 0xe3, 0x82, 0xa6, 0xe3, 0x82,
+  0xa6, 0xe3, 0x82, 0xa2, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa3, 0xe3, 0x82, 0xa6,
+  0xe3, 0x82, 0xa4, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa6, 0xe3,
+  0x82, 0xa7, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa8, 0xe3, 0x82, 0xa6, 0xe3, 0x82,
+  0xaa,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, 0xb4, 0xe3, 0x82, 0xa1, 0xe3, 0x83, 0xb4, 0xe3, 0x82, 0xa3, 0xe3,
+  0x83, 0xb4, 0xe3, 0x82, 0xa7, 0xe3, 0x83, 0xb4, 0xe3, 0x82, 0xa9, 0xe3, 0x83,
+  0xb5, 0xe3, 0x83, 0xb6, 0xe3, 0x83, 0xbc
+};
+uint16_t rk_tree_idx[] = {
+  0x001b, 0x0022, 0x0025, 0x0028, 0x002d, 0x0030, 0x0039, 0x003b, 0x003c, 0x003f,
+  0x0046, 0x0047, 0x004f, 0x0050, 0x0053, 0x005a, 0x005d, 0x0064, 0x0067, 0x006f,
+  0x0070, 0x0073, 0x007a, 0x007f, 0x0086, 0x0089, 0x00a6, 0x00ac, 0x00b3, 0x00b6,
+  0x00bd, 0x00c0, 0x00c8, 0x00cd, 0x00d1, 0x00db, 0x00dd, 0x00e2, 0x00e3, 0x00e7,
+  0x00ed, 0x00f3, 0x00f5, 0x00ff, 0x0101, 0x0103, 0x0104, 0x0105, 0x0108, 0x010d,
+  0x0114, 0x0118, 0x011a, 0x0159, 0x0175, 0x0178, 0x018e, 0x01a2
+};
+rk_tree_node rk_tree[] = {
+  {0x2d, 0x00, 0xb2, 0x01}, {0x61, 0x00, 0x01, 0x01}, {0x62, 0x01, 0xff, 0x01},
+  {0x63, 0x03, 0xff, 0x01}, {0x64, 0x06, 0xff, 0x01}, {0x65, 0x00, 0x24, 0x01},
+  {0x66, 0x0a, 0xff, 0x01}, {0x67, 0x0c, 0xff, 0x01}, {0x68, 0x0f, 0xff, 0x01},
+  {0x69, 0x00, 0x03, 0x01}, {0x6a, 0x11, 0xff, 0x01}, {0x6b, 0x13, 0xff, 0x01},
+  {0x6c, 0x16, 0xff, 0x01}, {0x6d, 0x18, 0xff, 0x01}, {0x6e, 0x1a, 0xff, 0x01},
+  {0x6f, 0x00, 0x26, 0x01}, {0x70, 0x1c, 0xff, 0x01}, {0x72, 0x1e, 0xff, 0x01},
+  {0x73, 0x20, 0xff, 0x01}, {0x74, 0x23, 0xff, 0x01}, {0x75, 0x00, 0x06, 0x01},
+  {0x76, 0x28, 0xff, 0x01}, {0x77, 0x29, 0xff, 0x01}, {0x78, 0x2b, 0xff, 0x01},
+  {0x79, 0x31, 0xff, 0x01}, {0x7a, 0x32, 0xff, 0x01}, {0xe3, 0x34, 0xff, 0x01},
+  {0x61, 0x00, 0x72, 0x01}, {0x62, 0x01, 0x56, 0x01}, {0x65, 0x00, 0x89, 0x01},
+  {0x69, 0x00, 0x78, 0x01}, {0x6f, 0x00, 0x8c, 0x01}, {0x75, 0x00, 0x86, 0x01},
+  {0x79, 0x02, 0xff, 0x00}, {0x61, 0x00, 0x79, 0x01}, {0x6f, 0x00, 0x7b, 0x01},
+  {0x75, 0x00, 0x7a, 0x01}, {0x63, 0x03, 0x56, 0x01}, {0x68, 0x04, 0xff, 0x01},
+  {0x79, 0x05, 0xff, 0x01}, {0x61, 0x00, 0x4f, 0x00}, {0x65, 0x00, 0x4e, 0x00},
+  {0x69, 0x00, 0x4d, 0x01}, {0x6f, 0x00, 0x51, 0x00}, {0x75, 0x00, 0x50, 0x00},
+  {0x61, 0x00, 0x4f, 0x01}, {0x6f, 0x00, 0x51, 0x01}, {0x75, 0x00, 0x50, 0x01},
+  {0x61, 0x00, 0x4c, 0x01}, {0x64, 0x06, 0x56, 0x01}, {0x65, 0x00, 0x60, 0x01},
+  {0x68, 0x07, 0xff, 0x00}, {0x69, 0x00, 0x61, 0x00}, {0x6f, 0x00, 0x65, 0x01},
+  {0x75, 0x00, 0x5c, 0x01}, {0x77, 0x08, 0xff, 0x00}, {0x79, 0x09, 0xff, 0x01},
+  {0x69, 0x00, 0x61, 0x01}, {0x75, 0x00, 0x62, 0x01}, {0x75, 0x00, 0x66, 0x01},
+  {0x61, 0x00, 0x53, 0x01}, {0x6f, 0x00, 0x55, 0x01}, {0x75, 0x00, 0x54, 0x01},
+  {0x61, 0x00, 0x81, 0x00}, {0x65, 0x00, 0x83, 0x00}, {0x66, 0x0a, 0x56, 0x01},
+  {0x69, 0x00, 0x82, 0x00}, {0x6f, 0x00, 0x84, 0x00}, {0x75, 0x00, 0x80, 0x01},
+  {0x79, 0x0b, 0xff, 0x00}, {0x75, 0x00, 0x85, 0x01}, {0x61, 0x00, 0x28, 0x01},
+  {0x65, 0x00, 0x36, 0x01}, {0x67, 0x0c, 0x56, 0x01}, {0x69, 0x00, 0x2d, 0x01},
+  {0x6f, 0x00, 0x38, 0x01}, {0x75, 0x00, 0x33, 0x01}, {0x77, 0x0d, 0xff, 0x00},
+  {0x79, 0x0e, 0xff, 0x00}, {0x61, 0x00, 0x34, 0x01}, {0x61, 0x00, 0x2e, 0x01},
+  {0x6f, 0x00, 0x30, 0x01}, {0x75, 0x00, 0x2f, 0x01}, {0x61, 0x00, 0x71, 0x01},
+  {0x65, 0x00, 0x88, 0x01}, {0x68, 0x0f, 0x56, 0x01}, {0x69, 0x00, 0x74, 0x01},
+  {0x6f, 0x00, 0x8b, 0x01}, {0x75, 0x00, 0x80, 0x01}, {0x79, 0x10, 0xff, 0x00},
+  {0x61, 0x00, 0x75, 0x01}, {0x6f, 0x00, 0x77, 0x01}, {0x75, 0x00, 0x76, 0x01},
+  {0x61, 0x00, 0x42, 0x00}, {0x65, 0x00, 0x41, 0x00}, {0x69, 0x00, 0x40, 0x01},
+  {0x6a, 0x11, 0x56, 0x01}, {0x6f, 0x00, 0x44, 0x00}, {0x75, 0x00, 0x43, 0x00},
+  {0x79, 0x12, 0xff, 0x00}, {0x61, 0x00, 0x42, 0x01}, {0x6f, 0x00, 0x44, 0x01},
+  {0x75, 0x00, 0x43, 0x01}, {0x61, 0x00, 0x27, 0x01}, {0x65, 0x00, 0x35, 0x01},
+  {0x69, 0x00, 0x29, 0x01}, {0x6b, 0x13, 0x56, 0x01}, {0x6f, 0x00, 0x37, 0x01},
+  {0x75, 0x00, 0x31, 0x01}, {0x77, 0x14, 0xff, 0x00}, {0x79, 0x15, 0xff, 0x00},
+  {0x61, 0x00, 0x32, 0x01}, {0x61, 0x00, 0x2a, 0x01}, {0x6f, 0x00, 0x2c, 0x01},
+  {0x75, 0x00, 0x2b, 0x01}, {0x61, 0x00, 0x00, 0x01}, {0x65, 0x00, 0x23, 0x01},
+  {0x69, 0x00, 0x02, 0x01}, {0x6c, 0x16, 0x56, 0x01}, {0x6f, 0x00, 0x25, 0x01},
+  {0x75, 0x00, 0x05, 0x01}, {0x79, 0x17, 0xff, 0x01}, {0x61, 0x00, 0x96, 0x01},
+  {0x65, 0x00, 0x23, 0x01}, {0x69, 0x00, 0x02, 0x01}, {0x6f, 0x00, 0x9a, 0x01},
+  {0x75, 0x00, 0x98, 0x01}, {0x61, 0x00, 0x8e, 0x01}, {0x65, 0x00, 0x94, 0x01},
+  {0x69, 0x00, 0x8f, 0x01}, {0x6d, 0x18, 0x56, 0x01}, {0x6f, 0x00, 0x95, 0x01},
+  {0x75, 0x00, 0x93, 0x01}, {0x79, 0x19, 0xff, 0x00}, {0x61, 0x00, 0x90, 0x01},
+  {0x6f, 0x00, 0x92, 0x01}, {0x75, 0x00, 0x91, 0x01}, {0x00, 0x00, 0xa9, 0x01},
+  {0x27, 0x00, 0xa9, 0x00}, {0x2d, 0x00, 0xaa, 0x00}, {0x61, 0x00, 0x67, 0x01},
+  {0x62, 0x01, 0xa9, 0x00}, {0x63, 0x03, 0xa9, 0x00}, {0x64, 0x06, 0xa9, 0x00},
+  {0x65, 0x00, 0x6f, 0x01}, {0x66, 0x0a, 0xa9, 0x00}, {0x67, 0x0c, 0xa9, 0x00},
+  {0x68, 0x0f, 0xa9, 0x00}, {0x69, 0x00, 0x68, 0x01}, {0x6a, 0x11, 0xa9, 0x00},
+  {0x6b, 0x13, 0xa9, 0x00}, {0x6c, 0x16, 0xa9, 0x00}, {0x6d, 0x18, 0xa9, 0x00},
+  {0x6e, 0x00, 0xa9, 0x00}, {0x6f, 0x00, 0x70, 0x01}, {0x70, 0x1c, 0xa9, 0x00},
+  {0x72, 0x1e, 0xa9, 0x00}, {0x73, 0x20, 0xa9, 0x00}, {0x74, 0x23, 0xa9, 0x00},
+  {0x75, 0x00, 0x6e, 0x01}, {0x76, 0x28, 0xa9, 0x00}, {0x77, 0x29, 0xa9, 0x00},
+  {0x78, 0x2b, 0xa9, 0x00}, {0x79, 0x1b, 0xff, 0x00}, {0x7a, 0x32, 0xa9, 0x00},
+  {0xe3, 0x34, 0xa9, 0x00}, {0x00, 0x00, 0xa9, 0x01}, {0x61, 0x00, 0x6b, 0x01},
+  {0x65, 0x00, 0x6a, 0x01}, {0x69, 0x00, 0x69, 0x01}, {0x6f, 0x00, 0x6d, 0x01},
+  {0x75, 0x00, 0x6c, 0x01}, {0x61, 0x00, 0x73, 0x01}, {0x65, 0x00, 0x8a, 0x01},
+  {0x69, 0x00, 0x7c, 0x01}, {0x6f, 0x00, 0x8d, 0x01}, {0x70, 0x1c, 0x56, 0x01},
+  {0x75, 0x00, 0x87, 0x01}, {0x79, 0x1d, 0xff, 0x00}, {0x61, 0x00, 0x7d, 0x01},
+  {0x6f, 0x00, 0x7f, 0x01}, {0x75, 0x00, 0x7e, 0x01}, {0x61, 0x00, 0x9c, 0x01},
+  {0x65, 0x00, 0xa2, 0x01}, {0x69, 0x00, 0x9d, 0x01}, {0x6f, 0x00, 0xa3, 0x01},
+  {0x72, 0x1e, 0x56, 0x01}, {0x75, 0x00, 0xa1, 0x01}, {0x79, 0x1f, 0xff, 0x00},
+  {0x61, 0x00, 0x9e, 0x01}, {0x6f, 0x00, 0xa0, 0x01}, {0x75, 0x00, 0x9f, 0x01},
+  {0x61, 0x00, 0x39, 0x01}, {0x65, 0x00, 0x47, 0x01}, {0x68, 0x21, 0xff, 0x00},
+  {0x69, 0x00, 0x3b, 0x01}, {0x6f, 0x00, 0x49, 0x01}, {0x73, 0x20, 0x56, 0x01},
+  {0x75, 0x00, 0x45, 0x01}, {0x79, 0x22, 0xff, 0x00}, {0x61, 0x00, 0x3d, 0x00},
+  {0x65, 0x00, 0x3c, 0x00}, {0x69, 0x00, 0x3b, 0x01}, {0x6f, 0x00, 0x3f, 0x00},
+  {0x75, 0x00, 0x3e, 0x00}, {0x61, 0x00, 0x3d, 0x01}, {0x65, 0x00, 0x3c, 0x01},
+  {0x6f, 0x00, 0x3f, 0x01}, {0x75, 0x00, 0x3e, 0x01}, {0x61, 0x00, 0x4b, 0x01},
+  {0x65, 0x00, 0x5d, 0x01}, {0x68, 0x24, 0xff, 0x00}, {0x69, 0x00, 0x4d, 0x01},
+  {0x6f, 0x00, 0x63, 0x01}, {0x73, 0x25, 0xff, 0x00}, {0x74, 0x23, 0x56, 0x01},
+  {0x75, 0x00, 0x57, 0x01}, {0x77, 0x26, 0xff, 0x00}, {0x79, 0x27, 0xff, 0x00},
+  {0x69, 0x00, 0x5e, 0x01}, {0x75, 0x00, 0x5f, 0x01}, {0x61, 0x00, 0x58, 0x00},
+  {0x65, 0x00, 0x5a, 0x00}, {0x69, 0x00, 0x59, 0x00}, {0x6f, 0x00, 0x5b, 0x00},
+  {0x75, 0x00, 0x57, 0x01}, {0x75, 0x00, 0x64, 0x01}, {0x61, 0x00, 0x4f, 0x01},
+  {0x65, 0x00, 0x4e, 0x01}, {0x6f, 0x00, 0x51, 0x01}, {0x75, 0x00, 0x50, 0x01},
+  {0x61, 0x00, 0xac, 0x00}, {0x65, 0x00, 0xae, 0x00}, {0x69, 0x00, 0xad, 0x00},
+  {0x6f, 0x00, 0xaf, 0x00}, {0x75, 0x00, 0xab, 0x01}, {0x76, 0x28, 0x56, 0x01},
+  {0x61, 0x00, 0xa5, 0x01}, {0x65, 0x00, 0x0b, 0x01}, {0x69, 0x00, 0x08, 0x01},
+  {0x6f, 0x00, 0xa8, 0x01}, {0x77, 0x29, 0x56, 0x01}, {0x79, 0x2a, 0xff, 0x01},
+  {0x65, 0x00, 0xa7, 0x01}, {0x69, 0x00, 0xa6, 0x01}, {0x61, 0x00, 0x00, 0x01},
+  {0x65, 0x00, 0x23, 0x01}, {0x69, 0x00, 0x02, 0x01}, {0x6b, 0x2c, 0xff, 0x01},
+  {0x6f, 0x00, 0x25, 0x01}, {0x74, 0x2d, 0xff, 0x01}, {0x75, 0x00, 0x05, 0x01},
+  {0x77, 0x2f, 0xff, 0x01}, {0x78, 0x2b, 0x56, 0x01}, {0x79, 0x30, 0xff, 0x01},
+  {0x61, 0x00, 0xb0, 0x01}, {0x65, 0x00, 0xb1, 0x01}, {0x73, 0x2e, 0xff, 0x00},
+  {0x75, 0x00, 0x56, 0x01}, {0x75, 0x00, 0x56, 0x01}, {0x61, 0x00, 0xa4, 0x01},
+  {0x61, 0x00, 0x96, 0x01}, {0x6f, 0x00, 0x9a, 0x01}, {0x75, 0x00, 0x98, 0x01},
+  {0x61, 0x00, 0x97, 0x01}, {0x65, 0x00, 0x04, 0x01}, {0x6f, 0x00, 0x9b, 0x01},
+  {0x75, 0x00, 0x99, 0x01}, {0x79, 0x31, 0x56, 0x01}, {0x61, 0x00, 0x3a, 0x01},
+  {0x65, 0x00, 0x48, 0x01}, {0x69, 0x00, 0x40, 0x01}, {0x6f, 0x00, 0x4a, 0x01},
+  {0x75, 0x00, 0x46, 0x01}, {0x79, 0x33, 0xff, 0x00}, {0x7a, 0x32, 0x56, 0x01},
+  {0x61, 0x00, 0x42, 0x01}, {0x65, 0x00, 0x41, 0x01}, {0x6f, 0x00, 0x44, 0x01},
+  {0x75, 0x00, 0x43, 0x01}, {0x81, 0x35, 0xff, 0x01}, {0x82, 0x39, 0xff, 0x01},
+  {0x81, 0x00, 0x00, 0x01}, {0x82, 0x00, 0x01, 0x01}, {0x83, 0x00, 0x02, 0x01},
+  {0x84, 0x00, 0x03, 0x01}, {0x85, 0x00, 0x05, 0x01}, {0x86, 0x36, 0xff, 0x01},
+  {0x87, 0x00, 0x23, 0x01}, {0x88, 0x00, 0x24, 0x01}, {0x89, 0x00, 0x25, 0x01},
+  {0x8a, 0x00, 0x26, 0x01}, {0x8b, 0x00, 0x27, 0x01}, {0x8c, 0x00, 0x28, 0x01},
+  {0x8d, 0x00, 0x29, 0x01}, {0x8e, 0x00, 0x2d, 0x01}, {0x8f, 0x00, 0x31, 0x01},
+  {0x90, 0x00, 0x33, 0x01}, {0x91, 0x00, 0x35, 0x01}, {0x92, 0x00, 0x36, 0x01},
+  {0x93, 0x00, 0x37, 0x01}, {0x94, 0x00, 0x38, 0x01}, {0x95, 0x00, 0x39, 0x01},
+  {0x96, 0x00, 0x3a, 0x01}, {0x97, 0x00, 0x3b, 0x01}, {0x98, 0x00, 0x40, 0x01},
+  {0x99, 0x00, 0x45, 0x01}, {0x9a, 0x00, 0x46, 0x01}, {0x9b, 0x00, 0x47, 0x01},
+  {0x9c, 0x00, 0x48, 0x01}, {0x9d, 0x00, 0x49, 0x01}, {0x9e, 0x00, 0x4a, 0x01},
+  {0x9f, 0x00, 0x4b, 0x01}, {0xa0, 0x00, 0x4c, 0x01}, {0xa1, 0x00, 0x4d, 0x01},
+  {0xa2, 0x00, 0x52, 0x01}, {0xa3, 0x00, 0x56, 0x01}, {0xa4, 0x00, 0x57, 0x01},
+  {0xa5, 0x00, 0x5c, 0x01}, {0xa6, 0x00, 0x5d, 0x01}, {0xa7, 0x00, 0x60, 0x01},
+  {0xa8, 0x00, 0x63, 0x01}, {0xa9, 0x00, 0x65, 0x01}, {0xaa, 0x00, 0x67, 0x01},
+  {0xab, 0x00, 0x68, 0x01}, {0xac, 0x00, 0x6e, 0x01}, {0xad, 0x00, 0x6f, 0x01},
+  {0xae, 0x00, 0x70, 0x01}, {0xaf, 0x00, 0x71, 0x01}, {0xb0, 0x00, 0x72, 0x01},
+  {0xb1, 0x00, 0x73, 0x01}, {0xb2, 0x00, 0x74, 0x01}, {0xb3, 0x00, 0x78, 0x01},
+  {0xb4, 0x00, 0x7c, 0x01}, {0xb5, 0x00, 0x80, 0x01}, {0xb6, 0x00, 0x86, 0x01},
+  {0xb7, 0x00, 0x87, 0x01}, {0xb8, 0x00, 0x88, 0x01}, {0xb9, 0x00, 0x89, 0x01},
+  {0xba, 0x00, 0x8a, 0x01}, {0xbb, 0x00, 0x8b, 0x01}, {0xbc, 0x00, 0x8c, 0x01},
+  {0xbd, 0x00, 0x8d, 0x01}, {0xbe, 0x00, 0x8e, 0x01}, {0xbf, 0x00, 0x8f, 0x01},
+  {0x00, 0x00, 0x06, 0x01}, {0x2d, 0x00, 0x22, 0x00}, {0x61, 0x00, 0x07, 0x00},
+  {0x62, 0x01, 0x06, 0x00}, {0x63, 0x03, 0x06, 0x00}, {0x64, 0x06, 0x06, 0x00},
+  {0x65, 0x00, 0x0c, 0x00}, {0x66, 0x0a, 0x06, 0x00}, {0x67, 0x0c, 0x06, 0x00},
+  {0x68, 0x0f, 0x06, 0x00}, {0x69, 0x00, 0x09, 0x00}, {0x6a, 0x11, 0x06, 0x00},
+  {0x6b, 0x13, 0x06, 0x00}, {0x6c, 0x16, 0x06, 0x00}, {0x6d, 0x18, 0x06, 0x00},
+  {0x6e, 0x1a, 0x06, 0x00}, {0x6f, 0x00, 0x0d, 0x00}, {0x70, 0x1c, 0x06, 0x00},
+  {0x72, 0x1e, 0x06, 0x00}, {0x73, 0x20, 0x06, 0x00}, {0x74, 0x23, 0x06, 0x00},
+  {0x75, 0x00, 0x0a, 0x00}, {0x76, 0x28, 0x06, 0x00}, {0x77, 0x29, 0x06, 0x00},
+  {0x78, 0x2b, 0x06, 0x00}, {0x79, 0x31, 0x06, 0x00}, {0x7a, 0x32, 0x06, 0x00},
+  {0xe3, 0x37, 0xff, 0x01}, {0x00, 0x00, 0x06, 0x01}, {0x81, 0x35, 0x06, 0x00},
+  {0x82, 0x38, 0xff, 0x01}, {0x00, 0x00, 0x06, 0x01}, {0x80, 0x00, 0x0e, 0x00},
+  {0x81, 0x00, 0x0f, 0x00}, {0x82, 0x00, 0x10, 0x00}, {0x83, 0x00, 0x11, 0x00},
+  {0x84, 0x00, 0x12, 0x00}, {0x85, 0x00, 0x13, 0x00}, {0x86, 0x00, 0x14, 0x00},
+  {0x87, 0x00, 0x15, 0x00}, {0x88, 0x00, 0x16, 0x00}, {0x89, 0x00, 0x17, 0x00},
+  {0x8a, 0x00, 0x18, 0x00}, {0x8b, 0x00, 0x19, 0x00}, {0x8c, 0x00, 0x1a, 0x00},
+  {0x8d, 0x00, 0x1b, 0x00}, {0x8e, 0x00, 0x1c, 0x00}, {0x8f, 0x00, 0x1d, 0x00},
+  {0x90, 0x00, 0x1e, 0x00}, {0x91, 0x00, 0x1f, 0x00}, {0x92, 0x00, 0x20, 0x00},
+  {0x93, 0x00, 0x21, 0x00}, {0x9b, 0x00, 0xab, 0x01}, {0x80, 0x00, 0x93, 0x01},
+  {0x81, 0x00, 0x94, 0x01}, {0x82, 0x00, 0x95, 0x01}, {0x83, 0x00, 0x96, 0x01},
+  {0x84, 0x00, 0x97, 0x01}, {0x85, 0x00, 0x98, 0x01}, {0x86, 0x00, 0x99, 0x01},
+  {0x87, 0x00, 0x9a, 0x01}, {0x88, 0x00, 0x9b, 0x01}, {0x89, 0x00, 0x9c, 0x01},
+  {0x8a, 0x00, 0x9d, 0x01}, {0x8b, 0x00, 0xa1, 0x01}, {0x8c, 0x00, 0xa2, 0x01},
+  {0x8d, 0x00, 0xa3, 0x01}, {0x8e, 0x00, 0xa4, 0x01}, {0x8f, 0x00, 0xa5, 0x01},
+  {0x90, 0x00, 0xa6, 0x01}, {0x91, 0x00, 0xa7, 0x01}, {0x92, 0x00, 0xa8, 0x01},
+  {0x93, 0x00, 0xa9, 0x01}
+};
+
+static rk_tree_node *
+rk_lookup(uint8_t state, uint8_t code)
+{
+  if (state < sizeof(rk_tree_idx)/sizeof(uint16_t)) {
+    uint16_t ns = state ? rk_tree_idx[state - 1] : 0;
+    uint16_t ne = rk_tree_idx[state];
+    while (ns < ne) {
+      uint16_t m = (ns + ne)>>1;
+      rk_tree_node *node = &rk_tree[m];
+      if (node->code == code) { return node; }
+      if (node->code < code) {
+        ns = m + 1;
+      } else {
+        ne = m;
+      }
+    }
+  }
+  return NULL;
+}
+
+static uint32_t
+rk_emit(rk_tree_node *node, char **str)
+{
+  if (node && node->emit != 0xff) {
+    uint16_t pos = node->emit ? rk_str_idx[node->emit - 1] :  0;
+    *str = &rk_str[pos];
+    return (uint32_t)(rk_str_idx[node->emit] - pos);
+  } else {
+    *str = NULL;
+    return 0;
+  }
+}
+
+#define RK_OUTPUT(e,l) {\
+  if (oc < oe) {\
+    uint32_t l_ = (oc + (l) < oe) ? (l) : (oe - oc);\
+    memcpy(oc, (e), l_);\
+    oc += l_;\
+    ic_ = ic;\
+  }\
+}
+
+int
+rk_conv(const char *str, uint32_t str_len, char *buf, uint32_t buf_size)
+{
+  uint32_t l;
+  uint8_t state = 0;
+  rk_tree_node *node;
+  char *e, *oc = buf, *oe = oc + buf_size;
+  const uint8_t *ic = (uint8_t *)str, *ic_ = ic, *ie = ic + str_len;
+  while (ic < ie) {
+    if ((node = rk_lookup(state, *ic))) {
+      ic++;
+      if ((l = rk_emit(node, &e))) { RK_OUTPUT(e, l); }
+      state = node->next;
+    } else {
+      if (!state) { ic++; }
+      if (ic_ < ic) { RK_OUTPUT(ic_, ic - ic_); }
+      state = 0;
+    }
+  }
+  if ((node = rk_lookup(state, 0))) {
+    if ((l = rk_emit(node, &e))) { RK_OUTPUT(e, l); }
+  } else {
+    if (ic_ < ic) { RK_OUTPUT(ic_, ic - ic_); }
+  }
+  return oc - buf;
+}




Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index