Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Silence compiler warnings |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | revised_text | tip-466 |
Files: | files | file ages | folders |
SHA1: |
5677212695d86bd36e9647ba3b866f3e |
User & Date: | fvogel 2017-02-22 21:35:05 |
Context
2017-02-22
| ||
21:36 | Remove this from previous commit. Not yet convinced that -DMODULE_SCOPE="" is the best or correct solution. check-in: 4d30798b user: fvogel tags: revised_text, tip-466 | |
21:35 | Silence compiler warnings check-in: 56772126 user: fvogel tags: revised_text, tip-466 | |
20:30 | Complete the second last commit check-in: 3727f7a0 user: fvogel tags: revised_text, tip-466 | |
Changes
Changes to generic/tkText.c.
︙ | ︙ | |||
2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 | result = TCL_ERROR; goto done; } } for (; i < objc; i += 2) { TkTextIndex index1, index2; if (!TkTextGetIndexFromObj(interp, textPtr, objv[i], &index1)) { if (objPtr) { Tcl_DecrRefCount(objPtr); } result = TCL_ERROR; goto done; | > | 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | result = TCL_ERROR; goto done; } } for (; i < objc; i += 2) { TkTextIndex index1, index2; Tcl_Obj *get; if (!TkTextGetIndexFromObj(interp, textPtr, objv[i], &index1)) { if (objPtr) { Tcl_DecrRefCount(objPtr); } result = TCL_ERROR; goto done; |
︙ | ︙ | |||
2076 2077 2078 2079 2080 2081 2082 | /* * We want to move the text we get from the window into the * result, but since this could in principle be a megabyte or * more, we want to do it efficiently! */ | | | 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 | /* * We want to move the text we get from the window into the * result, but since this could in principle be a megabyte or * more, we want to do it efficiently! */ get = TextGetText(textPtr, &index1, &index2, NULL, NULL, UINT_MAX, visibleOnly, includeHyphens); if (++found == 1) { Tcl_SetObjResult(interp, get); } else { if (found == 2) { /* |
︙ | ︙ | |||
5384 5385 5386 5387 5388 5389 5390 | int compare = TkTextIndexCompare(indexPtr1, indexPtr2); if (compare == 0) { return 0; } if (compare > 0) { | | | 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 | int compare = TkTextIndexCompare(indexPtr1, indexPtr2); if (compare == 0) { return 0; } if (compare > 0) { return -((int)TkTextIndexCount(textPtr, indexPtr2, indexPtr1, type)); } return TkTextIndexCount(textPtr, indexPtr1, indexPtr2, type); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
6133 6134 6135 6136 6137 6138 6139 | if (Tcl_ListObjGetElements(interp, tagPtr, &numTags, &tagNamePtrs) != TCL_OK) { rc = TCL_ERROR; } else if (numTags > 0) { TkTextTag *tagPtr; tagInfoPtr = TkTextTagSetResize(NULL, sharedTextPtr->tagInfoSize); | | | 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 | if (Tcl_ListObjGetElements(interp, tagPtr, &numTags, &tagNamePtrs) != TCL_OK) { rc = TCL_ERROR; } else if (numTags > 0) { TkTextTag *tagPtr; tagInfoPtr = TkTextTagSetResize(NULL, sharedTextPtr->tagInfoSize); for (i = 0; i < (unsigned)numTags; ++i) { tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(tagNamePtrs[i]), NULL); #if !TK_TEXT_DONT_USE_BITFIELDS if (tagPtr->index >= TkTextTagSetSize(tagInfoPtr)) { tagInfoPtr = TkTextTagSetResize(NULL, sharedTextPtr->tagInfoSize); } #endif tagInfoPtr = TkTextTagSetAdd(tagInfoPtr, tagPtr->index); |
︙ | ︙ | |||
8512 8513 8514 8515 8516 8517 8518 | const TkSharedText *sharedTextPtr, Tcl_Obj *objPtr) { if (sharedTextPtr->undoTagListCount > 0 || sharedTextPtr->undoMarkListCount > 0) { Tcl_Obj *resultPtr = Tcl_NewObj(); int i; | | | | 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 | const TkSharedText *sharedTextPtr, Tcl_Obj *objPtr) { if (sharedTextPtr->undoTagListCount > 0 || sharedTextPtr->undoMarkListCount > 0) { Tcl_Obj *resultPtr = Tcl_NewObj(); int i; for (i = 0; i < (int)sharedTextPtr->undoTagListCount; ++i) { TkTextInspectUndoTagItem(sharedTextPtr, sharedTextPtr->undoTagList[i], resultPtr); } for (i = 0; i < (int)sharedTextPtr->undoMarkListCount; ++i) { TkTextInspectUndoMarkItem(sharedTextPtr, &sharedTextPtr->undoMarkList[i], resultPtr); } Tcl_ListObjLength(NULL, resultPtr, &i); if (i == 0) { Tcl_IncrRefCount(resultPtr); Tcl_DecrRefCount(resultPtr); |
︙ | ︙ | |||
9170 9171 9172 9173 9174 9175 9176 | segPtr = TkTextIndexGetContentSegment(&index, &offset1); } lastPtr = TkTextIndexGetContentSegment(indexPtr2, &offset2); if (segPtr == lastPtr) { if (segPtr->typePtr == &tkTextCharType) { | | | | 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 | segPtr = TkTextIndexGetContentSegment(&index, &offset1); } lastPtr = TkTextIndexGetContentSegment(indexPtr2, &offset2); if (segPtr == lastPtr) { if (segPtr->typePtr == &tkTextCharType) { Tcl_AppendToObj(resultPtr, segPtr->body.chars + offset1, MIN((int)maxBytes, offset2 - offset1)); } } else { TkTextLine *linePtr = segPtr->sectionPtr->linePtr; TkTextIndexClear(&index, textPtr); if (segPtr->typePtr == &tkTextCharType) { unsigned nbytes = MIN((int)maxBytes, segPtr->size - offset1); Tcl_AppendToObj(resultPtr, segPtr->body.chars + offset1, nbytes); if ((maxBytes -= nbytes) == 0) { return resultPtr; } } else if (segPtr->typePtr == &tkTextHyphenType) { if (includeHyphens) { Tcl_AppendToObj(resultPtr, "\xc2\xad", 2); /* U+002D */ |
︙ | ︙ | |||
9206 9207 9208 9209 9210 9211 9212 | if (!(segPtr = segPtr->nextPtr)) { assert(linePtr->nextPtr); linePtr = linePtr->nextPtr; segPtr = linePtr->segPtr; } while (segPtr != lastPtr) { if (segPtr->typePtr == &tkTextCharType) { | | | 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 | if (!(segPtr = segPtr->nextPtr)) { assert(linePtr->nextPtr); linePtr = linePtr->nextPtr; segPtr = linePtr->segPtr; } while (segPtr != lastPtr) { if (segPtr->typePtr == &tkTextCharType) { unsigned nbytes = MIN((int)maxBytes, segPtr->size); Tcl_AppendToObj(resultPtr, segPtr->body.chars, nbytes); if ((maxBytes -= nbytes) == 0) { if (lastIndexPtr) { TkTextIndexSetSegment(lastIndexPtr, segPtr); TkTextIndexAddToByteIndex(lastIndexPtr, nbytes); } return resultPtr; /* end of text reached */ |
︙ | ︙ | |||
9238 9239 9240 9241 9242 9243 9244 | if (!(segPtr = segPtr->nextPtr)) { assert(linePtr->nextPtr); linePtr = linePtr->nextPtr; segPtr = linePtr->segPtr; } } if (offset2 > 0) { | | | 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 | if (!(segPtr = segPtr->nextPtr)) { assert(linePtr->nextPtr); linePtr = linePtr->nextPtr; segPtr = linePtr->segPtr; } } if (offset2 > 0) { Tcl_AppendToObj(resultPtr, segPtr->body.chars, MIN((int)maxBytes, offset2)); } } return resultPtr; } /* |
︙ | ︙ |
Changes to generic/tkTextBTree.c.
︙ | ︙ | |||
550 551 552 553 554 555 556 557 558 | return !segPtr->nextPtr; } static TkTextSegment * GetPrevTagInfoSegment( TkTextSegment *segPtr) { assert(segPtr); | > > | | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | return !segPtr->nextPtr; } static TkTextSegment * GetPrevTagInfoSegment( TkTextSegment *segPtr) { TkTextLine *linePtr; assert(segPtr); linePtr = segPtr->sectionPtr->linePtr; for (segPtr = segPtr->prevPtr; segPtr; segPtr = segPtr->prevPtr) { if (segPtr->tagInfoPtr) { return segPtr; } } |
︙ | ︙ | |||
1436 1437 1438 1439 1440 1441 1442 | } /* * Increment the line and pixel counts in all the parent nodes of the * insertion point, then rebalance the tree if necessary. */ | | > | | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | } /* * Increment the line and pixel counts in all the parent nodes of the * insertion point, then rebalance the tree if necessary. */ SubtractPixelCount2(treePtr, nodePtr, -((int)changeToLineCount), -((int)changeToLogicalLineCount), -((int)changeToBranchCount), -((int)size), changeToPixelInfo); linePtr->parentPtr->numChildren += changeToLineCount; if (nodePtr->numChildren > MAX_CHILDREN) { Rebalance(treePtr, nodePtr); } /* |
︙ | ︙ | |||
1743 1744 1745 1746 1747 1748 1749 | TkBTreeUndoIndexToIndex(sharedTextPtr, &token->endIndex, &endIndex); linePtr = TkTextIndexGetLine(&startIndex); segPtr = linePtr->segPtr; nodePtr = linePtr->parentPtr; for (i = 0; i < n; ++i, ++entry) { | | | | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 | TkBTreeUndoIndexToIndex(sharedTextPtr, &token->endIndex, &endIndex); linePtr = TkTextIndexGetLine(&startIndex); segPtr = linePtr->segPtr; nodePtr = linePtr->parentPtr; for (i = 0; i < n; ++i, ++entry) { int skip = entry->skip; int size = entry->size; while (size > 0) { while (linePtr->size - offs <= skip) { assert(linePtr->nextPtr); skip -= linePtr->size - offs; if (anyChanges) { RecomputeLineTagInfo(linePtr, NULL, sharedTextPtr); |
︙ | ︙ | |||
4360 4361 4362 4363 4364 4365 4366 | prevPtr = SplitSeg(indexPtr, &info); } if (info.offset >= 0) { /* * Fill increased/decreased char segment. */ segPtr = prevPtr; | | | 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 | prevPtr = SplitSeg(indexPtr, &info); } if (info.offset >= 0) { /* * Fill increased/decreased char segment. */ segPtr = prevPtr; assert(segPtr->size >= info.offset + (int)chunkSize); memcpy(segPtr->body.chars + info.offset, string, chunkSize); segPtr->sectionPtr->size += chunkSize; linePtr->size += chunkSize; assert(!tagInfoPtr || TkTextTagSetIsEqual(tagInfoPtr, segPtr->tagInfoPtr)); tagInfoPtr = segPtr->tagInfoPtr; } else { /* |
︙ | ︙ | |||
4513 4514 4515 4516 4517 4518 4519 | } /* * Increment the line and pixel counts in all the parent nodes of the * insertion point, then rebalance the tree if necessary. */ | | | | 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 | } /* * Increment the line and pixel counts in all the parent nodes of the * insertion point, then rebalance the tree if necessary. */ SubtractPixelCount2(treePtr, linePtr->parentPtr, -((int)changeToLineCount), -((int)changeToLogicalLineCount), 0, -((int)size), changeToPixelInfo); if ((linePtr->parentPtr->numChildren += changeToLineCount) > MAX_CHILDREN) { Rebalance(treePtr, linePtr->parentPtr); } /* * This line now needs to have its height recalculated. This has to be done after Rebalance. |
︙ | ︙ | |||
5674 5675 5676 5677 5678 5679 5680 | sectionPtr = linePtr->segPtr->sectionPtr; assert(!sectionPtr || !sectionPtr->prevPtr); assert(!linePtr->lastPtr->nextPtr); assert(!propagateChangeOfNumBranches || TkBTreeGetRoot(sharedTextPtr->tree)->numBranches >= linePtr->numBranches); | | | 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 | sectionPtr = linePtr->segPtr->sectionPtr; assert(!sectionPtr || !sectionPtr->prevPtr); assert(!linePtr->lastPtr->nextPtr); assert(!propagateChangeOfNumBranches || TkBTreeGetRoot(sharedTextPtr->tree)->numBranches >= linePtr->numBranches); changeToNumBranches = -(int)linePtr->numBranches; linePtr->numBranches = 0; linePtr->numLinks = 0; linePtr->size = 0; for (segPtr = linePtr->segPtr; segPtr; ) { if (!sectionPtr) { TkTextSection *newSectionPtr; |
︙ | ︙ | |||
5840 5841 5842 5843 5844 5845 5846 | TkTextLine *linePtr) { int i; assert(linePtr->parentPtr); DEBUG(linePtr->parentPtr = NULL); | | | 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 | TkTextLine *linePtr) { int i; assert(linePtr->parentPtr); DEBUG(linePtr->parentPtr = NULL); for (i = 0; i < (int)treePtr->numPixelReferences; ++i) { TkTextDispLineInfo *dispLineInfo = linePtr->pixelInfo[i].dispLineInfo; if (dispLineInfo) { free(dispLineInfo); DEBUG_ALLOC(tkTextCountDestroyDispInfo++); } } |
︙ | ︙ | |||
5927 5928 5929 5930 5931 5932 5933 | TkTextSegment *segPtr, /* Copy text from this segment. */ unsigned offset, /* Copy text starting at this offset. */ unsigned length, /* Number of characters to copy. */ unsigned newSize) /* Character size of the new segment. */ { assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); | | | 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 | TkTextSegment *segPtr, /* Copy text from this segment. */ unsigned offset, /* Copy text starting at this offset. */ unsigned length, /* Number of characters to copy. */ unsigned newSize) /* Character size of the new segment. */ { assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); assert(segPtr->size >= (int)(offset + length)); return MakeCharSeg(segPtr->sectionPtr, segPtr->tagInfoPtr, newSize, segPtr->body.chars + offset, length); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
5961 5962 5963 5964 5965 5966 5967 | { TkTextSegment *newPtr1, *newPtr2; assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); assert(segPtr->sectionPtr); /* otherwise segment is freed */ assert(index > 0); | | | 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 | { TkTextSegment *newPtr1, *newPtr2; assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); assert(segPtr->sectionPtr); /* otherwise segment is freed */ assert(index > 0); assert((int)index < segPtr->size); newPtr1 = CopyCharSeg(segPtr, 0, index, index); newPtr2 = CopyCharSeg(segPtr, index, segPtr->size - index, segPtr->size - index); newPtr1->nextPtr = newPtr2; newPtr1->prevPtr = segPtr->prevPtr; newPtr2->nextPtr = segPtr->nextPtr; |
︙ | ︙ | |||
6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 | static TkTextSegment * PrepareInsertIntoCharSeg( TkTextSegment *segPtr, /* Split or modify this segment. */ unsigned offset, /* Offset in segment. */ SplitInfo *splitInfo) /* Additional arguments. */ { assert(splitInfo); assert(!splitInfo->splitted); assert(splitInfo->increase != 0); assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); | > > | | | | 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 | static TkTextSegment * PrepareInsertIntoCharSeg( TkTextSegment *segPtr, /* Split or modify this segment. */ unsigned offset, /* Offset in segment. */ SplitInfo *splitInfo) /* Additional arguments. */ { unsigned oldCapacity, newCapacity; assert(splitInfo); assert(!splitInfo->splitted); assert(splitInfo->increase != 0); assert(segPtr); assert(segPtr->typePtr == &tkTextCharType); assert((int)offset <= segPtr->size); assert((int)offset < segPtr->size || segPtr->body.chars[segPtr->size - 1] != '\n'); /* * We must not split if the new char content will be appended * to the current content (i.e. offset == segPtr->size). */ if (splitInfo->forceSplit && (int)offset < segPtr->size) { unsigned newSize, decreasedSize; TkTextSegment *newPtr; splitInfo->splitted = true; if (offset == 0 && segPtr == segPtr->sectionPtr->linePtr->segPtr) { /* |
︙ | ︙ | |||
6134 6135 6136 6137 6138 6139 6140 | segPtr->size = decreasedSize; newPtr->size = 0; /* temporary; LinkSegment() should not change total size */ LinkSegment(segPtr->sectionPtr->linePtr, segPtr, newPtr); newPtr->size = newSize; SplitSection(segPtr->sectionPtr); } | | | | 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 | segPtr->size = decreasedSize; newPtr->size = 0; /* temporary; LinkSegment() should not change total size */ LinkSegment(segPtr->sectionPtr->linePtr, segPtr, newPtr); newPtr->size = newSize; SplitSection(segPtr->sectionPtr); } oldCapacity = CSEG_CAPACITY(segPtr->size); newCapacity = CSEG_CAPACITY(segPtr->size + splitInfo->increase); if (oldCapacity != newCapacity) { /* * We replace this segment by a larger (or smaller) one. */ segPtr = IncreaseCharSegment(segPtr, offset, splitInfo->increase); } else { |
︙ | ︙ | |||
6781 6782 6783 6784 6785 6786 6787 | if (curNodePtr == nodePtr1 || curNodePtr == nodePtr2) { /* * Update only those nodes which will not be deleted, * because DeleteEmptyNode will do a faster update. */ SubtractPixelInfo(treePtr, curLinePtr); if (curLinePtr->numBranches) { | | | 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 | if (curNodePtr == nodePtr1 || curNodePtr == nodePtr2) { /* * Update only those nodes which will not be deleted, * because DeleteEmptyNode will do a faster update. */ SubtractPixelInfo(treePtr, curLinePtr); if (curLinePtr->numBranches) { PropagateChangeOfNumBranches(curLinePtr->parentPtr, -(int)curLinePtr->numBranches); } } if (--curNodePtr->numChildren == 0) { DeleteEmptyNode(treePtr, curNodePtr); } } |
︙ | ︙ | |||
7339 7340 7341 7342 7343 7344 7345 | if (!treePtr) { tree = textPtr->sharedTextPtr->tree; treePtr = (BTree *) tree; } nodePtr = treePtr->rootPtr; | | | | | | 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 | if (!treePtr) { tree = textPtr->sharedTextPtr->tree; treePtr = (BTree *) tree; } nodePtr = treePtr->rootPtr; if (line < 0 || (int)nodePtr->numLines <= line) { return NULL; } /* * Check for any start/end offset for this text widget. */ if (textPtr) { line += TkBTreeLinesTo(tree, NULL, TkBTreeGetStartLine(textPtr), NULL); if (line >= (int)nodePtr->numLines) { return NULL; } if (line > (int)TkBTreeLinesTo(tree, NULL, TkBTreeGetLastLine(textPtr), NULL)) { return NULL; } } if (line == 0) { return nodePtr->linePtr; } if (line == nodePtr->numLines - 1) { return nodePtr->lastPtr; } /* * Work down through levels of the tree until a node is found at level 0. */ while (nodePtr->level > 0) { for (nodePtr = nodePtr->childPtr; nodePtr && (int)nodePtr->numLines <= line; nodePtr = nodePtr->nextPtr) { line -= nodePtr->numLines; } assert(nodePtr); } /* |
︙ | ︙ | |||
7431 7432 7433 7434 7435 7436 7437 | pixelReference = textPtr->pixelReference; nodePtr = treePtr->rootPtr; if (0 > pixels) { return NULL; } | | | | | 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 | pixelReference = textPtr->pixelReference; nodePtr = treePtr->rootPtr; if (0 > pixels) { return NULL; } if (pixels >= (int)nodePtr->pixelInfo[pixelReference].pixels) { return TkBTreeGetLastLine(textPtr); } /* * Work down through levels of the tree until a node is found at level 0. */ while (nodePtr->level != 0) { for (nodePtr = nodePtr->childPtr; (int)nodePtr->pixelInfo[pixelReference].pixels <= pixels; nodePtr = nodePtr->nextPtr) { assert(nodePtr); pixels -= nodePtr->pixelInfo[pixelReference].pixels; } } /* * Work through the lines attached to the level-0 node. */ for (linePtr = nodePtr->linePtr; (int)linePtr->pixelInfo[pixelReference].height <= pixels; linePtr = linePtr->nextPtr) { assert(linePtr != nodePtr->lastPtr->nextPtr); pixels -= linePtr->pixelInfo[pixelReference].height; } assert(linePtr); |
︙ | ︙ | |||
9144 9145 9146 9147 9148 9149 9150 | } if (!(flags & HAS_TAGON)) { flags &= ~HAS_TAGOFF; } else if (nchilds < nodePtr->numChildren) { flags |= HAS_TAGOFF; } | | | 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 | } if (!(flags & HAS_TAGON)) { flags &= ~HAS_TAGOFF; } else if (nchilds < nodePtr->numChildren) { flags |= HAS_TAGOFF; } if (nchilds > (unsigned)(nodePtr->level > 0 ? 1 : 0)) { tagPtr->rootPtr = nodePtr; } nodePtr->tagonPtr = TagSetAddOrErase(nodePtr->tagonPtr, tagPtr, !!(flags & HAS_TAGON)); nodePtr->tagoffPtr = TagSetAddOrErase(nodePtr->tagoffPtr, tagPtr, !!(flags & HAS_TAGOFF)); return flags; |
︙ | ︙ | |||
12623 12624 12625 12626 12627 12628 12629 | unsigned memsize; if (nodePtr->level == 0 && !nodePtr->linePtr) { Tcl_Panic("CheckNodeConsistency: this node is freed"); } minChildren = nodePtr->parentPtr ? MIN_CHILDREN : (nodePtr->level > 0 ? 2 : 1); | | | 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 | unsigned memsize; if (nodePtr->level == 0 && !nodePtr->linePtr) { Tcl_Panic("CheckNodeConsistency: this node is freed"); } minChildren = nodePtr->parentPtr ? MIN_CHILDREN : (nodePtr->level > 0 ? 2 : 1); if ((int)nodePtr->numChildren < minChildren || (int)nodePtr->numChildren > MAX_CHILDREN) { Tcl_Panic("CheckNodeConsistency: bad child count (%d)", nodePtr->numChildren); } if (!nodePtr->linePtr) { Tcl_Panic("CheckNodeConsistency: first pointer is NULL"); } if (!nodePtr->lastPtr) { |
︙ | ︙ | |||
12680 12681 12682 12683 12684 12685 12686 | TkTextTagSetIncrRefCount(tagoffPtr = sharedTextPtr->emptyTagInfoPtr); additionalTagoffPtr = NULL; if (nodePtr->level == 0) { prevLinePtr = NULL; linePtr = nodePtr->linePtr; for (linePtr = nodePtr->linePtr; | | | | 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 | TkTextTagSetIncrRefCount(tagoffPtr = sharedTextPtr->emptyTagInfoPtr); additionalTagoffPtr = NULL; if (nodePtr->level == 0) { prevLinePtr = NULL; linePtr = nodePtr->linePtr; for (linePtr = nodePtr->linePtr; numChildren < (int)nodePtr->numChildren; ++numChildren, ++numLines, linePtr = linePtr->nextPtr) { if (!linePtr) { Tcl_Panic("CheckNodeConsistency: unexpected end of line chain"); } if (linePtr->parentPtr != nodePtr) { Tcl_Panic("CheckNodeConsistency: line has wrong parent pointer"); } CheckSegments(sharedTextPtr, linePtr); CheckSegmentItems(sharedTextPtr, linePtr); CheckSections(linePtr); for (i = 0; i < (int)references; ++i) { pixelInfo[i].pixels += linePtr->pixelInfo[i].height; pixelInfo[i].numDispLines += GetDisplayLines(linePtr, i); } if (tagonPtr) { tagonPtr = TkTextTagSetJoin(tagonPtr, linePtr->tagonPtr); tagoffPtr = TkTextTagSetJoin(tagoffPtr, linePtr->tagoffPtr); if (additionalTagoffPtr) { |
︙ | ︙ | |||
12750 12751 12752 12753 12754 12755 12756 | tagoffPtr = TkTextTagSetJoin(tagoffPtr, nodePtr->tagoffPtr); if (additionalTagoffPtr) { additionalTagoffPtr = TkTextTagSetIntersect(additionalTagoffPtr, nodePtr->tagonPtr); } else { TkTextTagSetIncrRefCount(additionalTagoffPtr = nodePtr->tagonPtr); } } | | | 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 | tagoffPtr = TkTextTagSetJoin(tagoffPtr, nodePtr->tagoffPtr); if (additionalTagoffPtr) { additionalTagoffPtr = TkTextTagSetIntersect(additionalTagoffPtr, nodePtr->tagonPtr); } else { TkTextTagSetIncrRefCount(additionalTagoffPtr = nodePtr->tagonPtr); } } for (i = 0; i < (int)references; i++) { pixelInfo[i].pixels += childNodePtr->pixelInfo[i].pixels; pixelInfo[i].numDispLines += childNodePtr->pixelInfo[i].numDispLines; } } } if (size != nodePtr->size) { Tcl_Panic("CheckNodeConsistency: sum of size (%d) at level %d is wrong (%d is expected)", |
︙ | ︙ | |||
12801 12802 12803 12804 12805 12806 12807 | } } TkTextTagSetDecrRefCount(tagonPtr); TkTextTagSetDecrRefCount(tagoffPtr); TkTextTagSetDecrRefCount(additionalTagoffPtr); } | | | 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 | } } TkTextTagSetDecrRefCount(tagonPtr); TkTextTagSetDecrRefCount(tagoffPtr); TkTextTagSetDecrRefCount(additionalTagoffPtr); } for (i = 0; i < (int)references; i++) { if (pixelInfo[i].pixels != nodePtr->pixelInfo[i].pixels) { Tcl_Panic("CheckNodeConsistency: mismatch in pixel count " "(expected: %d, counted: %d) for widget (%d) at level %d", pixelInfo[i].pixels, nodePtr->pixelInfo[i].pixels, i, nodePtr->level); } if (pixelInfo[i].numDispLines != nodePtr->pixelInfo[i].numDispLines) { Tcl_Panic("CheckNodeConsistency: mismatch in number of display lines " |
︙ | ︙ | |||
13863 13864 13865 13866 13867 13868 13869 | int lineNo, numLines; unsigned numDispLines; unsigned ref; assert(textPtr); assert(linePtr->logicalLine || linePtr == TkBTreeGetStartLine(textPtr)); assert(*displayLineNo >= 0); | | | 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 | int lineNo, numLines; unsigned numDispLines; unsigned ref; assert(textPtr); assert(linePtr->logicalLine || linePtr == TkBTreeGetStartLine(textPtr)); assert(*displayLineNo >= 0); assert(*displayLineNo < (int)GetDisplayLines(linePtr, textPtr->pixelReference)); if (offset == 0) { return linePtr; } ref = textPtr->pixelReference; nodePtr = linePtr->parentPtr; |
︙ | ︙ | |||
13998 13999 14000 14001 14002 14003 14004 | unsigned ref; unsigned idx; int lineNo; assert(textPtr); assert(linePtr->logicalLine || linePtr == TkBTreeGetStartLine(textPtr)); assert(*displayLineNo >= 0); | | | 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 | unsigned ref; unsigned idx; int lineNo; assert(textPtr); assert(linePtr->logicalLine || linePtr == TkBTreeGetStartLine(textPtr)); assert(*displayLineNo >= 0); assert(*displayLineNo < (int)GetDisplayLines(linePtr, textPtr->pixelReference)); if (offset == 0) { return linePtr; } ref = textPtr->pixelReference; nodePtr = linePtr->parentPtr; |
︙ | ︙ | |||
14520 14521 14522 14523 14524 14525 14526 | } if (textPtr) { const TkSharedText *sharedTextPtr = treePtr->sharedTextPtr; if (textPtr->startMarker != sharedTextPtr->startMarker) { if (linePtr1 == textPtr->startMarker->sectionPtr->linePtr) { | | | | 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 | } if (textPtr) { const TkSharedText *sharedTextPtr = treePtr->sharedTextPtr; if (textPtr->startMarker != sharedTextPtr->startMarker) { if (linePtr1 == textPtr->startMarker->sectionPtr->linePtr) { assert(TkTextSegToIndex(textPtr->startMarker) <= (int)numBytes); numBytes -= TkTextSegToIndex(textPtr->startMarker); } } if (textPtr->endMarker != sharedTextPtr->endMarker) { if (!SegIsAtStartOfLine(textPtr->endMarker)) { const TkTextLine *linePtr = textPtr->endMarker->sectionPtr->linePtr; assert(linePtr->size - TkTextSegToIndex(textPtr->endMarker) - 1 <= (int)numBytes); numBytes -= linePtr->size - TkTextSegToIndex(textPtr->endMarker) - 1; } } } return numBytes; } |
︙ | ︙ | |||
14607 14608 14609 14610 14611 14612 14613 | /* * We couldn't find a line, so search inside B-Tree for next level-0 * node which contains the byte offset. */ while (parentPtr) { | | | | 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 | /* * We couldn't find a line, so search inside B-Tree for next level-0 * node which contains the byte offset. */ while (parentPtr) { if (!nodePtr || (!HasLeftNode(nodePtr) && byteIndex >= (int)parentPtr->size)) { nodePtr = parentPtr->nextPtr; parentPtr = parentPtr->parentPtr; } else { while (nodePtr) { if (byteIndex < (int)nodePtr->size) { if (nodePtr->level > 0) { nodePtr = nodePtr->childPtr; continue; } /* * We've found the right node, now search for the line. */ |
︙ | ︙ | |||
14721 14722 14723 14724 14725 14726 14727 | for (nPtr = parentPtr->childPtr, idx = 0; nPtr != nodePtr; nPtr = nPtr->nextPtr) { nodeStack[idx++] = nPtr; } nodePtr = idx ? nodeStack[--idx] : NULL; while (parentPtr) { | | | | 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 | for (nPtr = parentPtr->childPtr, idx = 0; nPtr != nodePtr; nPtr = nPtr->nextPtr) { nodeStack[idx++] = nPtr; } nodePtr = idx ? nodeStack[--idx] : NULL; while (parentPtr) { if (!nodePtr || (!nodePtr->nextPtr && byteIndex >= (int)parentPtr->size)) { nodePtr = parentPtr; if ((parentPtr = parentPtr->parentPtr)) { for (nPtr = parentPtr->childPtr, idx = 0; nPtr != nodePtr; nPtr = nPtr->nextPtr) { nodeStack[idx++] = nPtr; } nodePtr = idx ? nodeStack[--idx] : NULL; } } else { while (nodePtr) { if (byteIndex < (int)nodePtr->size) { if (nodePtr->level > 0) { parentPtr = nodePtr; idx = 0; for (nPtr = nodePtr->childPtr; nPtr; nPtr = nPtr->nextPtr) { nodeStack[idx++] = nPtr; } nodePtr = idx ? nodeStack[--idx] : NULL; |
︙ | ︙ |
Changes to win/makefile.vc.
︙ | ︙ | |||
434 435 436 437 438 439 440 | !if $(HAVE_UXTHEME_H) -DHAVE_UXTHEME_H=1 \ !endif !if $(TTK_SQUARE_WIDGET) -DTTK_SQUARE_WIDGET=1 \ !endif | | | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | !if $(HAVE_UXTHEME_H) -DHAVE_UXTHEME_H=1 \ !endif !if $(TTK_SQUARE_WIDGET) -DTTK_SQUARE_WIDGET=1 \ !endif TK_DEFINES =-DBUILD_ttk $(OPTDEFINES) $(CONFIG_DEFS) -Dinline=__inline -DMODULE_SCOPE="" #--------------------------------------------------------------------- # Compile flags #--------------------------------------------------------------------- !if !$(DEBUG) !if $(OPTIMIZING) |
︙ | ︙ |