[Groonga-commit] groonga/groonga at 8598c84 [master] pat: add a utility function for debug print

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 2 09:30:24 JST 2015


Kouhei Sutou	2015-11-02 09:30:24 +0900 (Mon, 02 Nov 2015)

  New Revision: 8598c84766986502fdf446f83e834c1b3afd5770
  https://github.com/groonga/groonga/commit/8598c84766986502fdf446f83e834c1b3afd5770

  Message:
    pat: add a utility function for debug print

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+28 -0)
===================================================================
--- lib/pat.c    2015-11-01 21:42:35 +0900 (cfe11ca)
+++ lib/pat.c    2015-11-02 09:30:24 +0900 (1d125f1)
@@ -108,6 +108,34 @@ enum {
 
 /* patricia array operation */
 
+void
+grn_p_pat_node(grn_ctx *ctx, pat_node *node)
+{
+  if (!node) {
+    printf("#<pat_node:(null)>\n");
+    return;
+  }
+
+  printf("#<pat_node:%p "
+         "left:%p "
+         "right:%p "
+         "deleting:%s "
+         "immediate:%s "
+         "length:%u "
+         "nth-byte:%u "
+         "nth-bit:%u "
+         "terminated:%s"
+         ">\n",
+         node,
+         node->lr[0],
+         node->lr[1],
+         PAT_DEL(node) ? "true" : "false",
+         PAT_IMD(node) ? "true" : "false",
+         PAT_CHK(node) >> 4,
+         (PAT_CHK(node) >> 1) & 0x7,
+         (PAT_CHK(node) & 0x1) ? "true" : "false");
+}
+
 #define PAT_AT(pat,id,n) do {\
   int flags = 0;\
   GRN_IO_ARRAY_AT(pat->io, segment_pat, id, &flags, n);\
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index