summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-08 14:31:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-08 14:31:23 (GMT)
commit611539b46b3f35feff024c8e9c22b8bf93a025d8 (patch)
tree5c2d300fc6c9b1d294a2a6a6f497ea63dd7684d0 /generic/tkTextDisp.c
parent95850043926d78120ad16b8b972f150c5479587b (diff)
downloadtk-611539b46b3f35feff024c8e9c22b8bf93a025d8.zip
tk-611539b46b3f35feff024c8e9c22b8bf93a025d8.tar.gz
tk-611539b46b3f35feff024c8e9c22b8bf93a025d8.tar.bz2
Fix more warnings related to -Wundef.
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index b1c5e17..6e96127 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -440,7 +440,7 @@ typedef struct TextDInfo {
* points to one of the following structures:
*/
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
@@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr,
static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
static void CharUndisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
@@ -1508,7 +1508,7 @@ LayoutDLine(
}
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr != NULL) {
int expectedX =
((BaseCharInfo *) baseCharChunkPtr->clientData)->width
@@ -1650,7 +1650,7 @@ LayoutDLine(
chunkPtr = NULL;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
@@ -1709,7 +1709,7 @@ LayoutDLine(
segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
byteOffset, maxX, breakByteOffset, 0, wrapMode,
breakChunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
@@ -7628,7 +7628,7 @@ TkTextCharLayoutProc(
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
const char *line;
int lineOffset;
BaseCharInfo *bciPtr;
@@ -7653,7 +7653,7 @@ TkTextCharLayoutProc(
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
bciPtr = ckalloc(sizeof(BaseCharInfo));
@@ -7690,7 +7690,7 @@ TkTextCharLayoutProc(
int ch;
int chLen = TkUtfToUniChar(p, &ch);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
&nextX);
@@ -7734,7 +7734,7 @@ TkTextCharLayoutProc(
bytesThatFit++;
}
if (bytesThatFit == 0) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
chunkPtr->clientData = NULL;
if (chunkPtr == baseCharChunkPtr) {
baseCharChunkPtr = NULL;
@@ -7767,7 +7767,7 @@ TkTextCharLayoutProc(
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, bytesThatFit);
@@ -7778,7 +7778,7 @@ TkTextCharLayoutProc(
ciPtr->numBytes--;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
* Final update for the current base chunk data.
*/
@@ -7883,7 +7883,7 @@ CharChunkMeasureChars(
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (chars == NULL) {
chars = ciPtr->chars;
charsLen = ciPtr->numBytes;
@@ -7975,7 +7975,7 @@ CharDisplayProc(
TextStyle *stylePtr;
StyleValues *sValuePtr;
int numBytes, offsetBytes, offsetX;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
BaseCharInfo *bciPtr;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -7987,12 +7987,12 @@ CharDisplayProc(
return;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
bciPtr = ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
-#elif TK_LAYOUT_WITH_BASE_CHUNKS
+#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (ciPtr->baseChunkPtr != chunkPtr) {
/*
* Without context drawing only base chunks display their foreground.
@@ -8033,7 +8033,7 @@ CharDisplayProc(
if (!sValuePtr->elide && (numBytes > offsetBytes)
&& (stylePtr->fgGC != NULL)) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
int xDisplacement = x - chunkPtr->x;
@@ -8124,7 +8124,7 @@ CharUndisplayProc(
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (chunkPtr == ciPtr->baseChunkPtr) {
/*
* Basechunks are undisplayed first, when DLines are freed or
@@ -8706,7 +8706,7 @@ MeasureChars(
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
start - source, special - start,
maxX >= 0 ? maxX - curX : -1, flags, &width);
@@ -8836,7 +8836,7 @@ TextGetScrollInfoObj(
return TKTEXT_SCROLL_ERROR;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
*----------------------------------------------------------------------
*
@@ -8867,7 +8867,7 @@ FinalizeBaseChunk(
const char *baseChars;
TkTextDispChunk *chunkPtr;
CharInfo *ciPtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int widthAdjust = 0;
int newwidth;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8881,7 +8881,7 @@ FinalizeBaseChunk(
for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
chunkPtr = chunkPtr->nextPtr) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
chunkPtr->x += widthAdjust;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8894,7 +8894,7 @@ FinalizeBaseChunk(
}
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
if (newwidth < chunkPtr->width) {
@@ -8908,7 +8908,7 @@ FinalizeBaseChunk(
ciPtr = addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
addChunkPtr->x += widthAdjust;
CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
&addChunkPtr->width);
@@ -9006,7 +9006,7 @@ IsSameFGStyle(
return 1;
}
-#if !TK_DRAW_IN_CONTEXT
+#if !defined(TK_DRAW_IN_CONTEXT)
if (
#ifdef MAC_OSX_TK
!TkMacOSXCompareColors(style1->fgGC->foreground,
@@ -9022,7 +9022,7 @@ IsSameFGStyle(
sv1 = style1->sValuePtr;
sv2 = style2->sValuePtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
#else
return sv1->tkfont == sv2->tkfont