Example #1
0
static inline void
sasbtree_print(SASStringBTree_t btree)
{
  SASStringBTreeNode_t root = SASStringBTreeGetRootNode(btree);
  if (root)
    {
      printf("{");
      sasbtree_print_node(root);
      printf("}");
    }
  printf("\n");
}
Example #2
0
static inline void
sasbtree_print_node(SASStringBTreeNode_t node)
{
  int i, n;
  n = SASStringBTreeNodeGetCount(node);
  for (i = 0; i <= n; ++i)
    {
      SASStringBTreeNode_t br;
      const char *key = SASStringBTreeNodeGetKeyIndexed(node, i);
      if (!key)
        continue;
      printf("(%s : %s)", SASStringBTreeNodeGetKeyIndexed(node, i),
	(char*)SASStringBTreeNodeGetValIndexed(node, i));
      if ((br = SASStringBTreeNodeGetBranchIndexed(node, i)))
	sasbtree_print_node(br);
      if (i != n)
	printf(", ");
    }
}