Lines Matching full:leaf

123  *                            node, otherwise it is a leaf node
148 * leaf[0]: The unicode version, stored as a generation number that is
152 * leaf[1]: Canonical Combining Class. During normalization, we need
160 * leaf[2]: Decomposition. If leaf[1] == 255, then leaf[2] is the
175 #define LEAF_GEN(LEAF) ((LEAF)[0]) argument
176 #define LEAF_CCC(LEAF) ((LEAF)[1]) argument
177 #define LEAF_STR(LEAF) ((const char*)((LEAF) + 2)) argument
343 #define LEAF 0 macro
383 void *leaf = NULL; in lookup() local
386 while (!leaf && node) { in lookup()
393 } else if (node->rightnode == LEAF) { in lookup()
394 leaf = node->right; in lookup()
402 } else if (node->leftnode == LEAF) { in lookup()
403 leaf = node->left; in lookup()
410 return leaf; in lookup()
429 if (tree->childnode == LEAF) { in tree_walk()
452 if (node->leftnode == LEAF) { in tree_walk()
466 if (node->rightnode == LEAF) { in tree_walk()
527 * Insert a new leaf into the tree, and collapse any subtrees that are
533 static int insert(struct tree *tree, char *key, int keylen, void *leaf) in insert() argument
559 *cursor = leaf; in insert()
564 node->rightnode = LEAF; in insert()
566 node->leftnode = LEAF; in insert()
576 /* Keep left, drop right leaf. */ in insert()
577 leaf = node->left; in insert()
582 tree->root = leaf; in insert()
583 tree->childnode = LEAF; in insert()
585 parent->left = leaf; in insert()
586 parent->leftnode = LEAF; in insert()
594 parent->right = leaf; in insert()
595 parent->rightnode = LEAF; in insert()
640 * Fully populated subtrees that end at the same leaf have already
671 if (tree->childnode == LEAF) in prune()
681 if (node->leftnode == LEAF) in prune()
683 if (node->rightnode == LEAF) in prune()
702 if (left->leftnode == LEAF) in prune()
704 else if (left->rightnode == LEAF) in prune()
716 if (right->leftnode == LEAF) in prune()
718 else if (right->rightnode == LEAF) in prune()
827 if (tree->childnode == LEAF) in mark_nodes()
837 if (node->leftnode == LEAF) { in mark_nodes()
855 if (node->rightnode == LEAF) { in mark_nodes()
885 if (node->leftnode == LEAF) { in mark_nodes()
907 if (node->rightnode == LEAF) { in mark_nodes()
938 * Compute the index of each node and leaf, which is the offset in the
960 if (tree->childnode == LEAF) { in index_nodes()
980 if (node->leftnode == LEAF) { in index_nodes()
995 if (node->rightnode == LEAF) { in index_nodes()
1071 if (tree->childnode == LEAF) in size_nodes()
1103 if (n->rightnode == LEAF) in size_nodes()
1107 if (n->leftnode == LEAF) in size_nodes()
1147 if (node->leftnode == LEAF) { in size_nodes()
1159 if (node->rightnode == LEAF) { in size_nodes()
1209 if (tree->childnode == LEAF) { in emit()
1273 if (node->leftnode == LEAF) { in emit()
1290 if (node->rightnode == LEAF) { in emit()
1417 struct unicode_data *leaf = l; in nfdi_print() local
1419 printf("%*sleaf @ %p code %X ccc %d gen %d", indent, "", leaf, in nfdi_print()
1420 leaf->code, leaf->ccc, leaf->gen); in nfdi_print()
1422 if (leaf->utf8nfdi && leaf->utf8nfdi[0] == HANGUL) in nfdi_print()
1424 else if (leaf->utf8nfdi) in nfdi_print()
1425 printf(" nfdi \"%s\"", (const char*)leaf->utf8nfdi); in nfdi_print()
1432 struct unicode_data *leaf = l; in nfdicf_print() local
1434 printf("%*sleaf @ %p code %X ccc %d gen %d", indent, "", leaf, in nfdicf_print()
1435 leaf->code, leaf->ccc, leaf->gen); in nfdicf_print()
1437 if (leaf->utf8nfdicf) in nfdicf_print()
1438 printf(" nfdicf \"%s\"", (const char*)leaf->utf8nfdicf); in nfdicf_print()
1439 else if (leaf->utf8nfdi && leaf->utf8nfdi[0] == HANGUL) in nfdicf_print()
1441 else if (leaf->utf8nfdi) in nfdicf_print()
1442 printf(" nfdi \"%s\"", (const char*)leaf->utf8nfdi); in nfdicf_print()
1453 struct unicode_data *leaf = l; in nfdicf_mark() local
1455 if (leaf->utf8nfdicf) in nfdicf_mark()
1462 struct unicode_data *leaf = l; in correction_mark() local
1464 return leaf->correction; in correction_mark()
1469 struct unicode_data *leaf = l; in nfdi_size() local
1472 if (HANGUL_SYLLABLE(leaf->code)) in nfdi_size()
1474 else if (leaf->utf8nfdi) in nfdi_size()
1475 size += strlen(leaf->utf8nfdi) + 1; in nfdi_size()
1481 struct unicode_data *leaf = l; in nfdicf_size() local
1484 if (HANGUL_SYLLABLE(leaf->code)) in nfdicf_size()
1486 else if (leaf->utf8nfdicf) in nfdicf_size()
1487 size += strlen(leaf->utf8nfdicf) + 1; in nfdicf_size()
1488 else if (leaf->utf8nfdi) in nfdicf_size()
1489 size += strlen(leaf->utf8nfdi) + 1; in nfdicf_size()
1495 struct unicode_data *leaf = l; in nfdi_index() local
1497 return &tree->leafindex[leaf->code]; in nfdi_index()
1502 struct unicode_data *leaf = l; in nfdicf_index() local
1504 return &tree->leafindex[leaf->code]; in nfdicf_index()
1509 struct unicode_data *leaf = l; in nfdi_emit() local
1512 *data++ = leaf->gen; in nfdi_emit()
1514 if (HANGUL_SYLLABLE(leaf->code)) { in nfdi_emit()
1517 } else if (leaf->utf8nfdi) { in nfdi_emit()
1519 s = (unsigned char*)leaf->utf8nfdi; in nfdi_emit()
1523 *data++ = leaf->ccc; in nfdi_emit()
1530 struct unicode_data *leaf = l; in nfdicf_emit() local
1533 *data++ = leaf->gen; in nfdicf_emit()
1535 if (HANGUL_SYLLABLE(leaf->code)) { in nfdicf_emit()
1538 } else if (leaf->utf8nfdicf) { in nfdicf_emit()
1540 s = (unsigned char*)leaf->utf8nfdicf; in nfdicf_emit()
1543 } else if (leaf->utf8nfdi) { in nfdicf_emit()
1545 s = (unsigned char*)leaf->utf8nfdi; in nfdicf_emit()
1549 *data++ = leaf->ccc; in nfdicf_emit()
1748 utf8leaf_t *leaf; in verify() local
1765 leaf = utf8lookup(tree, hangul, key); in verify()
1767 if (!leaf) { in verify()
1777 if (data->gen != LEAF_GEN(leaf)) in verify()
1779 if (LEAF_CCC(leaf) == DECOMPOSE) { in verify()
1787 LEAF_STR(leaf))) { in verify()
1796 LEAF_STR(leaf))) in verify()
1799 LEAF_STR(leaf))) { in verify()
1803 } else if (data->ccc != LEAF_CCC(leaf)) { in verify()
1813 if (leaf) { in verify()
1816 LEAF_GEN(leaf), in verify()
1817 LEAF_CCC(leaf), in verify()
1818 LEAF_CCC(leaf) == DECOMPOSE ? in verify()
1819 LEAF_STR(leaf) : ""); in verify()
2607 /* Fill in base of leaf. */ in utf8hangul()
2631 * Returns the leaf if one exists, NULL otherwise.
2708 * Returns the leaf if one exists, NULL otherwise.
2736 utf8leaf_t *leaf; in utf8agemax() local
2745 leaf = utf8lookup(tree, hangul, s); in utf8agemax()
2746 if (!leaf) in utf8agemax()
2748 leaf_age = ages[LEAF_GEN(leaf)]; in utf8agemax()
2763 utf8leaf_t *leaf; in utf8agemin() local
2772 leaf = utf8lookup(tree, hangul, s); in utf8agemin()
2773 if (!leaf) in utf8agemin()
2775 leaf_age = ages[LEAF_GEN(leaf)]; in utf8agemin()
2789 utf8leaf_t *leaf; in utf8nagemax() local
2798 leaf = utf8nlookup(tree, hangul, s, len); in utf8nagemax()
2799 if (!leaf) in utf8nagemax()
2801 leaf_age = ages[LEAF_GEN(leaf)]; in utf8nagemax()
2816 utf8leaf_t *leaf; in utf8nagemin() local
2825 leaf = utf8nlookup(tree, hangul, s, len); in utf8nagemin()
2826 if (!leaf) in utf8nagemin()
2828 leaf_age = ages[LEAF_GEN(leaf)]; in utf8nagemin()
2845 utf8leaf_t *leaf; in utf8len() local
2852 leaf = utf8lookup(tree, hangul, s); in utf8len()
2853 if (!leaf) in utf8len()
2855 if (ages[LEAF_GEN(leaf)] > tree->maxage) in utf8len()
2857 else if (LEAF_CCC(leaf) == DECOMPOSE) in utf8len()
2858 ret += strlen(LEAF_STR(leaf)); in utf8len()
2872 utf8leaf_t *leaf; in utf8nlen() local
2879 leaf = utf8nlookup(tree, hangul, s, len); in utf8nlen()
2880 if (!leaf) in utf8nlen()
2882 if (ages[LEAF_GEN(leaf)] > tree->maxage) in utf8nlen()
2884 else if (LEAF_CCC(leaf) == DECOMPOSE) in utf8nlen()
2885 ret += strlen(LEAF_STR(leaf)); in utf8nlen()
2990 utf8leaf_t *leaf; in utf8byte() local
3017 leaf = utf8lookup(u8c->tree, u8c->hangul, u8c->s); in utf8byte()
3019 leaf = utf8nlookup(u8c->tree, u8c->hangul, in utf8byte()
3023 /* No leaf found implies that the input is a binary blob. */ in utf8byte()
3024 if (!leaf) in utf8byte()
3028 if (ages[LEAF_GEN(leaf)] > u8c->tree->maxage) { in utf8byte()
3030 } else if ((ccc = LEAF_CCC(leaf)) == DECOMPOSE) { in utf8byte()
3033 u8c->s = LEAF_STR(leaf); in utf8byte()
3041 leaf = utf8lookup(u8c->tree, u8c->hangul, u8c->s); in utf8byte()
3042 ccc = LEAF_CCC(leaf); in utf8byte()