From c253a25bf983c9a6f1ac39689d16b886fbbde7bf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 13 Dec 2023 10:09:58 +0000 Subject: Fix Tk_CharBbox/Tk_DrawTextLayout signature (int -> Tcl_Size). Update documentation. --- doc/CrtErrHdlr.3 | 4 ++-- doc/CrtGenHdlr.3 | 4 ++-- doc/CrtImgType.3 | 16 ++++++++-------- doc/CrtSelHdlr.3 | 10 +++++----- doc/EventHndlr.3 | 4 ++-- doc/GetImage.3 | 4 ++-- doc/GetSelect.3 | 4 ++-- doc/ManageGeom.3 | 6 +++--- doc/MeasureChar.3 | 2 +- doc/OwnSelect.3 | 4 ++-- doc/RestrictEv.3 | 6 +++--- doc/SetClassProcs.3 | 6 +++--- doc/SetOptions.3 | 10 +++++----- doc/TextLayout.3 | 6 +++--- generic/tk.decls | 4 ++-- generic/tkDecls.h | 8 ++++---- generic/tkFont.c | 30 ++++++++++++++++-------------- generic/tkInt.decls | 4 ++-- generic/tkIntDecls.h | 5 +++-- generic/tkText.c | 9 +++++---- generic/tkText.h | 6 +++--- generic/tkTextDisp.c | 7 ++++--- generic/tkTextIndex.c | 2 +- 23 files changed, 83 insertions(+), 78 deletions(-) diff --git a/doc/CrtErrHdlr.3 b/doc/CrtErrHdlr.3 index e6ebafe..09dcf8b 100644 --- a/doc/CrtErrHdlr.3 +++ b/doc/CrtErrHdlr.3 @@ -35,7 +35,7 @@ field. If \-1, then match any \fIminor_code\fR value. Procedure to invoke whenever an error event is received for \fIdisplay\fR and matches \fIerror\fR, \fIrequest\fR, and \fIminor\fR. NULL means ignore any matching errors. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .AP Tk_ErrorHandler handler in Token for error handler to delete (return value from a previous @@ -73,7 +73,7 @@ made when the handler was active (see below for more information). following type: .CS typedef int \fBTk_ErrorProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, XErrorEvent *\fIerrEventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3 index 1d6f3d5..aaf3285 100644 --- a/doc/CrtGenHdlr.3 +++ b/doc/CrtGenHdlr.3 @@ -21,7 +21,7 @@ Tk_CreateGenericHandler, Tk_DeleteGenericHandler \- associate procedure callback .AS "Tk_GenericProc" clientData .AP Tk_GenericProc *proc in Procedure to invoke whenever any X event occurs on any display. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION @@ -45,7 +45,7 @@ call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or type \fBTk_GenericProc\fR: .CS typedef int \fBTk_GenericProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, XEvent *\fIeventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3 index 660585f..f59a78e 100644 --- a/doc/CrtImgType.3 +++ b/doc/CrtImgType.3 @@ -16,7 +16,7 @@ Tk_CreateImageType, Tk_GetImageModelData \- define new kind of image .sp \fBTk_CreateImageType\fR(\fItypePtr\fR) .sp -ClientData +void * \fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR) .SH ARGUMENTS .AS "const Tk_ImageType" *typePtrPtr @@ -110,7 +110,7 @@ typedef int \fBTk_ImageCreateProc\fR( Tcl_Obj *const \fIobjv\fR[], const Tk_ImageType *\fItypePtr\fR, Tk_ImageModel \fImodel\fR, - ClientData *\fImodelDataPtr\fR); + void **\fImodelDataPtr\fR); .CE The \fIinterp\fR argument is the interpreter in which the \fBimage\fR command was invoked, and \fIname\fR is the name for the new image, @@ -142,9 +142,9 @@ size of the image and request an initial redisplay. calls \fBTk_GetImage\fR to use a particular image. This procedure must match the following prototype: .CS -typedef ClientData \fBTk_ImageGetProc\fR( +typedef void *\fBTk_ImageGetProc\fR( Tk_Window \fItkwin\fR, - ClientData \fImodelData\fR); + void *\fImodelData\fR); .CE The \fItkwin\fR argument identifies the window in which the image will be used and \fImodelData\fR is the value @@ -163,7 +163,7 @@ to be displayed (i.e., whenever a widget calls \fBTk_RedrawImage\fR). \fIdisplayProc\fR must match the following prototype: .CS typedef void \fBTk_ImageDisplayProc\fR( - ClientData \fIinstanceData\fR, + void *\fIinstanceData\fR, Display *\fIdisplay\fR, Drawable \fIdrawable\fR, int \fIimageX\fR, @@ -199,7 +199,7 @@ canvas item is changed. \fIfreeProc\fR must match the following prototype: .CS typedef void \fBTk_ImageFreeProc\fR( - ClientData \fIinstanceData\fR, + void *\fIinstanceData\fR, Display *\fIdisplay\fR); .CE The \fIinstanceData\fR will be the same as the value returned by @@ -217,7 +217,7 @@ each of the image's instances. \fIdeleteProc\fR must match the following prototype: .CS typedef void \fBTk_ImageDeleteProc\fR( - ClientData \fImodelData\fR); + void *\fImodelData\fR); .CE The \fImodelData\fR argument will be the same as the value stored in \fI*modelDataPtr\fR by \fIcreateProc\fR when the @@ -233,7 +233,7 @@ If there exists an image named \fIname\fR in the interpreter given by \fIinterp\fR, then \fI*typePtrPtr\fR is filled in with type information for the image (the \fItypePtr\fR value passed to \fBTk_CreateImageType\fR when the image type was registered) -and the return value is the ClientData value returned by the +and the return value is the clientData value returned by the \fIcreateProc\fR when the image was created (this is typically a pointer to the image model data structure). If no such image exists then NULL is returned and NULL is stored at \fI*typePtrPtr\fR. diff --git a/doc/CrtSelHdlr.3 b/doc/CrtSelHdlr.3 index 2292ccc..d6d27bb 100644 --- a/doc/CrtSelHdlr.3 +++ b/doc/CrtSelHdlr.3 @@ -32,7 +32,7 @@ commands. Procedure to invoke whenever the selection is owned by \fItkwin\fR and the selection contents are requested in the format given by \fItarget\fR. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .AP Atom format in If the selection requestor is not in this process, \fIformat\fR determines @@ -54,11 +54,11 @@ the selection. The most common form is STRING. \fIProc\fR should have arguments and result that match the type \fBTk_SelectionProc\fR: .CS -typedef int \fBTk_SelectionProc\fR( - ClientData \fIclientData\fR, - int \fIoffset\fR, +typedef Tcl_Size \fBTk_SelectionProc\fR( + void *\fIclientData\fR, + Tcl_Size \fIoffset\fR, char *\fIbuffer\fR, - int \fImaxBytes\fR); + Tcl_Size \fImaxBytes\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_CreateSelHandler\fR. diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3 index cbc5b79..128f8ee 100644 --- a/doc/EventHndlr.3 +++ b/doc/EventHndlr.3 @@ -37,7 +37,7 @@ for which \fIproc\fR should be called. .AP Tk_EventProc *proc in Procedure to invoke whenever an event in \fImask\fR occurs in the window given by \fItkwin\fR. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION @@ -55,7 +55,7 @@ call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or type \fBTk_EventProc\fR: .CS typedef void \fBTk_EventProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, XEvent *\fIeventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR diff --git a/doc/GetImage.3 b/doc/GetImage.3 index 744f9ac..c437db7 100644 --- a/doc/GetImage.3 +++ b/doc/GetImage.3 @@ -32,7 +32,7 @@ Window in which image will be used. Name of image. .AP Tk_ImageChangedProc *changeProc in Procedure for Tk to invoke whenever image content or size changes. -.AP ClientData clientData in +.AP void *clientData in One-word value for Tk to pass to \fIchangeProc\fR. .AP Tk_Image image in Token for image instance; must have been returned by a previous @@ -106,7 +106,7 @@ The \fIchangeProc\fR and \fIclientData\fR arguments to in the image; it must match the following prototype: .CS typedef void \fBTk_ImageChangedProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, int \fIx\fR, int \fIy\fR, int \fIwidth\fR, diff --git a/doc/GetSelect.3 b/doc/GetSelect.3 index 11e837e..455b142 100644 --- a/doc/GetSelect.3 +++ b/doc/GetSelect.3 @@ -30,7 +30,7 @@ Form in which to retrieve selection. .AP Tk_GetSelProc *proc in Procedure to invoke to process pieces of the selection as they are retrieved. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION @@ -44,7 +44,7 @@ should have arguments and result that match the type .PP .CS typedef int \fBTk_GetSelProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tcl_Interp *\fIinterp\fR, char *\fIportion\fR); .CE diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3 index 0c72d69..dd69273 100644 --- a/doc/ManageGeom.3 +++ b/doc/ManageGeom.3 @@ -25,7 +25,7 @@ geometry manager, or NULL to indicate that \fItkwin\fR's geometry should not be managed anymore. The data structure pointed to by \fImgrPtr\fR must be static: Tk keeps a reference to it as long as the window is managed. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to geometry manager callbacks. .BE .SH DESCRIPTION @@ -58,7 +58,7 @@ content window to change its desired geometry. type \fBTk_GeomRequestProc\fR: .CS typedef void \fBTk_GeomRequestProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tk_Window \fItkwin\fR); .CE The parameters to \fIrequestProc\fR will be identical to the @@ -81,7 +81,7 @@ is the same as the window's current geometry manager. arguments and results that match the following prototype: .CS typedef void \fBTk_GeomLostContentProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tk_Window \fItkwin\fR); .CE The parameters to \fIlostContentProc\fR will be identical to the diff --git a/doc/MeasureChar.3 b/doc/MeasureChar.3 index 3959978..0922fd5 100644 --- a/doc/MeasureChar.3 +++ b/doc/MeasureChar.3 @@ -33,7 +33,7 @@ Text to be measured or displayed. Need not be null terminated. Any non-printing meta-characters in the string (such as tabs, newlines, and other control characters) will be measured or displayed in a platform-dependent manner. -.AP int numBytes in +.AP Tcl_Size numBytes in The maximum number of bytes to consider when measuring or drawing \fIstring\fR. Must be greater than or equal to 0. .AP int maxPixels in diff --git a/doc/OwnSelect.3 b/doc/OwnSelect.3 index 0e16eac..67bac55 100644 --- a/doc/OwnSelect.3 +++ b/doc/OwnSelect.3 @@ -23,7 +23,7 @@ Window that is to become new selection owner. The name of the selection to be owned, such as XA_PRIMARY. .AP Tk_LostSelProc *proc in Procedure to invoke when \fItkwin\fR loses selection ownership later. -.AP ClientData clientData in +.AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION @@ -39,7 +39,7 @@ unhighlighting the selection). \fIProc\fR should have arguments and result that match the type \fBTk_LostSelProc\fR: .CS typedef void \fBTk_LostSelProc\fR( - ClientData \fIclientData\fR); + void *\fIclientData\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_OwnSelection\fR, and is diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3 index 8b3af07..f61e764 100644 --- a/doc/RestrictEv.3 +++ b/doc/RestrictEv.3 @@ -21,9 +21,9 @@ Tk_RestrictProc * .AP Tk_RestrictProc *proc in Predicate procedure to call to filter incoming X events. NULL means do not restrict events at all. -.AP ClientData arg in +.AP void *arg in Arbitrary argument to pass to \fIproc\fR. -.AP ClientData *prevArgPtr out +.AP void **prevArgPtr out Pointer to place to save argument to previous restrict procedure. .BE .SH DESCRIPTION @@ -40,7 +40,7 @@ is a procedure with arguments and result that match the type \fBTk_RestrictProc\fR: .CS typedef Tk_RestrictAction \fBTk_RestrictProc\fR( - ClientData \fIarg\fR, + void *\fIarg\fR, XEvent *\fIeventPtr\fR); .CE The \fIarg\fR argument is a copy of the \fIarg\fR passed diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3 index 53f7cce..d8f89a4 100644 --- a/doc/SetClassProcs.3 +++ b/doc/SetClassProcs.3 @@ -22,7 +22,7 @@ Token for window to modify. Pointer to data structure containing widget specific procedures. The data structure pointed to by \fIprocs\fR must be static: Tk keeps a reference to it as long as the window exists. -.AP ClientData instanceData in +.AP void *instanceData in Arbitrary one-word value to pass to widget callbacks. .BE .SH DESCRIPTION @@ -50,7 +50,7 @@ accordingly. \fIworldChangedProc\fR should have arguments and results that match the type \fBTk_ClassWorldChangedProc\fR: .CS typedef void \fBTk_ClassWorldChangedProc\fR( - ClientData \fIinstanceData\fR); + void *\fIinstanceData\fR); .CE The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR will be identical to the \fIinstanceData\fR parameter passed to @@ -63,7 +63,7 @@ arguments and results that match the type \fBTk_ClassCreateProc\fR: typedef Window \fBTk_ClassCreateProc\fR( Tk_Window \fItkwin\fR, Window \fIparent\fR, - ClientData \fIinstanceData\fR); + void *\fIinstanceData\fR); .CE The \fItkwin\fR and \fIinstanceData\fR parameters will be identical to the \fItkwin\fR and \fIinstanceData\fR parameters passed to diff --git a/doc/SetOptions.3 b/doc/SetOptions.3 index c568dd6..bdf502f 100644 --- a/doc/SetOptions.3 +++ b/doc/SetOptions.3 @@ -550,11 +550,11 @@ typedef struct Tk_ObjCustomOption { Tk_CustomOptionGetProc *\fIgetProc\fR; Tk_CustomOptionRestoreProc *\fIrestoreProc\fR; Tk_CustomOptionFreeProc *\fIfreeProc\fR; - ClientData \fIclientData\fR; + void *\fIclientData\fR; } \fBTk_ObjCustomOption\fR; typedef int \fBTk_CustomOptionSetProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tcl_Interp *\fIinterp\fR, Tk_Window \fItkwin\fR, Tcl_Obj **\fIvaluePtr\fR, @@ -564,19 +564,19 @@ typedef int \fBTk_CustomOptionSetProc\fR( int \fIflags\fR); typedef Tcl_Obj *\fBTk_CustomOptionGetProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIrecordPtr\fR, int \fIinternalOffset\fR); typedef void \fBTk_CustomOptionRestoreProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIinternalPtr\fR, char *\fIsaveInternalPtr\fR); typedef void \fBTk_CustomOptionFreeProc\fR( - ClientData \fIclientData\fR, + void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIinternalPtr\fR); .CE diff --git a/doc/TextLayout.3 b/doc/TextLayout.3 index 7df0685..335ab39 100644 --- a/doc/TextLayout.3 +++ b/doc/TextLayout.3 @@ -100,10 +100,10 @@ Point, in pixels, at which to place the upper-left hand corner of the text layout when it is being drawn, or the coordinates of a point (with respect to the upper-left hand corner of the text layout) to check against the text layout. -.AP int firstChar in +.AP Tcl_Size firstChar in The index of the first character to draw from the given text layout. The number 0 means to draw from the beginning. -.AP int lastChar in +.AP Tcl_Size lastChar in The index of the last character up to which to draw. The character specified by \fIlastChar\fR itself will not be drawn. A number less than 0 means to draw all characters in the text layout. @@ -111,7 +111,7 @@ than 0 means to draw all characters in the text layout. Index of the single character to underline in the text layout, or a negative number counting backwards from the end of the string. Any out-of-range number (e.g. INT_MIN) means no underline. -.AP int index in +.AP Tcl_Size index in The index of the character whose bounding box is desired. The bounding box is computed with respect to the upper-left hand corner of the text layout. .AP int "*xPtr, *yPtr" out diff --git a/generic/tk.decls b/generic/tk.decls index ae693d3..d1b5ffb 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -120,7 +120,7 @@ declare 22 { XSetWindowAttributes *attsPtr) } declare 23 { - int Tk_CharBbox(Tk_TextLayout layout, int index, int *xPtr, + int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) } declare 24 { @@ -272,7 +272,7 @@ declare 60 { declare 61 { void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, - int x, int y, int firstChar, int lastChar) + int x, int y, Tcl_Size firstChar, Tcl_Size lastChar) } declare 62 { void Tk_Fill3DPolygon(Tk_Window tkwin, diff --git a/generic/tkDecls.h b/generic/tkDecls.h index cb39e7b..5a6b81a 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -118,7 +118,7 @@ EXTERN void Tk_ChangeWindowAttributes(Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 23 */ -EXTERN int Tk_CharBbox(Tk_TextLayout layout, int index, +EXTERN int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 24 */ @@ -248,7 +248,7 @@ EXTERN void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, EXTERN void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, - int firstChar, int lastChar); + Tcl_Size firstChar, Tcl_Size lastChar); /* 62 */ EXTERN void Tk_Fill3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, @@ -922,7 +922,7 @@ typedef struct TkStubs { Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */ - int (*tk_CharBbox) (Tk_TextLayout layout, int index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ + int (*tk_CharBbox) (Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ @@ -960,7 +960,7 @@ typedef struct TkStubs { void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */ void (*tk_DrawChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, int x, int y); /* 59 */ void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */ - void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar); /* 61 */ + void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, Tcl_Size firstChar, Tcl_Size lastChar); /* 61 */ void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 62 */ void (*tk_Fill3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 63 */ Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp *interp, const char *imageName); /* 64 */ diff --git a/generic/tkFont.c b/generic/tkFont.c index e67be4e..384119c 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -73,9 +73,9 @@ typedef struct LayoutChunk { const char *start; /* Pointer to simple string to be displayed. * This is a pointer into the TkTextLayout's * string. */ - int numBytes; /* The number of bytes in this chunk. */ - int numChars; /* The number of characters in this chunk. */ - int numDisplayChars; /* The number of characters to display when + Tcl_Size numBytes; /* The number of bytes in this chunk. */ + Tcl_Size numChars; /* The number of characters in this chunk. */ + Tcl_Size numDisplayChars; /* The number of characters to display when * this chunk is displayed. Can be less than * numChars if extra space characters were * absorbed by the end of the chunk. This will @@ -98,7 +98,7 @@ typedef struct TextLayout { const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ - int numChunks; /* Number of chunks actually used in following + Tcl_Size numChunks; /* Number of chunks actually used in following * array. */ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN @@ -337,7 +337,7 @@ static void FreeFontObjProc(Tcl_Obj *objPtr); static int GetAttributeInfoObj(Tcl_Interp *interp, const TkFontAttributes *faPtr, Tcl_Obj *objPtr); static LayoutChunk * NewChunk(TextLayout **layoutPtrPtr, int *maxPtr, - const char *start, int numChars, int curX, + const char *start, Tcl_Size numChars, int curX, int newX, int y); static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, TkFontAttributes *faPtr); @@ -1987,7 +1987,8 @@ Tk_ComputeTextLayout( { TkFont *fontPtr = (TkFont *) tkfont; const char *start, *endp, *special; - int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight; + Tcl_Size n; + int y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; LayoutChunk *chunkPtr; @@ -2310,10 +2311,10 @@ Tk_DrawTextLayout( * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2322,7 +2323,8 @@ Tk_DrawTextLayout( TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar); #else TextLayout *layoutPtr = (TextLayout *) layout; - int i, numDisplayChars, drawX; + int i, drawX; + Tcl_Size numDisplayChars; const char *firstByte, *lastByte; LayoutChunk *chunkPtr; @@ -2381,10 +2383,10 @@ TkDrawAngledTextLayout( int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ double angle, - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2743,7 +2745,7 @@ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ - int index, /* The index of the character whose bbox is + Tcl_Size index, /* The index of the character whose bbox is * desired. Negative means count backwards. */ int *xPtr, int *yPtr, /* Filled with the upper-left hand corner, in * pixels, of the bounding box for the @@ -3836,7 +3838,7 @@ NewChunk( TextLayout **layoutPtrPtr, int *maxPtr, const char *start, - int numBytes, + Tcl_Size numBytes, int curX, int newX, int y) @@ -4358,7 +4360,7 @@ TkFontGetFirstTextLayout( { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr; - int numBytesInChunk; + Tcl_Size numBytesInChunk; if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 1f465ca..e6db14e 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -581,8 +581,8 @@ declare 180 { # Angled text API, exposed for Emiliano Gavilán's RBC work. declare 181 { void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, - Tk_TextLayout layout, int x, int y, double angle, int firstChar, - int lastChar) + Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, + Tcl_Size lastChar) } declare 182 { void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index a1cd4ae..42c679f 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -520,7 +520,8 @@ EXTERN const char * TkSmoothPrintProc(void *clientData, Tk_Window tkwin, EXTERN void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, - double angle, int firstChar, int lastChar); + double angle, Tcl_Size firstChar, + Tcl_Size lastChar); /* 182 */ EXTERN void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, GC gc, @@ -729,7 +730,7 @@ typedef struct TkIntStubs { const char * (*tkOrientPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 179 */ const char * (*tkSmoothPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 180 */ - void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ + void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, Tcl_Size lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, double x, double y, double angle); /* 184 */ diff --git a/generic/tkText.c b/generic/tkText.c index ff58398..9421f35 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1417,7 +1417,8 @@ TextWidgetObjCmd( goto done; } if (textPtr->state == TK_TEXT_STATE_NORMAL) { - int lineNum, byteIndex; + int lineNum; + Tcl_Size byteIndex; TkTextIndex index; /* @@ -3229,7 +3230,7 @@ DeleteIndexRange( } for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { int line = 0; - int byteIndex = 0; + Tcl_Size byteIndex = 0; int resetView = 0; if (TkTextIndexCmp(&index2, &tPtr->topIndex) >= 0) { @@ -3314,10 +3315,10 @@ DeleteIndexRange( resetViewCount = 0; for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { - int line = lineAndByteIndex[resetViewCount]; + Tcl_Size line = lineAndByteIndex[resetViewCount]; if (line != -1) { - int byteIndex = lineAndByteIndex[resetViewCount+1]; + Tcl_Size byteIndex = lineAndByteIndex[resetViewCount+1]; TkTextIndex indexTmp; if (tPtr == textPtr) { diff --git a/generic/tkText.h b/generic/tkText.h index 22e45b5..81b925b 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -190,7 +190,7 @@ typedef struct TkTextIndex { TkTextBTree tree; /* Tree containing desired position. */ TkTextLine *linePtr; /* Pointer to line containing position of * interest. */ - int byteIndex; /* Index within line of desired character (0 + Tcl_Size byteIndex; /* Index within line of desired character (0 * means first one). */ struct TkText *textPtr; /* May be NULL, but otherwise the text widget * with which this index is associated. If not @@ -255,7 +255,7 @@ struct TkTextDispChunk { * x-location. */ Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box of character * in chunk. */ - int numBytes; /* Number of bytes that will be displayed in + Tcl_Size numBytes; /* Number of bytes that will be displayed in * the chunk. */ int minAscent; /* Minimum space above the baseline needed by * this chunk. */ @@ -267,7 +267,7 @@ struct TkTextDispChunk { * set by chunk-specific code, but may be * increased to include tab or extra space at * end of line. */ - int breakIndex; /* Index within chunk of last acceptable + Tcl_Size breakIndex; /* Index within chunk of last acceptable * position for a line (break just before this * byte index). <= 0 means don't break during * or immediately after this chunk. */ diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 5ad4509..11ceb59 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -440,7 +440,7 @@ typedef struct TextDInfo { #ifndef TK_LAYOUT_WITH_BASE_CHUNKS typedef struct CharInfo { - int numBytes; /* Number of bytes to display. */ + Tcl_Size numBytes; /* Number of bytes to display. */ char chars[TKFLEXARRAY]; /* UTF characters to display. * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ @@ -452,7 +452,7 @@ typedef struct CharInfo { TkTextDispChunk *baseChunkPtr; int baseOffset; /* Starting offset in base chunk * baseChars. */ - int numBytes; /* Number of bytes that belong to this + Tcl_Size numBytes; /* Number of bytes that belong to this * chunk. */ const char *chars; /* UTF characters to display. Actually points * into the baseChars of the base chunk. Only @@ -7989,7 +7989,8 @@ CharDisplayProc( const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; - int numBytes, offsetBytes, offsetX; + Tcl_Size numBytes, offsetBytes; + int offsetX; #ifdef TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index b0a5c94..14e9106 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -1109,7 +1109,7 @@ TkTextPrintIndex( { TkTextSegment *segPtr; TkTextLine *linePtr; - int numBytes, charIndex; + Tcl_Size numBytes, charIndex; numBytes = indexPtr->byteIndex; charIndex = 0; -- cgit v0.12