Lines Matching refs:nodePtr
51 struct Node *nodePtr; /* Used if level > 0. */
115 static void ChangeNodeToggleCount _ANSI_ARGS_((Node *nodePtr,
125 static void CheckNodeConsistency _ANSI_ARGS_((Node *nodePtr));
128 static void DestroyNode _ANSI_ARGS_((Node *nodePtr));
131 static void Rebalance _ANSI_ARGS_((BTree *treePtr, Node *nodePtr));
132 static void RecomputeNodeCounts _ANSI_ARGS_((Node *nodePtr));
305 * All the storage for nodePtr and its descendants is freed.
311 DestroyNode(nodePtr)
312 register Node *nodePtr;
314 if (nodePtr->level == 0) {
318 while (nodePtr->children.linePtr != NULL) {
319 linePtr = nodePtr->children.linePtr;
320 nodePtr->children.linePtr = linePtr->nextPtr;
331 while (nodePtr->children.nodePtr != NULL) {
332 childPtr = nodePtr->children.nodePtr;
333 nodePtr->children.nodePtr = childPtr->nextPtr;
337 DeleteSummaries(nodePtr->summaryPtr);
338 ckfree((char *) nodePtr);
402 register Node *nodePtr;
490 for (nodePtr = linePtr->parentPtr ; nodePtr != NULL;
491 nodePtr = nodePtr->parentPtr) {
492 nodePtr->numLines += changeToLineCount;
494 nodePtr = linePtr->parentPtr;
495 nodePtr->numChildren += changeToLineCount;
496 if (nodePtr->numChildren > MAX_CHILDREN) {
497 Rebalance((BTree *) indexPtr->tree, nodePtr);
657 Node *curNodePtr, *nodePtr;
702 for (nodePtr = curNodePtr; nodePtr != NULL;
703 nodePtr = nodePtr->parentPtr) {
704 nodePtr->numLines--;
721 if (parentPtr->children.nodePtr == curNodePtr) {
722 parentPtr->children.nodePtr = curNodePtr->nextPtr;
724 Node *prevNodePtr = parentPtr->children.nodePtr;
774 for (nodePtr = curNodePtr; nodePtr != NULL;
775 nodePtr = nodePtr->parentPtr) {
776 nodePtr->numLines--;
832 register Node *nodePtr;
836 nodePtr = treePtr->rootPtr;
838 if ((line < 0) || (line >= nodePtr->numLines)) {
847 while (nodePtr->level != 0) {
848 for (nodePtr = nodePtr->children.nodePtr;
849 nodePtr->numLines <= linesLeft;
850 nodePtr = nodePtr->nextPtr) {
851 if (nodePtr == NULL) {
854 linesLeft -= nodePtr->numLines;
862 for (linePtr = nodePtr->children.linePtr; linesLeft > 0;
897 register Node *nodePtr;
909 for (nodePtr = linePtr->parentPtr; ; nodePtr = nodePtr->parentPtr) {
910 if (nodePtr->nextPtr != NULL) {
911 nodePtr = nodePtr->nextPtr;
914 if (nodePtr->parentPtr == NULL) {
918 while (nodePtr->level > 0) {
919 nodePtr = nodePtr->children.nodePtr;
921 return nodePtr->children.linePtr;
949 register Node *nodePtr;
972 for (nodePtr = linePtr->parentPtr; ; nodePtr = nodePtr->parentPtr) {
973 if (nodePtr == (Node *) NULL || nodePtr->parentPtr == (Node *) NULL) {
976 if (nodePtr != nodePtr->parentPtr->children.nodePtr) {
980 for (node2Ptr = nodePtr->parentPtr->children.nodePtr; ;
981 node2Ptr = node2Ptr->children.nodePtr) {
982 while (node2Ptr->nextPtr != nodePtr) {
988 nodePtr = (Node *)NULL;
1022 register Node *nodePtr, *parentPtr, *nodePtr2;
1030 nodePtr = linePtr->parentPtr;
1032 for (linePtr2 = nodePtr->children.linePtr; linePtr2 != linePtr;
1046 for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL;
1047 nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) {
1048 for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr;
1305 * nodePtr. This routine maintains the tagRootPtr that identifies
1312 ChangeNodeToggleCount(nodePtr, tagPtr, delta)
1313 register Node *nodePtr; /* Node whose toggle count for a tag
1325 tagPtr->tagRootPtr = nodePtr;
1342 for ( ; nodePtr != tagPtr->tagRootPtr; nodePtr = nodePtr->parentPtr) {
1348 for (prevPtr = NULL, summaryPtr = nodePtr->summaryPtr;
1377 nodePtr->summaryPtr = summaryPtr->nextPtr;
1387 if (rootLevel == nodePtr->level) {
1413 summaryPtr->nextPtr = nodePtr->summaryPtr;
1414 nodePtr->summaryPtr = summaryPtr;
1430 nodePtr = tagPtr->tagRootPtr;
1431 while (nodePtr->level > 0) {
1437 for (node2Ptr = nodePtr->children.nodePtr;
1471 nodePtr = tagPtr->tagRootPtr;
1501 register Node *nodePtr;
1507 nodePtr = tagPtr->tagRootPtr;
1508 if (nodePtr == (Node *) NULL) {
1517 while (nodePtr->level > 0) {
1518 for (nodePtr = nodePtr->children.nodePtr ; nodePtr != (Node *) NULL;
1519 nodePtr = nodePtr->nextPtr) {
1520 for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL;
1535 for (linePtr = nodePtr->children.linePtr; linePtr != (TkTextLine *) NULL;
1582 register Node *nodePtr, *lastNodePtr;
1588 nodePtr = tagPtr->tagRootPtr;
1589 if (nodePtr == (Node *) NULL) {
1598 while (nodePtr->level > 0) {
1599 for (lastNodePtr = NULL, nodePtr = nodePtr->children.nodePtr ;
1600 nodePtr != (Node *) NULL; nodePtr = nodePtr->nextPtr) {
1601 for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL;
1604 lastNodePtr = nodePtr;
1609 nodePtr = lastNodePtr;
1618 for (lastLinePtr = NULL, linePtr = nodePtr->children.linePtr;
1879 register Node *nodePtr;
1920 nodePtr = searchPtr->curIndex.linePtr->parentPtr;
1931 if (nodePtr == searchPtr->tagPtr->tagRootPtr) {
1943 while (nodePtr->nextPtr == NULL) {
1944 if (nodePtr->parentPtr == NULL ||
1945 nodePtr->parentPtr == searchPtr->tagPtr->tagRootPtr) {
1948 nodePtr = nodePtr->parentPtr;
1950 nodePtr = nodePtr->nextPtr;
1951 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
1958 searchPtr->linesLeft -= nodePtr->numLines;
1968 while (nodePtr->level > 0) {
1969 for (nodePtr = nodePtr->children.nodePtr; ;
1970 nodePtr = nodePtr->nextPtr) {
1971 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
1978 searchPtr->linesLeft -= nodePtr->numLines;
1979 if (nodePtr->nextPtr == NULL) {
1993 searchPtr->curIndex.linePtr = nodePtr->children.linePtr;
2043 register Node *nodePtr, *node2Ptr, *prevNodePtr;
2114 nodePtr = searchPtr->curIndex.linePtr->parentPtr;
2115 for (prevLinePtr = NULL, linePtr = nodePtr->children.linePtr;
2125 if (nodePtr == searchPtr->tagPtr->tagRootPtr) {
2141 node2Ptr = nodePtr->parentPtr->children.nodePtr ;
2142 node2Ptr != nodePtr; node2Ptr = node2Ptr->nextPtr) {
2158 nodePtr = prevNodePtr;
2162 nodePtr = nodePtr->parentPtr;
2163 if (nodePtr->parentPtr == NULL ||
2164 nodePtr == searchPtr->tagPtr->tagRootPtr) {
2176 while (nodePtr->level > 0) {
2178 nodePtr = nodePtr->children.nodePtr; nodePtr != NULL ;
2179 nodePtr = nodePtr->nextPtr) {
2180 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
2184 prevNodePtr = nodePtr;
2189 linesSkipped += nodePtr->numLines;
2198 nodePtr = prevNodePtr;
2208 for (prevLinePtr = NULL, linePtr = nodePtr->children.linePtr;
2251 register Node *nodePtr;
2307 for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
2308 nodePtr = nodePtr->parentPtr) {
2312 for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
2313 siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
2321 if (nodePtr == tagPtr->tagRootPtr) {
2366 register Node *nodePtr;
2416 for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
2417 nodePtr = nodePtr->parentPtr) {
2421 for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
2422 siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
2547 register Node *nodePtr;
2561 nodePtr = tagPtr->tagRootPtr;
2562 if (nodePtr == (Node *) NULL) {
2575 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
2582 if (nodePtr->level > 0) {
2583 for (nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL ;
2584 nodePtr = nodePtr->nextPtr) {
2585 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
2593 for (linePtr = nodePtr->children.linePtr ; linePtr != NULL ;
2615 nodePtr = treePtr->rootPtr;
2623 if (nodePtr->numLines < 2) {
2626 while (nodePtr->level > 0) {
2627 nodePtr = nodePtr->children.nodePtr;
2628 while (nodePtr->nextPtr != NULL) {
2629 nodePtr = nodePtr->nextPtr;
2632 linePtr = nodePtr->children.linePtr;
2685 CheckNodeConsistency(nodePtr)
2686 register Node *nodePtr; /* Node whose subtree should be
2695 if (nodePtr->parentPtr != NULL) {
2697 } else if (nodePtr->level > 0) {
2702 if ((nodePtr->numChildren < minChildren)
2703 || (nodePtr->numChildren > MAX_CHILDREN)) {
2705 nodePtr->numChildren);
2710 if (nodePtr->level == 0) {
2711 for (linePtr = nodePtr->children.linePtr; linePtr != NULL;
2713 if (linePtr->parentPtr != nodePtr) {
2739 for (childNodePtr = nodePtr->children.nodePtr; childNodePtr != NULL;
2741 if (childNodePtr->parentPtr != nodePtr) {
2744 if (childNodePtr->level != (nodePtr->level-1)) {
2746 nodePtr->level, childNodePtr->level);
2751 for (summaryPtr2 = nodePtr->summaryPtr; ;
2754 if (summaryPtr->tagPtr->tagRootPtr == nodePtr) {
2770 if (numChildren != nodePtr->numChildren) {
2772 numChildren, nodePtr->numChildren);
2774 if (numLines != nodePtr->numLines) {
2776 numLines, nodePtr->numLines);
2779 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
2786 if (nodePtr->level == 0) {
2787 for (linePtr = nodePtr->children.linePtr; linePtr != NULL;
2801 for (childNodePtr = nodePtr->children.nodePtr;
2847 Rebalance(treePtr, nodePtr)
2849 register Node *nodePtr; /* Node that may be out of balance. */
2857 for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) {
2869 if (nodePtr->numChildren > MAX_CHILDREN) {
2876 if (nodePtr->parentPtr == NULL) {
2881 newPtr->level = nodePtr->level + 1;
2882 newPtr->children.nodePtr = nodePtr;
2884 newPtr->numLines = nodePtr->numLines;
2889 newPtr->parentPtr = nodePtr->parentPtr;
2890 newPtr->nextPtr = nodePtr->nextPtr;
2891 nodePtr->nextPtr = newPtr;
2893 newPtr->level = nodePtr->level;
2894 newPtr->numChildren = nodePtr->numChildren - MIN_CHILDREN;
2895 if (nodePtr->level == 0) {
2897 linePtr = nodePtr->children.linePtr;
2905 childPtr = nodePtr->children.nodePtr;
2909 newPtr->children.nodePtr = childPtr->nextPtr;
2912 RecomputeNodeCounts(nodePtr);
2913 nodePtr->parentPtr->numChildren++;
2914 nodePtr = newPtr;
2915 if (nodePtr->numChildren <= MAX_CHILDREN) {
2916 RecomputeNodeCounts(nodePtr);
2922 while (nodePtr->numChildren < MIN_CHILDREN) {
2936 if (nodePtr->parentPtr == NULL) {
2937 if ((nodePtr->numChildren == 1) && (nodePtr->level > 0)) {
2938 treePtr->rootPtr = nodePtr->children.nodePtr;
2940 DeleteSummaries(nodePtr->summaryPtr);
2941 ckfree((char *) nodePtr);
2951 if (nodePtr->parentPtr->numChildren < 2) {
2952 Rebalance(treePtr, nodePtr->parentPtr);
2958 * nodePtr to be the earlier of the pair.
2961 if (nodePtr->nextPtr == NULL) {
2962 for (otherPtr = nodePtr->parentPtr->children.nodePtr;
2963 otherPtr->nextPtr != nodePtr;
2967 nodePtr = otherPtr;
2969 otherPtr = nodePtr->nextPtr;
2979 totalChildren = nodePtr->numChildren + otherPtr->numChildren;
2981 if (nodePtr->children.nodePtr == NULL) {
2982 nodePtr->children = otherPtr->children;
2983 otherPtr->children.nodePtr = NULL;
2986 if (nodePtr->level == 0) {
2989 for (linePtr = nodePtr->children.linePtr, i = 1;
3005 for (childPtr = nodePtr->children.nodePtr, i = 1;
3014 childPtr->nextPtr = otherPtr->children.nodePtr;
3027 RecomputeNodeCounts(nodePtr);
3028 nodePtr->nextPtr = otherPtr->nextPtr;
3029 nodePtr->parentPtr->numChildren--;
3040 if (nodePtr->level == 0) {
3044 otherPtr->children.nodePtr = halfwayNodePtr->nextPtr;
3047 RecomputeNodeCounts(nodePtr);
3068 * The tag counts for nodePtr are modified to reflect its current
3071 * to nodePtr.
3077 RecomputeNodeCounts(nodePtr)
3078 register Node *nodePtr; /* Node whose tag summary information
3092 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
3096 nodePtr->numChildren = 0;
3097 nodePtr->numLines = 0;
3105 if (nodePtr->level == 0) {
3106 for (linePtr = nodePtr->children.linePtr; linePtr != NULL;
3108 nodePtr->numChildren++;
3109 nodePtr->numLines++;
3110 linePtr->parentPtr = nodePtr;
3119 for (summaryPtr = nodePtr->summaryPtr; ;
3125 summaryPtr->nextPtr = nodePtr->summaryPtr;
3126 nodePtr->summaryPtr = summaryPtr;
3137 for (childPtr = nodePtr->children.nodePtr; childPtr != NULL;
3139 nodePtr->numChildren++;
3140 nodePtr->numLines += childPtr->numLines;
3141 childPtr->parentPtr = nodePtr;
3144 for (summaryPtr = nodePtr->summaryPtr; ;
3150 summaryPtr->nextPtr = nodePtr->summaryPtr;
3151 nodePtr->summaryPtr = summaryPtr;
3171 for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL; ) {
3174 if (nodePtr->level == summaryPtr->tagPtr->tagRootPtr->level) {
3179 summaryPtr->tagPtr->tagRootPtr = nodePtr->parentPtr;
3190 summaryPtr->tagPtr->tagRootPtr = nodePtr;
3197 nodePtr->summaryPtr = summaryPtr->nextPtr;
3199 summaryPtr = nodePtr->summaryPtr;