From fdf8a62f8c24e498f5444a5a110fb51c3b01b8c8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2019 21:27:04 +0000 Subject: CONST -> const. Eliminate unnecessary type-casts and end-of-line spacing --- generic/tkCanvPs.c | 2 +- generic/tkCanvas.c | 4 ++-- generic/tkPlace.c | 2 +- generic/tkStyle.c | 2 +- generic/tkText.c | 2 +- generic/tkTextDisp.c | 4 ++-- generic/tkTextIndex.c | 18 +++++++++--------- generic/tkWindow.c | 2 +- library/text.tcl | 2 +- macosx/README | 2 +- macosx/tkMacOSXHLEvents.c | 8 ++++---- macosx/tkMacOSXInit.c | 34 +++++++++++++++++----------------- macosx/tkMacOSXPrivate.h | 2 +- macosx/tkMacOSXServices.c | 2 +- macosx/tkMacOSXTest.c | 3 +-- unix/tkUnix3d.c | 2 +- unix/tkUnixColor.c | 2 +- 17 files changed, 46 insertions(+), 47 deletions(-) diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 2bfdcc5..4e41a2a 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -381,7 +381,7 @@ TkCanvPostscriptCmd( */ psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode); - if (psInfo.chan == (Tcl_Channel) NULL) { + if (psInfo.chan == NULL) { result = TCL_ERROR; goto cleanup; } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 414c6fb..4d260dc 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -698,7 +698,7 @@ Tk_CanvasObjCmd( canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertOnTime = 0; canvasPtr->insertOffTime = 0; - canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; + canvasPtr->insertBlinkHandler = NULL; canvasPtr->xOrigin = canvasPtr->yOrigin = 0; canvasPtr->drawableXOrigin = canvasPtr->drawableYOrigin = 0; canvasPtr->bindingTable = NULL; @@ -5307,7 +5307,7 @@ CanvasFocusProc( } else { canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; - canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; + canvasPtr->insertBlinkHandler = NULL; } EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr); if (canvasPtr->highlightWidth > 0) { diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 7aa9b04..59b8a2b 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -616,7 +616,7 @@ ConfigureSlave( Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; - Tk_Window masterWin = (Tk_Window) NULL; + Tk_Window masterWin = NULL; TkWindow *master; if (Tk_TopWinHierarchy(tkwin)) { diff --git a/generic/tkStyle.c b/generic/tkStyle.c index e7401df..d9299d1 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1360,7 +1360,7 @@ Tk_GetStyle( "style \"%s\" doesn't exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "STYLE", name, NULL); } - return (Tk_Style) NULL; + return NULL; } stylePtr = Tcl_GetHashValue(entryPtr); diff --git a/generic/tkText.c b/generic/tkText.c index ab06089..7c62621 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -4927,7 +4927,7 @@ DumpLine( TkTextEmbWindow *ewPtr = &segPtr->body.ew; const char *pathname; - if (ewPtr->tkwin == (Tk_Window) NULL) { + if (ewPtr->tkwin == NULL) { pathname = ""; } else { pathname = Tk_PathName(ewPtr->tkwin); diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index fcefb9a..c848fd2 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -626,7 +626,7 @@ static void AsyncUpdateLineMetrics(ClientData clientData); static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync); static void AsyncUpdateYScrollbar(ClientData clientData); static int IsStartOfNotMergedLine(TkText *textPtr, - CONST TkTextIndex *indexPtr); + const TkTextIndex *indexPtr); /* * Result values returned by TextGetScrollInfoObj: @@ -6988,7 +6988,7 @@ FindDLine( static int IsStartOfNotMergedLine( TkText *textPtr, /* Widget record for text widget. */ - CONST TkTextIndex *indexPtr) /* Index to check. */ + const TkTextIndex *indexPtr) /* Index to check. */ { TkTextIndex indexPtr2; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 582e1a8..7430197 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -40,9 +40,9 @@ static const char * StartEnd(TkText *textPtr, const char *string, static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); -static int IndexCountBytesOrdered(CONST TkText *textPtr, - CONST TkTextIndex *indexPtr1, - CONST TkTextIndex *indexPtr2); +static int IndexCountBytesOrdered(const TkText *textPtr, + const TkTextIndex *indexPtr1, + const TkTextIndex *indexPtr2); /* * The "textindex" Tcl_Obj definition: @@ -1636,9 +1636,9 @@ TkTextIndexForwChars( int TkTextIndexCountBytes( - CONST TkText *textPtr, - CONST TkTextIndex *indexPtr1, /* Index describing one location. */ - CONST TkTextIndex *indexPtr2) /* Index describing second location. */ + const TkText *textPtr, + const TkTextIndex *indexPtr1, /* Index describing one location. */ + const TkTextIndex *indexPtr2) /* Index describing second location. */ { int compare = TkTextIndexCmp(indexPtr1, indexPtr2); @@ -1653,11 +1653,11 @@ TkTextIndexCountBytes( static int IndexCountBytesOrdered( - CONST TkText *textPtr, - CONST TkTextIndex *indexPtr1, + const TkText *textPtr, + const TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ - CONST TkTextIndex *indexPtr2) + const TkTextIndex *indexPtr2) /* Index describing location of last character * at which to stop the count. */ { diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 917d3bd..ee8e1a9 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -852,7 +852,7 @@ TkCreateMainWindow( * Create the basic TkWindow structure. */ - tkwin = CreateTopLevelWindow(interp, (Tk_Window) NULL, baseName, + tkwin = CreateTopLevelWindow(interp, NULL, baseName, screenName, /* flags */ 0); if (tkwin == NULL) { return NULL; diff --git a/library/text.tcl b/library/text.tcl index d53aa32..7d12e18 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -1212,6 +1212,6 @@ proc ::tk::TextScanDrag {w x y} { } if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} { $w scan dragto $x $y - } + } } diff --git a/macosx/README b/macosx/README index f35c128..7df4893 100644 --- a/macosx/README +++ b/macosx/README @@ -702,7 +702,7 @@ that LaunchServices is launching the correct Wish.app. Instructions for doing this are provided below. The command line tool which manages the LaunchServices database has -an amazingly unwieldy path name. So, first, run this command: +an amazingly unwieldy path name. So, first, run this command: alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister' diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index d2843a8..0f63ea6 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -126,7 +126,7 @@ static int ReallyKillMe(Tcl_Event *eventPtr, int flags); - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { - + NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *printFile=[file UTF8String]; @@ -134,7 +134,7 @@ static int ReallyKillMe(Tcl_Event *eventPtr, int flags); Tcl_DStringInit(&print); if (Tcl_FindCommand(_eventInterp, "::tk::mac::PrintDocument", NULL, 0)) { Tcl_DStringAppend(&print, "::tk::mac::PrintDocument", -1); - } + } Tcl_DStringAppendElement(&print, printFile); int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&print), Tcl_DStringLength(&print), TCL_EVAL_GLOBAL); @@ -272,7 +272,7 @@ static int ReallyKillMe(Tcl_Event *eventPtr, int flags); Tcl_DStringInit(&launch); if (Tcl_FindCommand(_eventInterp, "::tk::mac::LaunchURL", NULL, 0)) { Tcl_DStringAppend(&launch, "::tk::mac::LaunchURL", -1); - } + } Tcl_DStringAppendElement(&launch, cURL); int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&launch), Tcl_DStringLength(&launch), TCL_EVAL_GLOBAL); @@ -454,7 +454,7 @@ TkMacOSXInitAppleEvents( [aeManager setEventHandler:NSApp andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; - + } } diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 3efe0c6..bf0b9f2 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -388,14 +388,14 @@ TkpInit( TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); + Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath, NULL, NULL); /* * Initialize the NSServices object here. Apple's docs say to do this - * in applicationDidFinishLaunching, but the Tcl interpreter is not - * initialized until this function call. + * in applicationDidFinishLaunching, but the Tcl interpreter is not + * initialized until this function call. */ - + TkMacOSXServices_Init(interp); return TCL_OK; @@ -457,28 +457,28 @@ int TkMacOSXGetAppPath( ClientData cd, Tcl_Interp *ip, int objc, - Tcl_Obj *CONST objv[]) + Tcl_Obj *const objv[]) { CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - - /* - * Convert the URL reference into a string reference. + + /* + * Convert the URL reference into a string reference. */ - + CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); - - /* - * Get the system encoding method. + + /* + * Get the system encoding method. */ - + CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); - - /* - * Convert the string reference into a C string. + + /* + * Convert the string reference into a C string. */ - + char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod); Tcl_SetResult(ip, path, NULL); diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index a67f894..98ee54f 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -431,7 +431,7 @@ VISIBILITY_HIDDEN #endif /* _TKMACPRIV */ -int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]); +int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); /* * Local Variables: diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index 6ecb12d..809c708 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -158,7 +158,7 @@ TkMacOSXRegisterServiceWidgetObjCmd( ClientData cd, Tcl_Interp *ip, int objc, - Tcl_Obj *CONST objv[]) + Tcl_Obj *const objv[]) { /* * Need proper number of args. diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index eabc14e..f109b7a 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -50,8 +50,7 @@ TkplatformtestInit( */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 - Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, - (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, NULL, NULL); #endif return TCL_OK; diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 2969de1..7ea67a1 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -443,7 +443,7 @@ TkpGetShadows( } if (borderPtr->shadow == None) { - borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin, + borderPtr->shadow = Tk_GetBitmap(NULL, tkwin, Tk_GetUid("gray50")); if (borderPtr->shadow == None) { Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border"); diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index 43500ad..ccc6f33 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -157,7 +157,7 @@ TkpGetColor( } if (strlen(name) > 99) { /* Don't bother to parse this. [Bug 2809525]*/ - return (TkColor *) NULL; + return NULL; } else if (XAllocNamedColor(display, colormap, name, &screen, &color) != 0) { DeleteStressedCmap(display, colormap); } else { -- cgit v0.12 From 3efbb66596ac4683c9f362a19e3e6c4bf979d2b5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2019 07:34:12 +0000 Subject: Remove use of/documentation regarding deprecated symbols/macro's, which moved to Tcl headers long ago. --- doc/CrtCmHdlr.3 | 2 +- doc/CrtGenHdlr.3 | 2 +- doc/EventHndlr.3 | 2 +- doc/MoveToplev.3 | 2 +- doc/RestrictEv.3 | 6 +++--- generic/tkGrab.c | 2 +- macosx/tkMacOSXWindowEvent.c | 4 ++-- tests/bind.test | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/CrtCmHdlr.3 b/doc/CrtCmHdlr.3 index 54cee95..92d6865 100644 --- a/doc/CrtCmHdlr.3 +++ b/doc/CrtCmHdlr.3 @@ -33,7 +33,7 @@ drop applications. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that -call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or +call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3 index 1e4f10c..bcf324e 100644 --- a/doc/CrtGenHdlr.3 +++ b/doc/CrtGenHdlr.3 @@ -39,7 +39,7 @@ use with Tk, and so on. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that -call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or +call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3 index 80003d8..3a402e8 100644 --- a/doc/EventHndlr.3 +++ b/doc/EventHndlr.3 @@ -39,7 +39,7 @@ by \fImask\fR occurs in the window specified by \fItkwin\fR. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that -call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or +call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the diff --git a/doc/MoveToplev.3 b/doc/MoveToplev.3 index 18436a3..12f353b 100644 --- a/doc/MoveToplev.3 +++ b/doc/MoveToplev.3 @@ -47,7 +47,7 @@ menus that want to appear at a particular place on the screen. When \fBTk_MoveToplevelWindow\fR is called it does not immediately pass on the new desired location to the window manager; it defers this action until all other outstanding work has been completed, -using the \fBTk_DoWhenIdle\fR mechanism. +using the \fBTcl_DoWhenIdle\fR mechanism. .SH KEYWORDS position, top-level window, window manager diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3 index 0d17806..b5cc907 100644 --- a/doc/RestrictEv.3 +++ b/doc/RestrictEv.3 @@ -31,7 +31,7 @@ Pointer to place to save argument to previous restrict procedure. .PP This procedure is useful in certain situations where applications are only prepared to receive certain X events. After -\fBTk_RestrictEvents\fR is called, \fBTk_DoOneEvent\fR (and +\fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and hence \fBTk_MainLoop\fR) will filter X input events through \fIproc\fR. \fIProc\fR indicates whether a given event is to be processed immediately, deferred until some @@ -49,7 +49,7 @@ to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with information it needs to filter events. The \fIeventPtr\fR points to an event under consideration. \fIProc\fR returns a restrict action (enumerated type \fBTk_RestrictAction\fR) that indicates what -\fBTk_DoOneEvent\fR should do with the event. If the return value is +\fBTcl_DoOneEvent\fR should do with the event. If the return value is \fBTK_PROCESS_EVENT\fR, then the event will be handled immediately. If the return value is \fBTK_DEFER_EVENT\fR, then the event will be left on the event queue for later processing. If the return value is @@ -75,6 +75,6 @@ solution in these situations is to call \fBXNextEvent\fR or \fBXWindowEvent\fR, but these procedures cannot be used because Tk keeps its own event queue that is separate from the X event queue. Instead, call \fBTk_RestrictEvents\fR to set up a filter, -then call \fBTk_DoOneEvent\fR to retrieve the desired event(s). +then call \fBTcl_DoOneEvent\fR to retrieve the desired event(s). .SH KEYWORDS delay, event, filter, restriction diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 44a4f8c..04a1d84 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -1369,7 +1369,7 @@ QueueGrabWindowChange( static int GrabWinEventProc( Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */ - int flags) /* Flags argument to Tk_DoOneEvent: indicates + int flags) /* Flags argument to Tcl_DoOneEvent: indicates * what kinds of events are being processed * right now. */ { diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 75949ba..6d7649c 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -877,7 +877,7 @@ ConfigureRestrictProc( TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height, TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY); oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg); - while (Tk_DoOneEvent(TK_X_EVENTS|TK_DONT_WAIT)) {} + while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} Tk_RestrictEvents(oldProc, oldArg, &oldArg); /* Now that Tk has configured all subwindows we can create the clip regions. */ @@ -889,7 +889,7 @@ ConfigureRestrictProc( HIRect bounds = NSRectToCGRect([self bounds]); HIShapeRef shape = HIShapeCreateWithRect(&bounds); [self generateExposeEvents: shape]; - while (Tk_DoOneEvent(TK_ALL_EVENTS|TK_DONT_WAIT)) {} + while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT)) {} [w enableFlushWindow]; [w flushWindowIfNeeded]; NSEnableScreenUpdates(); diff --git a/tests/bind.test b/tests/bind.test index 3abb615..96449d1 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -2682,7 +2682,7 @@ proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] } -test bind-30.1 {Tk_BackgroundError procedure} { +test bind-30.1 {Tcl_BackgroundError procedure} { setup bind .b.f