From 31d4620e114fa6db5a54816620fafe6764b9158a Mon Sep 17 00:00:00 2001 From: "donal.k.fellows@manchester.ac.uk" Date: Sat, 8 Nov 2008 18:44:39 +0000 Subject: Lots of small changes to make code more pretty and C89-like. --- generic/tk3d.c | 4 +- generic/tkArgv.c | 8 +- generic/tkBitmap.c | 4 +- generic/tkColor.c | 4 +- generic/tkCursor.c | 4 +- generic/tkError.c | 8 +- generic/tkEvent.c | 12 +- generic/tkFocus.c | 6 +- generic/tkGeometry.c | 6 +- generic/tkImage.c | 39 ++-- generic/tkMain.c | 4 +- generic/tkOldConfig.c | 16 +- generic/tkSelect.c | 14 +- generic/tkStyle.c | 4 +- generic/tkText.c | 108 +++++----- generic/tkTextBTree.c | 14 +- generic/tkTextDisp.c | 453 +++++++++++++++++++++--------------------- generic/tkTextIndex.c | 6 +- generic/tkUndo.c | 4 +- generic/tkUtil.c | 4 +- generic/tkWindow.c | 4 +- macosx/tkMacOSXCarbonEvents.c | 5 +- macosx/tkMacOSXDebug.c | 113 +++++++---- macosx/tkMacOSXEntry.c | 92 +++++---- macosx/tkMacOSXMenubutton.c | 6 +- macosx/tkMacOSXNotify.c | 59 +++--- macosx/tkMacOSXScrlbr.c | 14 +- macosx/tkMacOSXXStubs.c | 38 ++-- unix/tkUnixSelect.c | 34 ++-- unix/tkUnixWm.c | 8 +- win/nmakehlp.c | 10 +- win/tkWinClipboard.c | 4 +- win/tkWinDialog.c | 5 +- win/tkWinDraw.c | 10 +- win/tkWinMenu.c | 4 +- win/tkWinTest.c | 11 +- 36 files changed, 586 insertions(+), 553 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index 905e68d..9570ee4 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk3d.c,v 1.21 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.22 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -1331,7 +1331,7 @@ InitBorderObj( Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(objPtr); + typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkBorderObjType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 2935183..8ad8331 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkArgv.c,v 1.16 2008/10/28 22:33:06 nijtmans Exp $ + * RCS: @(#) $Id: tkArgv.c,v 1.17 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -231,7 +231,7 @@ Tk_ParseArgv( typedef int (ArgvFunc)(char *, const char *, const char *); ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src; - if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) { + if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) { srcIndex++; argc--; } @@ -242,8 +242,8 @@ Tk_ParseArgv( const char **); ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src; - argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key, - argc, argv+srcIndex); + argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc, + argv+srcIndex); if (argc < 0) { return TCL_ERROR; } diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index bdbde01..ca40bbc 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBitmap.c,v 1.23 2008/11/05 22:48:58 nijtmans Exp $ + * RCS: @(#) $Id: tkBitmap.c,v 1.24 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -967,7 +967,7 @@ InitBitmapObj( Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(objPtr); + typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkBitmapObjType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; diff --git a/generic/tkColor.c b/generic/tkColor.c index 518e4e0..1c9c792 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkColor.c,v 1.18 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkColor.c,v 1.19 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -714,7 +714,7 @@ InitColorObj( Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(objPtr); + typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkColorObjType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 8d46854..047834d 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCursor.c,v 1.20 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkCursor.c,v 1.21 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -760,7 +760,7 @@ InitCursorObj( Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(objPtr); + typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkCursorObjType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; diff --git a/generic/tkError.c b/generic/tkError.c index 6144093..426c457 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkError.c,v 1.7 2008/08/19 15:52:11 georgeps Exp $ + * RCS: @(#) $Id: tkError.c,v 1.8 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -248,8 +248,8 @@ ErrorProc( && (errorPtr->lastRequest < errEventPtr->serial))) { continue; } - if (errorPtr->errorProc == NULL || (*errorPtr->errorProc)( - errorPtr->clientData, errEventPtr) == 0) { + if (errorPtr->errorProc == NULL || + errorPtr->errorProc(errorPtr->clientData, errEventPtr) == 0) { return 0; } } @@ -281,7 +281,7 @@ ErrorProc( */ couldntHandle: - return (*defaultHandler)(display, errEventPtr); + return defaultHandler(display, errEventPtr); } /* diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 7446ef8..e3f925d 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.36 2008/08/05 20:31:08 jenglish Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.37 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -790,7 +790,7 @@ InvokeGenericHandlers( int done; tsdPtr->handlersActive++; - done = (*curPtr->proc)(curPtr->clientData, eventPtr); + done = curPtr->proc(curPtr->clientData, eventPtr); tsdPtr->handlersActive--; if (done) { return done; @@ -1383,7 +1383,7 @@ Tk_HandleEvent( for (handlerPtr = winPtr->handlerList; handlerPtr != NULL; ) { if ((handlerPtr->mask & mask) != 0) { ip.nextHandler = handlerPtr->nextPtr; - (*(handlerPtr->proc))(handlerPtr->clientData, eventPtr); + handlerPtr->proc(handlerPtr->clientData, eventPtr); handlerPtr = ip.nextHandler; } else { handlerPtr = handlerPtr->nextPtr; @@ -1787,7 +1787,7 @@ WindowEventProc( return 0; } if (tsdPtr->restrictProc != NULL) { - result = (*tsdPtr->restrictProc)(tsdPtr->restrictArg, &wevPtr->event); + result = tsdPtr->restrictProc(tsdPtr->restrictArg, &wevPtr->event); if (result != TK_PROCESS_EVENT) { if (result == TK_DEFER_EVENT) { return 0; @@ -2053,7 +2053,7 @@ TkFinalize( firstExitPtr = exitPtr->nextPtr; Tcl_MutexUnlock(&exitMutex); - (*exitPtr->proc)(exitPtr->clientData); + exitPtr->proc(exitPtr->clientData); ckfree((char *) exitPtr); Tcl_MutexLock(&exitMutex); } @@ -2103,7 +2103,7 @@ TkFinalizeThread( */ tsdPtr->firstExitPtr = exitPtr->nextPtr; - (*exitPtr->proc)(exitPtr->clientData); + exitPtr->proc(exitPtr->clientData); ckfree((char *) exitPtr); } } diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 767244d..bce8191 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFocus.c,v 1.18 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkFocus.c,v 1.19 2008/11/08 18:44:39 dkf Exp $ */ #include "tkInt.h" @@ -1059,8 +1059,8 @@ TkFocusFree( */ void -TkFocusSplit(winPtr) - TkWindow *winPtr; /* Window is the new toplevel. Any focus point +TkFocusSplit( + TkWindow *winPtr) /* Window is the new toplevel. Any focus point * at or below window must be moved to this * new toplevel. */ { diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 2bd9ea7..53bd140 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGeometry.c,v 1.13 2008/04/27 22:38:56 dkf Exp $ + * RCS: @(#) $Id: tkGeometry.c,v 1.14 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -98,7 +98,7 @@ Tk_ManageGeometry( && ((winPtr->geomMgrPtr != mgrPtr) || (winPtr->geomData != clientData)) && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) { - (*winPtr->geomMgrPtr->lostSlaveProc)(winPtr->geomData, tkwin); + winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin); } winPtr->geomMgrPtr = mgrPtr; @@ -154,7 +154,7 @@ Tk_GeometryRequest( winPtr->reqHeight = reqHeight; if ((winPtr->geomMgrPtr != NULL) && (winPtr->geomMgrPtr->requestProc != NULL)) { - (*winPtr->geomMgrPtr->requestProc)(winPtr->geomData, tkwin); + winPtr->geomMgrPtr->requestProc(winPtr->geomData, tkwin); } } diff --git a/generic/tkImage.c b/generic/tkImage.c index 0fb673b..0f25906 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkImage.c,v 1.39 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.40 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -283,13 +283,13 @@ Tk_ImageObjCmd( if (masterPtr->typePtr != NULL) { for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { - (*masterPtr->typePtr->freeProc)(imagePtr->instanceData, + masterPtr->typePtr->freeProc(imagePtr->instanceData, imagePtr->display); - (*imagePtr->changeProc)(imagePtr->widgetClientData, - 0, 0, masterPtr->width, masterPtr->height, + imagePtr->changeProc(imagePtr->widgetClientData, 0, 0, + masterPtr->width, masterPtr->height, masterPtr->width, masterPtr->height); } - (*masterPtr->typePtr->deleteProc)(masterPtr->masterData); + masterPtr->typePtr->deleteProc(masterPtr->masterData); masterPtr->typePtr = NULL; } masterPtr->deleted = 0; @@ -314,8 +314,8 @@ Tk_ImageObjCmd( args[objc] = NULL; } Tcl_Preserve(masterPtr); - if ((*typePtr->createProc)(interp, name, objc, args, typePtr, - (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) { + if (typePtr->createProc(interp, name, objc, args, typePtr, + (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){ EventuallyDeleteImage(masterPtr, 0); Tcl_Release(masterPtr); if (oldimage) { @@ -330,7 +330,7 @@ Tk_ImageObjCmd( masterPtr->typePtr = typePtr; for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { - imagePtr->instanceData = (*typePtr->getProc)(imagePtr->tkwin, + imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin, masterPtr->masterData); } Tcl_SetResult(interp, @@ -479,8 +479,8 @@ Tk_ImageChanged( masterPtr->height = imageHeight; for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { - (*imagePtr->changeProc)(imagePtr->widgetClientData, x, y, - width, height, imageWidth, imageHeight); + imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height, + imageWidth, imageHeight); } } @@ -567,7 +567,7 @@ Tk_GetImage( imagePtr->display = Tk_Display(tkwin); imagePtr->masterPtr = masterPtr; imagePtr->instanceData = - (*masterPtr->typePtr->getProc)(tkwin, masterPtr->masterData); + masterPtr->typePtr->getProc(tkwin, masterPtr->masterData); imagePtr->changeProc = changeProc; imagePtr->widgetClientData = clientData; imagePtr->nextPtr = masterPtr->instancePtr; @@ -613,7 +613,7 @@ Tk_FreeImage( */ if (masterPtr->typePtr != NULL) { - (*masterPtr->typePtr->freeProc)(imagePtr->instanceData, + masterPtr->typePtr->freeProc(imagePtr->instanceData, imagePtr->display); } prevPtr = masterPtr->instancePtr; @@ -691,7 +691,7 @@ Tk_PostscriptImage( */ if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) { - return (*imagePtr->masterPtr->typePtr->postscriptProc)( + return imagePtr->masterPtr->typePtr->postscriptProc( imagePtr->masterPtr->masterData, interp, tkwin, psinfo, x, y, width, height, prepass); } @@ -801,9 +801,9 @@ Tk_RedrawImage( if ((imageY + height) > imagePtr->masterPtr->height) { height = imagePtr->masterPtr->height - imageY; } - (*imagePtr->masterPtr->typePtr->displayProc)( - imagePtr->instanceData, imagePtr->display, drawable, - imageX, imageY, width, height, drawableX, drawableY); + imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData, + imagePtr->display, drawable, imageX, imageY, width, height, + drawableX, drawableY); } /* @@ -902,13 +902,12 @@ DeleteImage( if (typePtr != NULL) { for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { - (*typePtr->freeProc)(imagePtr->instanceData, - imagePtr->display); - (*imagePtr->changeProc)(imagePtr->widgetClientData, 0, 0, + typePtr->freeProc(imagePtr->instanceData, imagePtr->display); + imagePtr->changeProc(imagePtr->widgetClientData, 0, 0, masterPtr->width, masterPtr->height, masterPtr->width, masterPtr->height); } - (*typePtr->deleteProc)(masterPtr->masterData); + typePtr->deleteProc(masterPtr->masterData); } if (masterPtr->instancePtr == NULL) { if (masterPtr->hPtr != NULL) { diff --git a/generic/tkMain.c b/generic/tkMain.c index 396c93f..b008f41 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMain.c,v 1.30 2008/04/27 22:38:56 dkf Exp $ + * RCS: @(#) $Id: tkMain.c,v 1.31 2008/11/08 18:44:40 dkf Exp $ */ #include @@ -255,7 +255,7 @@ Tk_MainEx( * Invoke application-specific initialization. */ - if ((*appInitProc)(interp) != TCL_OK) { + if (appInitProc(interp) != TCL_OK) { TkpDisplayWarning(Tcl_GetStringResult(interp), "Application initialization failed"); } diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 0639817..51c16c6 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkOldConfig.c,v 1.25 2008/10/30 23:18:59 nijtmans Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.26 2008/11/08 18:44:40 dkf Exp $ */ #include "tkPort.h" @@ -543,9 +543,8 @@ DoConfig( break; } case TK_CONFIG_CUSTOM: - if ((*specPtr->customPtr->parseProc)( - specPtr->customPtr->clientData, interp, tkwin, value, - widgRec, specPtr->offset) != TCL_OK) { + if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData, + interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) { return TCL_ERROR; } break; @@ -723,7 +722,7 @@ FormatConfigInfo( if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { ckfree((char *) argv[4]); } else { - (*freeProc)((char *) argv[4]); + freeProc((char *) argv[4]); } } return result; @@ -872,9 +871,8 @@ FormatConfigValue( break; } case TK_CONFIG_CUSTOM: - result = (*specPtr->customPtr->printProc)( - specPtr->customPtr->clientData, tkwin, widgRec, - specPtr->offset, freeProcPtr); + result = specPtr->customPtr->printProc(specPtr->customPtr->clientData, + tkwin, widgRec, specPtr->offset, freeProcPtr); break; default: result = "?? unknown type ??"; @@ -945,7 +943,7 @@ Tk_ConfigureValue( if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { ckfree((char *) result); } else { - (*freeProc)((char *) result); + freeProc((char *) result); } } return TCL_OK; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index f510478..bf31e5b 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkSelect.c,v 1.25 2008/10/28 22:33:06 nijtmans Exp $ + * RCS: @(#) $Id: tkSelect.c,v 1.26 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -435,7 +435,7 @@ Tk_OwnSelection( */ if (clearProc != NULL) { - (*clearProc)(clearData); + clearProc(clearData); } } @@ -499,7 +499,7 @@ Tk_ClearSelection( XSetSelectionOwner(winPtr->display, selection, None, CurrentTime); if (clearProc != NULL) { - (*clearProc)(clearData); + clearProc(clearData); } } @@ -604,7 +604,7 @@ Tk_GetSelection( goto cantget; } buffer[count] = 0; - result = (*proc)(clientData, interp, buffer); + result = proc(clientData, interp, buffer); } else { offset = 0; result = TCL_OK; @@ -612,7 +612,7 @@ Tk_GetSelection( ip.nextPtr = tsdPtr->pendingPtr; tsdPtr->pendingPtr = &ip; while (1) { - count = (selPtr->proc)(selPtr->clientData, offset, buffer, + count = selPtr->proc(selPtr->clientData, offset, buffer, TK_SEL_BYTES_AT_ONCE); if ((count < 0) || (ip.selPtr == NULL)) { tsdPtr->pendingPtr = ip.nextPtr; @@ -622,7 +622,7 @@ Tk_GetSelection( Tcl_Panic("selection handler returned too many bytes"); } buffer[count] = '\0'; - result = (*proc)(clientData, interp, buffer); + result = proc(clientData, interp, buffer); if ((result != TCL_OK) || (count < TK_SEL_BYTES_AT_ONCE) || (ip.selPtr == NULL)) { break; @@ -1259,7 +1259,7 @@ TkSelClearSelection( */ if (infoPtr->clearProc != NULL) { - (*infoPtr->clearProc)(infoPtr->clearData); + infoPtr->clearProc(infoPtr->clearData); } ckfree((char *) infoPtr); } diff --git a/generic/tkStyle.c b/generic/tkStyle.c index b4815a5..a3262bf 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStyle.c,v 1.10 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkStyle.c,v 1.11 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -1497,7 +1497,7 @@ SetStyleFromAny( name = Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(objPtr); + typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &styleObjType; diff --git a/generic/tkText.c b/generic/tkText.c index eed86c5..59a855f 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.83 2008/10/30 23:18:59 nijtmans Exp $ + * RCS: @(#) $Id: tkText.c,v 1.84 2008/11/08 18:44:40 dkf Exp $ */ #include "default.h" @@ -443,7 +443,7 @@ Tk_TextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -513,7 +513,7 @@ CreateWidget( textPtr->interp = interp; textPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(textPtr->tkwin), TextWidgetObjCmd, - (ClientData) textPtr, TextCmdDeletedProc); + textPtr, TextCmdDeletedProc); if (sharedPtr == NULL) { sharedPtr = (TkSharedText *) ckalloc(sizeof(TkSharedText)); @@ -628,18 +628,18 @@ CreateWidget( optionTable = Tk_CreateOptionTable(interp, optionSpecs); Tk_SetClass(textPtr->tkwin, "Text"); - Tk_SetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr); + Tk_SetClassProcs(textPtr->tkwin, &textClass, textPtr); textPtr->optionTable = optionTable; Tk_CreateEventHandler(textPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - TextEventProc, (ClientData) textPtr); + TextEventProc, textPtr); Tk_CreateEventHandler(textPtr->tkwin, KeyPressMask|KeyReleaseMask |ButtonPressMask|ButtonReleaseMask|EnterWindowMask |LeaveWindowMask|PointerMotionMask|VirtualEventMask, - TkTextBindProc, (ClientData) textPtr); + TkTextBindProc, textPtr); Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING, - TextFetchSelection, (ClientData) textPtr, XA_STRING); + TextFetchSelection, textPtr, XA_STRING); if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin) != TCL_OK) { @@ -651,8 +651,7 @@ CreateWidget( return TCL_ERROR; } - Tcl_SetObjResult(interp, - Tcl_NewStringObj(Tk_PathName(textPtr->tkwin),-1)); + Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin)); return TCL_OK; } @@ -681,7 +680,7 @@ TextWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; int result = TCL_OK; int index; @@ -1532,7 +1531,7 @@ SharedTextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkSharedText *sharedPtr = (TkSharedText *) clientData; + register TkSharedText *sharedPtr = clientData; int result = TCL_OK; int index; @@ -2197,7 +2196,7 @@ ConfigureText( if (TkBTreeCharTagged(&first, textPtr->selTagPtr) || TkBTreeNextTag(&search)) { Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection, - (ClientData) textPtr); + textPtr); textPtr->flags |= GOT_SELECTION; } } @@ -2209,7 +2208,7 @@ ConfigureText( if (textPtr->flags & GOT_FOCUS) { Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler); textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; - TextBlinkProc((ClientData) textPtr); + TextBlinkProc(textPtr); } /* @@ -2252,9 +2251,8 @@ static void TextWorldChangedCallback( ClientData instanceData) /* Information about widget. */ { - TkText *textPtr; + TkText *textPtr = instanceData; - textPtr = (TkText *) instanceData; TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY); } @@ -2340,7 +2338,7 @@ TextEventProc( ClientData clientData, /* Information about window. */ register XEvent *eventPtr) /* Information about event. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; TkTextIndex index, index2; if (eventPtr->type == Expose) { @@ -2400,8 +2398,7 @@ TextEventProc( textPtr->flags |= GOT_FOCUS | INSERT_ON; if (textPtr->insertOffTime != 0) { textPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - textPtr->insertOnTime, TextBlinkProc, - (ClientData) textPtr); + textPtr->insertOnTime, TextBlinkProc, textPtr); } } else { textPtr->flags &= ~(GOT_FOCUS | INSERT_ON); @@ -2450,7 +2447,7 @@ static void TextCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkText *textPtr = (TkText *) clientData; + TkText *textPtr = clientData; Tk_Window tkwin = textPtr->tkwin; /* @@ -2718,13 +2715,13 @@ TextPushUndoAction( * underlying data shared by all peers. */ - iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, - (ClientData)textPtr->sharedTextPtr, insertCmdObj, NULL); + iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, + insertCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom); - dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, - (ClientData)textPtr->sharedTextPtr, deleteCmdObj, NULL); + dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, + deleteCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom); @@ -2773,7 +2770,7 @@ TextUndoRedoCallback( Tcl_Obj *objPtr) /* Arguments of a command to be handled by the * shared text data structure. */ { - TkSharedText *sharedPtr = (TkSharedText *) clientData; + TkSharedText *sharedPtr = clientData; int res, objc; Tcl_Obj **objv; TkText *textPtr; @@ -2838,7 +2835,7 @@ TextUndoRedoCallback( * the Tcl level. */ - return SharedTextObjCmd((ClientData)sharedPtr, interp, objc+1, objv-1); + return SharedTextObjCmd(sharedPtr, interp, objc+1, objv-1); } /* @@ -3199,7 +3196,7 @@ TextFetchSelection( * not including terminating NULL * character. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; @@ -3330,7 +3327,7 @@ void TkTextLostSelection( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; @@ -3424,7 +3421,7 @@ static void TextBlinkProc( ClientData clientData) /* Pointer to record describing text. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; TkTextIndex index; int x, y, w, h, charWidth; @@ -3444,11 +3441,11 @@ TextBlinkProc( if (textPtr->flags & INSERT_ON) { textPtr->flags &= ~INSERT_ON; textPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - textPtr->insertOffTime, TextBlinkProc, (ClientData) textPtr); + textPtr->insertOffTime, TextBlinkProc, textPtr); } else { textPtr->flags |= INSERT_ON; textPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - textPtr->insertOnTime, TextBlinkProc, (ClientData) textPtr); + textPtr->insertOnTime, TextBlinkProc, textPtr); } redrawInsert: TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); @@ -3604,7 +3601,7 @@ TextSearchCmd( searchSpec.strictLimits = 0; searchSpec.numLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr); - searchSpec.clientData = (ClientData)textPtr; + searchSpec.clientData = textPtr; searchSpec.addLineProc = &TextSearchAddNextLine; searchSpec.foundMatchProc = &TextSearchFoundMatch; searchSpec.lineIndexProc = &TextSearchGetLineIndex; @@ -3789,7 +3786,7 @@ TextSearchGetLineIndex( { const TkTextIndex *indexPtr; int line; - TkText *textPtr = (TkText *) searchSpecPtr->clientData; + TkText *textPtr = searchSpecPtr->clientData; indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr); if (indexPtr == NULL) { @@ -3854,7 +3851,7 @@ TextSearchIndexInLine( TkTextSegment *segPtr; TkTextIndex curIndex; int index, leftToScan; - TkText *textPtr = (TkText *) searchSpecPtr->clientData; + TkText *textPtr = searchSpecPtr->clientData; index = 0; curIndex.tree = textPtr->sharedTextPtr->tree; @@ -3924,7 +3921,7 @@ TextSearchAddNextLine( TkTextLine *linePtr, *thisLinePtr; TkTextIndex curIndex; TkTextSegment *segPtr; - TkText *textPtr = (TkText *) searchSpecPtr->clientData; + TkText *textPtr = searchSpecPtr->clientData; int nothingYet = 1; /* @@ -4001,7 +3998,7 @@ TextSearchAddNextLine( *lenPtr = Tcl_GetCharLength(theLine); } } - return (ClientData)linePtr; + return linePtr; } /* @@ -4045,7 +4042,7 @@ TextSearchFoundMatch( TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; - TkText *textPtr = (TkText *) searchSpecPtr->clientData; + TkText *textPtr = searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { /* @@ -4096,7 +4093,7 @@ TextSearchFoundMatch( * reached the end of the match or we have reached the end of the line. */ - linePtr = (TkTextLine *)clientData; + linePtr = clientData; if (linePtr == NULL) { linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr, lineNum); @@ -5240,7 +5237,7 @@ SearchPerform( * for regexp search, utf-8 bytes for exact search). */ - if ((*searchSpecPtr->lineIndexProc)(interp, fromPtr, searchSpecPtr, + if (searchSpecPtr->lineIndexProc(interp, fromPtr, searchSpecPtr, &searchSpecPtr->startLine, &searchSpecPtr->startOffset) != TCL_OK) { return TCL_ERROR; @@ -5252,7 +5249,7 @@ SearchPerform( if (toPtr != NULL) { const TkTextIndex *indexToPtr, *indexFromPtr; - TkText *textPtr = (TkText *) searchSpecPtr->clientData; + TkText *textPtr = searchSpecPtr->clientData; indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr); if (indexToPtr == NULL) { @@ -5276,7 +5273,7 @@ SearchPerform( } } - if ((*searchSpecPtr->lineIndexProc)(interp, toPtr, searchSpecPtr, + if (searchSpecPtr->lineIndexProc(interp, toPtr, searchSpecPtr, &searchSpecPtr->stopLine, &searchSpecPtr->stopOffset) != TCL_OK) { return TCL_ERROR; @@ -5462,8 +5459,8 @@ SearchCore( * this line, which is what 'lastOffset' represents. */ - lineInfo = (*searchSpecPtr->addLineProc)(lineNum, searchSpecPtr, - theLine, &lastOffset, &linesSearched); + lineInfo = searchSpecPtr->addLineProc(lineNum, searchSpecPtr, theLine, + &lastOffset, &linesSearched); if (lineInfo == NULL) { /* @@ -5647,7 +5644,7 @@ SearchCore( */ if (extraLines > maxExtraLines) { - if ((*searchSpecPtr->addLineProc)(lineNum + if (searchSpecPtr->addLineProc(lineNum + extraLines, searchSpecPtr, theLine, &lastTotal, &extraLines) == NULL) { p = NULL; @@ -5727,9 +5724,8 @@ SearchCore( matchOffset = p - startOfLine; if (searchSpecPtr->all && - !(*searchSpecPtr->foundMatchProc)(lineNum, - searchSpecPtr, lineInfo, theLine, matchOffset, - matchLength)) { + !searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, + lineInfo, theLine, matchOffset, matchLength)) { /* * We reached the end of the search. */ @@ -5870,7 +5866,7 @@ SearchCore( */ if (extraLines > maxExtraLines) { - if ((*searchSpecPtr->addLineProc)(lineNum + if (searchSpecPtr->addLineProc(lineNum + extraLines, searchSpecPtr, theLine, &lastTotal, &extraLines) == NULL) { /* @@ -6049,9 +6045,9 @@ SearchCore( if (lastBackwardsLineMatch != -1) { recordBackwardsMatch: - (*searchSpecPtr->foundMatchProc)( - lastBackwardsLineMatch, searchSpecPtr, NULL, - NULL, lastBackwardsMatchOffset, matchLength); + searchSpecPtr->foundMatchProc(lastBackwardsLineMatch, + searchSpecPtr, NULL, NULL, + lastBackwardsMatchOffset, matchLength); lastBackwardsLineMatch = -1; if (!searchSpecPtr->all) { goto searchDone; @@ -6116,7 +6112,7 @@ SearchCore( */ if (searchSpecPtr->all && - !(*searchSpecPtr->foundMatchProc)(lineNum, + !searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength)) { /* @@ -6207,7 +6203,7 @@ SearchCore( continue; } } - (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, + searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength); if (!searchSpecPtr->all) { goto searchDone; @@ -6222,7 +6218,7 @@ SearchCore( * non-all case. */ - (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, + searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength); } else { lastBackwardsLineMatch = lineNum; @@ -6241,7 +6237,7 @@ SearchCore( if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0) && !searchSpecPtr->all) { - (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, lineInfo, + searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength); goto searchDone; } @@ -6268,7 +6264,7 @@ SearchCore( if (lastBackwardsLineMatch != -1 && ((lineNum < 0) || (lineNum + 2 < lastBackwardsLineMatch))) { - (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch, + searchSpecPtr->foundMatchProc(lastBackwardsLineMatch, searchSpecPtr, NULL, NULL, lastBackwardsMatchOffset, matchLength); lastBackwardsLineMatch = -1; @@ -6314,7 +6310,7 @@ SearchCore( searchDone: if (lastBackwardsLineMatch != -1) { - (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch, searchSpecPtr, + searchSpecPtr->foundMatchProc(lastBackwardsLineMatch, searchSpecPtr, NULL, NULL, lastBackwardsMatchOffset, matchLength); } diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index cb608e4..1afcf76 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextBTree.c,v 1.27 2007/12/13 15:24:17 dgp Exp $ + * RCS: @(#) $Id: tkTextBTree.c,v 1.28 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -867,7 +867,7 @@ DestroyNode( while (linePtr->segPtr != NULL) { segPtr = linePtr->segPtr; linePtr->segPtr = segPtr->nextPtr; - (*segPtr->typePtr->deleteProc)(segPtr, linePtr, 1); + segPtr->typePtr->deleteProc(segPtr, linePtr, 1); } ckfree((char *) linePtr->pixels); ckfree((char *) linePtr); @@ -1207,7 +1207,7 @@ SplitSeg( if (count == 0) { return prevPtr; } - segPtr = (*segPtr->typePtr->splitProc)(segPtr, count); + segPtr = segPtr->typePtr->splitProc(segPtr, count); if (prevPtr == NULL) { indexPtr->linePtr->segPtr = segPtr; } else { @@ -1282,7 +1282,7 @@ CleanupLine( segPtr != NULL; prevPtrPtr = &(*prevPtrPtr)->nextPtr, segPtr = *prevPtrPtr) { if (segPtr->typePtr->cleanupProc != NULL) { - *prevPtrPtr = (*segPtr->typePtr->cleanupProc)(segPtr, linePtr); + *prevPtrPtr = segPtr->typePtr->cleanupProc(segPtr, linePtr); if (segPtr != *prevPtrPtr) { anyChanges = 1; } @@ -1452,7 +1452,7 @@ TkBTreeDeleteIndexRange( } nextPtr = segPtr->nextPtr; - if ((*segPtr->typePtr->deleteProc)(segPtr, curLinePtr, 0) != 0) { + if (segPtr->typePtr->deleteProc(segPtr, curLinePtr, 0) != 0) { /* * This segment refuses to die. Move it to prevPtr and advance * prevPtr if the segment has left gravity. @@ -1483,7 +1483,7 @@ TkBTreeDeleteIndexRange( for (segPtr = lastPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->typePtr->lineChangeProc != NULL) { - (*segPtr->typePtr->lineChangeProc)(segPtr, index2Ptr->linePtr); + segPtr->typePtr->lineChangeProc(segPtr, index2Ptr->linePtr); } } curNodePtr = index2Ptr->linePtr->parentPtr; @@ -3935,7 +3935,7 @@ CheckNodeConsistency( for (segPtr = linePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->typePtr->checkProc != NULL) { - (*segPtr->typePtr->checkProc)(segPtr, linePtr); + segPtr->typePtr->checkProc(segPtr, linePtr); } if ((segPtr->size == 0) && (!segPtr->typePtr->leftGravity) && (segPtr->nextPtr != NULL) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 89da5e4..ac6f138 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.70 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.71 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -446,6 +446,7 @@ typedef struct BaseCharInfo { * LayoutDLine(). */ } BaseCharInfo; +/* TODO: Thread safety */ static TkTextDispChunk *baseCharChunkPtr = NULL; #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ @@ -661,10 +662,10 @@ TkTextCreateDInfo( textPtr->refCount++; dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(0, - AsyncUpdateLineMetrics, (ClientData) textPtr); + AsyncUpdateLineMetrics, textPtr); textPtr->refCount++; dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200, - AsyncUpdateYScrollbar, (ClientData) textPtr); + AsyncUpdateYScrollbar, textPtr); textPtr->dInfoPtr = dInfoPtr; } @@ -706,7 +707,7 @@ TkTextFreeDInfo( } Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC); if (dInfoPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr); + Tcl_CancelIdleCall(DisplayText, textPtr); } if (dInfoPtr->lineUpdateTimer != NULL) { Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer); @@ -1265,14 +1266,14 @@ LayoutDLine( */ TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr); - if (linePtr != NULL) { - dlPtr->logicalLinesMerged++; - curIndex.byteIndex = 0; - curIndex.linePtr = linePtr; - segPtr = curIndex.linePtr->segPtr; - } else { + if (linePtr == NULL) { break; } + + dlPtr->logicalLinesMerged++; + curIndex.byteIndex = 0; + curIndex.linePtr = linePtr; + segPtr = curIndex.linePtr->segPtr; } } @@ -1459,7 +1460,7 @@ LayoutDLine( code = 1; } else { - code = (*segPtr->typePtr->layoutProc)(textPtr, &curIndex, segPtr, + code = segPtr->typePtr->layoutProc(textPtr, &curIndex, segPtr, byteOffset, maxX-tabSize, maxBytes, noCharsYet, wrapMode, chunkPtr); } @@ -1611,18 +1612,18 @@ LayoutDLine( FreeStyle(textPtr, chunkPtr->stylePtr); breakChunkPtr->nextPtr = chunkPtr->nextPtr; if (chunkPtr->undisplayProc != NULL) { - (*chunkPtr->undisplayProc)(textPtr, chunkPtr); + chunkPtr->undisplayProc(textPtr, chunkPtr); } ckfree((char *) chunkPtr); } if (breakByteOffset != breakChunkPtr->numBytes) { if (breakChunkPtr->undisplayProc != NULL) { - (*breakChunkPtr->undisplayProc)(textPtr, breakChunkPtr); + breakChunkPtr->undisplayProc(textPtr, breakChunkPtr); } segPtr = TkTextIndexToSeg(&breakIndex, &byteOffset); - (*segPtr->typePtr->layoutProc)(textPtr, &breakIndex, - segPtr, byteOffset, maxX, breakByteOffset, 0, - wrapMode, breakChunkPtr); + segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr, + byteOffset, maxX, breakByteOffset, 0, wrapMode, + breakChunkPtr); #if TK_LAYOUT_WITH_BASE_CHUNKS FinalizeBaseChunk(NULL); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ @@ -2306,7 +2307,7 @@ FreeDLines( for (chunkPtr = firstPtr->chunkPtr; chunkPtr != NULL; chunkPtr = nextChunkPtr) { if (chunkPtr->undisplayProc != NULL) { - (*chunkPtr->undisplayProc)(textPtr, chunkPtr); + chunkPtr->undisplayProc(textPtr, chunkPtr); } FreeStyle(textPtr, chunkPtr->stylePtr); nextChunkPtr = chunkPtr->nextPtr; @@ -2404,7 +2405,7 @@ DisplayDLine( if (chunkPtr->displayProc == TkTextInsertDisplayProc) { int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset; - (*chunkPtr->displayProc)(textPtr, chunkPtr, x, + chunkPtr->displayProc(textPtr, chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, @@ -2452,7 +2453,7 @@ DisplayDLine( x = -chunkPtr->width; } - (*chunkPtr->displayProc)(textPtr, chunkPtr, x, + chunkPtr->displayProc(textPtr, chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); @@ -2878,7 +2879,7 @@ static void AsyncUpdateLineMetrics( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; @@ -2948,7 +2949,7 @@ AsyncUpdateLineMetrics( */ dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1, - AsyncUpdateLineMetrics, (ClientData) textPtr); + AsyncUpdateLineMetrics, textPtr); } /* @@ -3049,86 +3050,82 @@ TkTextUpdateLineMetrics( */ if (TkBTreeLinePixelEpoch(textPtr, linePtr) - != textPtr->dInfoPtr->lineMetricUpdateEpoch) { - if (doThisMuch == -1) { - count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0, - NULL, 0); - } else { - TkTextIndex index; - TkTextIndex *indexPtr; - int pixelHeight; + == textPtr->dInfoPtr->lineMetricUpdateEpoch) { + /* + * This line is already up to date. That means there's nothing + * to do here. + */ + } else if (doThisMuch == -1) { + count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,NULL,0); + } else { + TkTextIndex index; + TkTextIndex *indexPtr; + int pixelHeight; + /* + * If the metric epoch is the same as the widget's epoch, then + * we know that indexPtrs are still valid, and if the cached + * metricIndex (if any) is for the same line as we wish to + * examine, then we are looking at a long line wrapped many + * times, which we will examine in pieces. + */ + + if (textPtr->dInfoPtr->metricEpoch == + textPtr->sharedTextPtr->stateEpoch && + textPtr->dInfoPtr->metricIndex.linePtr==linePtr) { + indexPtr = &textPtr->dInfoPtr->metricIndex; + pixelHeight = textPtr->dInfoPtr->metricPixelHeight; + } else { /* - * If the metric epoch is the same as the widget's epoch, - * then we know that indexPtrs are still valid, and if the - * cached metricIndex (if any) is for the same line as we - * wish to examine, then we are looking at a long line - * wrapped many times, which we will examine in pieces. + * We must reset the partial line height calculation data + * here, so we don't use it when it is out of date. */ - if (textPtr->dInfoPtr->metricEpoch == - textPtr->sharedTextPtr->stateEpoch && - textPtr->dInfoPtr->metricIndex.linePtr==linePtr) { - indexPtr = &textPtr->dInfoPtr->metricIndex; - pixelHeight = textPtr->dInfoPtr->metricPixelHeight; - } else { - /* - * We must reset the partial line height calculation - * data here, so we don't use it when it is out of - * date. - */ + textPtr->dInfoPtr->metricEpoch = -1; + index.tree = textPtr->sharedTextPtr->tree; + index.linePtr = linePtr; + index.byteIndex = 0; + index.textPtr = NULL; + indexPtr = &index; + pixelHeight = 0; + } - textPtr->dInfoPtr->metricEpoch = -1; - index.tree = textPtr->sharedTextPtr->tree; - index.linePtr = linePtr; - index.byteIndex = 0; - index.textPtr = NULL; - indexPtr = &index; - pixelHeight = 0; - } + /* + * Update the line and update the counter, counting 8 for each + * display line we actually re-layout. + */ + count += 8 * TkTextUpdateOneLine(textPtr, linePtr, + pixelHeight, indexPtr, 1); + + if (indexPtr->linePtr == linePtr) { /* - * Update the line and update the counter, counting 8 for - * each display line we actually re-layout. + * We didn't complete the logical line, because it + * produced very many display lines, which must be because + * it must be a long line wrapped many times. So we must + * cache as far as we got for next time around. */ - count += 8 * TkTextUpdateOneLine(textPtr, linePtr, - pixelHeight, indexPtr, 1); - - if (indexPtr->linePtr == linePtr) { - /* - * We didn't complete the logical line, because it - * produced very many display lines - it must be a - * long line wrapped many times. So we must cache as - * far as we got for next time around. - */ - - if (pixelHeight == 0) { - /* - * These have already been stored, unless we just - * started the new line. - */ - - textPtr->dInfoPtr->metricIndex = index; - textPtr->dInfoPtr->metricEpoch = - textPtr->sharedTextPtr->stateEpoch; - } - textPtr->dInfoPtr->metricPixelHeight = - TkBTreeLinePixelCount(textPtr, linePtr); - break; - } else { + if (pixelHeight == 0) { /* - * We're done with this long line. + * These have already been stored, unless we just + * started the new line. */ - textPtr->dInfoPtr->metricEpoch = -1; + textPtr->dInfoPtr->metricIndex = index; + textPtr->dInfoPtr->metricEpoch = + textPtr->sharedTextPtr->stateEpoch; } + textPtr->dInfoPtr->metricPixelHeight = + TkBTreeLinePixelCount(textPtr, linePtr); + break; } - } else { + /* - * This line is already up to date. That means there's nothing - * to do here. + * We're done with this long line. */ + + textPtr->dInfoPtr->metricEpoch = -1; } } else { /* @@ -3329,7 +3326,7 @@ TextInvalidateLineMetrics( if (dInfoPtr->lineUpdateTimer == NULL) { textPtr->refCount++; dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1, - AsyncUpdateLineMetrics, (ClientData) textPtr); + AsyncUpdateLineMetrics, textPtr); } } @@ -3379,6 +3376,8 @@ TkTextFindDisplayLineEnd( * of the original index within its display * line. */ { + TkTextIndex index; + if (!end && indexPtr->byteIndex == 0) { /* * Nothing to do. @@ -3388,95 +3387,93 @@ TkTextFindDisplayLineEnd( *xOffset = 0; } return; - } else { - TkTextIndex index = *indexPtr; - - index.byteIndex = 0; - index.textPtr = NULL; - - while (1) { - TkTextIndex endOfLastLine; + } - if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) { - /* - * Reached beginning of text. - */ + index = *indexPtr; + index.byteIndex = 0; + index.textPtr = NULL; - break; - } + while (1) { + TkTextIndex endOfLastLine; - if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) { - /* - * The eol is not elided, so 'index' points to the start of a - * display line (as well as logical line). - */ + if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) { + /* + * Reached beginning of text. + */ - break; - } + break; + } + if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) { /* - * indexPtr's logical line is actually merged with the previous - * logical line whose eol is elided. Continue searching back to - * get a real line start. + * The eol is not elided, so 'index' points to the start of a + * display line (as well as logical line). */ - index = endOfLastLine; - index.byteIndex = 0; + break; } - while (1) { - DLine *dlPtr; - int byteCount; - TkTextIndex nextLineStart; + /* + * indexPtr's logical line is actually merged with the previous + * logical line whose eol is elided. Continue searching back to get a + * real line start. + */ - dlPtr = LayoutDLine(textPtr, &index); - byteCount = dlPtr->byteCount; + index = endOfLastLine; + index.byteIndex = 0; + } + + while (1) { + DLine *dlPtr; + int byteCount; + TkTextIndex nextLineStart; - TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart); + dlPtr = LayoutDLine(textPtr, &index); + byteCount = dlPtr->byteCount; + + TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart); + + /* + * 'byteCount' goes up to the beginning of the next display line, so + * equality here says we need one more line. We try to perform a quick + * comparison which is valid for the case where the logical line is + * the same, but otherwise fall back on a full TkTextIndexCmp. + */ + if (((index.linePtr == indexPtr->linePtr) + && (index.byteIndex + byteCount > indexPtr->byteIndex)) + || (dlPtr->logicalLinesMerged > 0 + && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) { /* - * 'byteCount' goes up to the beginning of the next display line, - * so equality here says we need one more line. We try to perform - * a quick comparison which is valid for the case where the - * logical line is the same, but otherwise fall back on a full - * TkTextIndexCmp. + * It's on this display line. */ - if (((index.linePtr == indexPtr->linePtr) - && (index.byteIndex + byteCount > indexPtr->byteIndex)) - || (dlPtr->logicalLinesMerged > 0 - && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) { + if (xOffset != NULL) { /* - * It's on this display line. + * This call takes a byte index relative to the start of the + * current _display_ line, not logical line. We are about to + * overwrite indexPtr->byteIndex, so we must do this now. */ - if (xOffset != NULL) { - /* - * This call takes a byte index relative to the start of - * the current _display_ line, not logical line. We are - * about to overwrite indexPtr->byteIndex, so we must do - * this now. - */ - - *xOffset = DlineXOfIndex(textPtr, dlPtr, - indexPtr->byteIndex - dlPtr->index.byteIndex); - } - if (end) { - /* - * The index we want is one less than the number of bytes - * in the display line. - */ + *xOffset = DlineXOfIndex(textPtr, dlPtr, + indexPtr->byteIndex - dlPtr->index.byteIndex); + } + if (end) { + /* + * The index we want is one less than the number of bytes in + * the display line. + */ - TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr); - } else { - *indexPtr = index; - } - FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP); - return; + TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr); + } else { + *indexPtr = index; } FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP); - index = nextLineStart; + return; } + + FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP); + index = nextLineStart; } } @@ -3860,7 +3857,7 @@ TkTextUpdateOneLine( if (textPtr->dInfoPtr->scrollbarTimer == NULL) { textPtr->refCount++; textPtr->dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200, - AsyncUpdateYScrollbar, (ClientData) textPtr); + AsyncUpdateYScrollbar, textPtr); } return displayLines; } @@ -3886,7 +3883,7 @@ static void DisplayText( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; register DLine *dlPtr; DLine *prevPtr; @@ -3905,7 +3902,7 @@ DisplayText( } interp = textPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); if (tkTextDebug) { Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY); @@ -4343,7 +4340,7 @@ DisplayText( } end: - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* @@ -4372,7 +4369,7 @@ TkTextEventuallyRepick( dInfoPtr->flags |= REPICK_NEEDED; if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } } @@ -4416,7 +4413,7 @@ TkTextRedrawRegion( if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } TkDestroyRegion(damageRgn); } @@ -4553,7 +4550,7 @@ TextChanged( */ if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED; @@ -4735,7 +4732,7 @@ TextRedrawTag( */ if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED; @@ -4840,7 +4837,7 @@ TkTextRelayoutWindow( */ if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|REDRAW_BORDERS|DINFO_OUT_OF_DATE |REPICK_NEEDED; @@ -4935,7 +4932,7 @@ TkTextRelayoutWindow( if (dInfoPtr->lineUpdateTimer == NULL) { textPtr->refCount++; dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1, - AsyncUpdateLineMetrics, (ClientData) textPtr); + AsyncUpdateLineMetrics, textPtr); } } } @@ -5119,7 +5116,7 @@ TkTextSetYView( scheduleUpdate: if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED; } @@ -5385,7 +5382,7 @@ TkTextSeeCmd( */ if (chunkPtr != NULL) { - (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount, + chunkPtr->bboxProc(textPtr, chunkPtr, byteCount, dlPtr->y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width, @@ -5399,22 +5396,20 @@ TkTextSeeCmd( dInfoPtr->newXPixelOffset -= ((-delta) ); } } else { - delta -= (lineWidth - width); - if (delta > 0) { - if (delta > oneThird) { - dInfoPtr->newXPixelOffset = (x - lineWidth/2); - } else { - dInfoPtr->newXPixelOffset += (delta ); - } - } else { + delta -= lineWidth - width; + if (delta <= 0) { return TCL_OK; + } else if (delta > oneThird) { + dInfoPtr->newXPixelOffset = (x - lineWidth/2); + } else { + dInfoPtr->newXPixelOffset += (delta ); } } } dInfoPtr->flags |= DINFO_OUT_OF_DATE; if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } return TCL_OK; } @@ -5495,7 +5490,7 @@ TkTextXviewCmd( dInfoPtr->flags |= DINFO_OUT_OF_DATE; if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } return TCL_OK; } @@ -5580,7 +5575,7 @@ YScrollByPixels( return; } if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED; } @@ -5697,7 +5692,7 @@ YScrollByLines( scheduleUpdate: if (!(dInfoPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED; } @@ -5977,7 +5972,7 @@ TkTextScanCmd( dInfoPtr->flags |= DINFO_OUT_OF_DATE; if (!(dInfoPtr->flags & REDRAW_PENDING)) { dInfoPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr); + Tcl_DoWhenIdle(DisplayText, textPtr); } } else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) { dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset; @@ -6190,9 +6185,8 @@ GetYPixelCount( notFirst = 1; } break; - } else { - dlPtr = dlPtr->nextPtr; } + dlPtr = dlPtr->nextPtr; } while (dlPtr->index.linePtr == linePtr); return count; @@ -6378,7 +6372,7 @@ static void AsyncUpdateYScrollbar( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; @@ -6543,25 +6537,26 @@ TkTextPixelIndex( } *indexPtr = textPtr->topIndex; return; - } else { - for (dlPtr = validDlPtr = dInfoPtr->dLinePtr; - y >= (dlPtr->y + dlPtr->height); - dlPtr = dlPtr->nextPtr) { - if (dlPtr->chunkPtr != NULL) { - validDlPtr = dlPtr; - } - if (dlPtr->nextPtr == NULL) { - /* - * Y-coordinate is off the bottom of the displayed text. Use - * the last character on the last line. - */ + } + for (dlPtr = validDlPtr = dInfoPtr->dLinePtr; + y >= (dlPtr->y + dlPtr->height); + dlPtr = dlPtr->nextPtr) { + if (dlPtr->chunkPtr != NULL) { + validDlPtr = dlPtr; + } + if (dlPtr->nextPtr == NULL) { + /* + * Y-coordinate is off the bottom of the displayed text. Use the + * last character on the last line. + */ - x = dInfoPtr->maxX - 1; - nearby = 1; - break; - } + x = dInfoPtr->maxX - 1; + nearby = 1; + break; } - if (dlPtr->chunkPtr == NULL) dlPtr = validDlPtr; + } + if (dlPtr->chunkPtr == NULL) { + dlPtr = validDlPtr; } if (nearest != NULL) { @@ -6654,7 +6649,7 @@ DlineIndexOfX( */ if (chunkPtr->numBytes > 1) { - indexPtr->byteIndex += (*chunkPtr->measureProc)(chunkPtr, x); + indexPtr->byteIndex += chunkPtr->measureProc(chunkPtr, x); } } @@ -6742,15 +6737,14 @@ DlineXOfIndex( if (byteIndex < chunkPtr->numBytes) { int y, width, height; - (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex, + chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex, dlPtr->y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width, &height); break; - } else { - byteIndex -= chunkPtr->numBytes; } + byteIndex -= chunkPtr->numBytes; if (chunkPtr->nextPtr == NULL || byteIndex == 0) { x = chunkPtr->x + chunkPtr->width; break; @@ -6838,7 +6832,7 @@ TkTextIndexBbox( * coordinate on the screen. Translate it to reflect horizontal scrolling. */ - (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex, + chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex, dlPtr->y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, xPtr, yPtr, widthPtr, @@ -7079,7 +7073,7 @@ TkTextCharLayoutProc( ciPtr = &bciPtr->ci; } else { - bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData; + bciPtr = baseCharChunkPtr->clientData; ciPtr = (CharInfo *) ckalloc(sizeof(CharInfo)); baseString = &bciPtr->baseChars; } @@ -7087,7 +7081,7 @@ TkTextCharLayoutProc( lineOffset = Tcl_DStringLength(baseString); line = Tcl_DStringAppend(baseString,p,maxBytes); - chunkPtr->clientData = (ClientData) ciPtr; + chunkPtr->clientData = ciPtr; ciPtr->baseChunkPtr = baseCharChunkPtr; ciPtr->baseOffset = lineOffset; ciPtr->chars = NULL; @@ -7171,7 +7165,7 @@ TkTextCharLayoutProc( #if !TK_LAYOUT_WITH_BASE_CHUNKS ciPtr = (CharInfo *) ckalloc((unsigned) bytesThatFit + Tk_Offset(CharInfo, chars) + 1); - chunkPtr->clientData = (ClientData) ciPtr; + chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, (unsigned) bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ @@ -7273,7 +7267,7 @@ CharChunkMeasureChars( * here. */ { Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; - CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData; + CharInfo *ciPtr = chunkPtr->clientData; #if !TK_LAYOUT_WITH_BASE_CHUNKS if (chars == NULL) { @@ -7362,7 +7356,7 @@ CharDisplayProc( int screenY) /* Y-coordinate in text window that * corresponds to y. */ { - CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData; + CharInfo *ciPtr = chunkPtr->clientData; const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; @@ -7380,7 +7374,7 @@ CharDisplayProc( } #if TK_DRAW_IN_CONTEXT - bciPtr = (BaseCharInfo *) ciPtr->baseChunkPtr->clientData; + bciPtr = ciPtr->baseChunkPtr->clientData; numBytes = Tcl_DStringLength(&bciPtr->baseChars); string = Tcl_DStringValue(&bciPtr->baseChars); @@ -7513,7 +7507,7 @@ CharUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData; + CharInfo *ciPtr = chunkPtr->clientData; if (ciPtr) { #if TK_LAYOUT_WITH_BASE_CHUNKS @@ -7616,7 +7610,7 @@ CharBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { - CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData; + CharInfo *ciPtr = chunkPtr->clientData; int maxX; maxX = chunkPtr->width + chunkPtr->x; @@ -7779,7 +7773,7 @@ AdjustForTab( if (chunkPtr2->displayProc != CharDisplayProc) { continue; } - ciPtr = (CharInfo *) chunkPtr2->clientData; + ciPtr = chunkPtr2->clientData; for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) { if (isdigit(UCHAR(*p))) { gotDigit = 1; @@ -7800,23 +7794,23 @@ AdjustForTab( if (decimalChunkPtr != NULL) { int curX; - ciPtr = (CharInfo *) decimalChunkPtr->clientData; + ciPtr = decimalChunkPtr->clientData; CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal, decimalChunkPtr->x, -1, 0, &curX); desired = tabX - (curX - x); goto update; - } else { - /* - * There wasn't a decimal point. Right justify the text. - */ + } - width = 0; - for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL; - chunkPtr2 = chunkPtr2->nextPtr) { - width += chunkPtr2->width; - } - desired = tabX - width; + /* + * There wasn't a decimal point. Right justify the text. + */ + + width = 0; + for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL; + chunkPtr2 = chunkPtr2->nextPtr) { + width += chunkPtr2->width; } + desired = tabX - width; /* * Shift all of the chunks to the right so that the left edge is at the @@ -8116,11 +8110,10 @@ MeasureChars( break; } if (special < end) { - if (ch == '\t') { - start++; - } else { + if (ch != '\t') { break; } + start++; } } @@ -8280,7 +8273,7 @@ FinalizeBaseChunk( if (chunkPtr->displayProc != CharDisplayProc) { continue; } - ciPtr = (CharInfo *)chunkPtr->clientData; + ciPtr = chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseCharChunkPtr) { break; } @@ -8297,7 +8290,7 @@ FinalizeBaseChunk( } if (addChunkPtr != NULL) { - ciPtr = (CharInfo *)addChunkPtr->clientData; + ciPtr = addChunkPtr->clientData; ciPtr->chars = baseChars + ciPtr->baseOffset; #if TK_DRAW_IN_CONTEXT @@ -8348,7 +8341,7 @@ FreeBaseChunk( if (chunkPtr->undisplayProc != CharUndisplayProc) { continue; } - ciPtr = (CharInfo *) chunkPtr->clientData; + ciPtr = chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseChunkPtr) { break; } @@ -8466,14 +8459,14 @@ RemoveFromBaseChunk( * Reinstitute this base chunk for re-layout. */ - ciPtr = (CharInfo *) chunkPtr->clientData; + ciPtr = chunkPtr->clientData; baseCharChunkPtr = ciPtr->baseChunkPtr; /* * Remove the chunk data from the base chunk data. */ - bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData; + bciPtr = baseCharChunkPtr->clientData; if ((ciPtr->baseOffset + ciPtr->numBytes) != Tcl_DStringLength(&bciPtr->baseChars)) { diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index b9763d6..b6eba35 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextIndex.c,v 1.31 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkTextIndex.c,v 1.32 2008/11/08 18:44:40 dkf Exp $ */ #include "default.h" @@ -239,8 +239,8 @@ TkTextGetIndexFromObj( if (objPtr->bytes == NULL) { objPtr->typePtr->updateStringProc(objPtr); } - if ((objPtr->typePtr->freeIntRepProc) != NULL) { - (*objPtr->typePtr->freeIntRepProc)(objPtr); + if (objPtr->typePtr->freeIntRepProc != NULL) { + objPtr->typePtr->freeIntRepProc(objPtr); } } diff --git a/generic/tkUndo.c b/generic/tkUndo.c index e875bf3..ceb6e51 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUndo.c,v 1.13 2007/12/13 15:24:21 dgp Exp $ + * RCS: @(#) $Id: tkUndo.c,v 1.14 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -656,7 +656,7 @@ EvaluateActionList( while (action != NULL) { if (action->funcPtr != NULL) { - result = (*action->funcPtr)(interp, action->clientData, + result = action->funcPtr(interp, action->clientData, action->action); } else if (action->command != NULL) { Tcl_Obj *cmdNameObj, *evalObj; diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 7072009..84a448a 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUtil.c,v 1.23 2008/10/30 21:39:16 nijtmans Exp $ + * RCS: @(#) $Id: tkUtil.c,v 1.24 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -950,7 +950,7 @@ TkFindStateNumObj( if (strcmp(key, mPtr->strKey) == 0) { typePtr = keyPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - (*typePtr->freeIntRepProc)(keyPtr); + typePtr->freeIntRepProc(keyPtr); } keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr; keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 87bb2f7..5e4fabb 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.98 2008/10/28 22:33:06 nijtmans Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.99 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -1706,7 +1706,7 @@ Tk_MakeWindowExist( createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); if (createProc != NULL && parent != None) { - winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData); + winPtr->window = createProc(tkwin, parent, winPtr->instanceData); } else { winPtr->window = TkpMakeWindow(winPtr, parent); } diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c index 32ddaab..f7f04c4 100644 --- a/macosx/tkMacOSXCarbonEvents.c +++ b/macosx/tkMacOSXCarbonEvents.c @@ -60,7 +60,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.20 2008/06/19 00:16:11 das Exp $ + * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.21 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -588,7 +588,8 @@ TkMacOSXStopTclEventLoopCarbonTimer(void) */ MODULE_SCOPE void -TkMacOSXTrackingLoop(int tracking) +TkMacOSXTrackingLoop( + int tracking) { static int previousServiceMode = TCL_SERVICE_NONE; diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index 0065b68..c9ac88c 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.21 2008/10/27 11:55:44 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.22 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -251,7 +251,8 @@ static MyEventName classicEventNames [] = { #endif /* TK_MACOSXDEBUG_UNUSED */ MODULE_SCOPE char * -TkMacOSXCarbonEventToAscii(EventRef eventRef) +TkMacOSXCarbonEventToAscii( + EventRef eventRef) { EventClass eventClass; EventKind eventKind; @@ -292,33 +293,35 @@ TkMacOSXCarbonEventToAscii(EventRef eventRef) #ifdef TK_MACOSXDEBUG_UNUSED MODULE_SCOPE char * -TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char *buf) +TkMacOSXCarbonEventKindToAscii( + EventRef eventRef, + char *buf) { - EventClass eventClass; - EventKind eventKind; - MyEventNameList *list = eventNameList; - MyEventName *names = NULL; - int found = 0; - - eventClass = GetEventClass(eventRef); - eventKind = GetEventKind(eventRef); - while (list->names && (!names) ) { - if (eventClass == list -> c) { - names = list -> names; - } else { - list++; - } - } - if (names) { - found = 0; - while (names->name && !found) { - if (eventKind == names->kind) { - sprintf(buf,"%s",names->name); - found = 1; - } else { - names++; - } - } + EventClass eventClass; + EventKind eventKind; + MyEventNameList *list = eventNameList; + MyEventName *names = NULL; + int found = 0; + + eventClass = GetEventClass(eventRef); + eventKind = GetEventKind(eventRef); + while (list->names && (!names) ) { + if (eventClass == list -> c) { + names = list -> names; + } else { + list++; + } + } + if (names) { + found = 0; + while (names->name && !found) { + if (eventKind == names->kind) { + sprintf(buf,"%s",names->name); + found = 1; + } else { + names++; + } + } } if (!found) { sprintf(buf,"%d", eventKind); @@ -329,7 +332,9 @@ TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char *buf) } MODULE_SCOPE char * -TkMacOSXClassicEventToAscii(EventRecord *eventPtr, char *buf) +TkMacOSXClassicEventToAscii( + EventRecord *eventPtr, + char *buf) { MyEventName *names = NULL; int found = 0; @@ -354,17 +359,20 @@ TkMacOSXClassicEventToAscii(EventRecord *eventPtr, char *buf) (int) eventPtr->message, eventPtr->modifiers, buf); } return buf; - } MODULE_SCOPE void -TkMacOSXPrintPoint(char *tag, Point *p) +TkMacOSXPrintPoint( + char *tag, + Point *p) { TkMacOSXDbgMsg("%s %4d %4d", tag,p->h,p->v ); } MODULE_SCOPE void -TkMacOSXPrintRect(char *tag, Rect *r) +TkMacOSXPrintRect( + char *tag, + Rect *r) { TkMacOSXDbgMsg("%s %4d %4d %4d %4d (%dx%d)", tag, r->left, r->top, r->right, r->bottom, @@ -372,20 +380,26 @@ TkMacOSXPrintRect(char *tag, Rect *r) } MODULE_SCOPE void -TkMacOSXPrintRegion(char *tag, RgnHandle rgn) +TkMacOSXPrintRegion( + char *tag, + RgnHandle rgn) { Rect r; + GetRegionBounds(rgn,&r); TkMacOSXPrintRect(tag,&r); } MODULE_SCOPE void -TkMacOSXPrintWindowTitle(char *tag, WindowRef window) +TkMacOSXPrintWindowTitle( + char *tag, + WindowRef window) { Str255 title; - GetWTitle(window,title); + + GetWTitle(window, title); title[title[0] + 1] = 0; - TkMacOSXDbgMsg("%s %s", tag, title +1 ); + TkMacOSXDbgMsg("%s %s", tag, title+1); } typedef struct { @@ -408,15 +422,16 @@ static MsgName msgNames [] = { }; MODULE_SCOPE char * -TkMacOSXMenuMessageToAscii(int msg, char *s) +TkMacOSXMenuMessageToAscii( + int msg, + char *s) { MsgName *msgNamePtr; - for (msgNamePtr = msgNames;msgNamePtr->name;) { + + for (msgNamePtr=msgNames ; msgNamePtr->name ; msgNamePtr++) { if (msgNamePtr->msg == msg) { strcpy(s,msgNamePtr->name); return s; - } else { - msgNamePtr++; } } sprintf(s, "unknown : %d", msg); @@ -436,9 +451,12 @@ static MsgName trackingNames [] = { }; MODULE_SCOPE char * -TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char *buf) +TkMacOSXMouseTrackingResultToAscii( + MouseTrackingResult r, + char *buf) { MsgName *namePtr; + for (namePtr = trackingNames; namePtr->name; namePtr++) { if (namePtr->msg == r) { strcpy(buf, namePtr->name); @@ -510,10 +528,11 @@ TkMacOSXDebugFlashRegion( MODULE_SCOPE void * TkMacOSXGetNamedDebugSymbol( - const char* module, - const char* symbol) + const char *module, + const char *symbol) { void *addr = TkMacOSXGetNamedSymbol(module, symbol); + #ifndef __LP64__ if (!addr) { const struct mach_header *mh = NULL; @@ -616,5 +635,11 @@ TkMacOSXGetNamedDebugSymbol( #endif /* __LP64__ */ return addr; } - #endif /* TK_MAC_DEBUG */ + +/* + * Local Variables: + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index a0b458e..46c6a00 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -53,23 +53,22 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.14 2007/12/13 15:27:09 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.15 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDefault.h" #include "tkEntry.h" -static ThemeButtonKind ComputeIncDecParameters (int height, int *width); - +static ThemeButtonKind ComputeIncDecParameters(int height, int *width); + /* *-------------------------------------------------------------- * * ComputeIncDecParameters -- * - * This procedure figures out which of the kThemeIncDec - * buttons to use. It also sets width to the width of the - * IncDec button. + * This procedure figures out which of the kThemeIncDec buttons to use. + * It also sets width to the width of the IncDec button. * * Results: * The ThemeButtonKind of the button we should use. @@ -79,8 +78,11 @@ static ThemeButtonKind ComputeIncDecParameters (int height, int *width); * *-------------------------------------------------------------- */ + static ThemeButtonKind -ComputeIncDecParameters(int height, int *width) +ComputeIncDecParameters( + int height, + int *width) { ThemeButtonKind kind; @@ -112,18 +114,17 @@ ComputeIncDecParameters(int height, int *width) return kind; } - + /* *-------------------------------------------------------------- * * TkpDrawEntryBorderAndFocus -- * - * This procedure redraws the border of an entry window. - * It overrides the generic border drawing code if the - * entry widget parameters are such that the native widget - * drawing is a good fit. - * This version just returns 1, so platforms that don't - * do special native drawing don't have to implement it. + * This procedure redraws the border of an entry window. It overrides the + * generic border drawing code if the entry widget parameters are such + * that the native widget drawing is a good fit. This version just + * returns 1, so platforms that don't do special native drawing don't + * have to implement it. * * Results: * 1 if it has drawn the border, 0 if not. @@ -133,8 +134,12 @@ ComputeIncDecParameters(int height, int *width) * *-------------------------------------------------------------- */ + int -TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) +TkpDrawEntryBorderAndFocus( + Entry *entryPtr, + Drawable d, + int isSpinbox) { Rect bounds; TkMacOSXDrawingContext dc; @@ -145,9 +150,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) MacDrawable *macDraw = (MacDrawable *) d; /* - * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the - * 3 are because the Mac OS Entry widgets leave more space around the - * Text than Tk does on X11. + * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the 3 + * are because the Mac OS Entry widgets leave more space around the Text + * than Tk does on X11. */ if (entryPtr->borderWidth != MAC_OSX_ENTRY_BORDER @@ -157,9 +162,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) } /* - * For the spinbox, we have to make the entry part smaller by the size - * of the buttons. We also leave 2 pixels to the left (as per the HIG) - * and space for one pixel to the right, 'cause it makes the buttons look + * For the spinbox, we have to make the entry part smaller by the size of + * the buttons. We also leave 2 pixels to the left (as per the HIG) and + * space for one pixel to the right, 'cause it makes the buttons look * nicer. */ @@ -175,17 +180,17 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) } /* - * The focus ring is drawn with an Alpha at the outside - * part of the ring, so we have to draw over the edges of the - * ring before drawing the focus or the text will peep through. + * The focus ring is drawn with an Alpha at the outside part of the ring, + * so we have to draw over the edges of the ring before drawing the focus + * or the text will peep through. */ bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, d); TkDrawInsetFocusHighlight(entryPtr->tkwin, bgGC, MAC_OSX_FOCUS_WIDTH, d, 0); /* - * Inset the entry Frame by the maximum width of the focus rect, - * which is 3 according to the Carbon docs. + * Inset the entry Frame by the maximum width of the focus rect, which is + * 3 according to the Carbon docs. */ bounds.left = macDraw->xOff + MAC_OSX_FOCUS_WIDTH; @@ -203,8 +208,8 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) DrawThemeEditTextFrame(&bounds, drawState); if (entryPtr->flags & GOT_FOCUS) { /* - * Don't call this if we don't have the focus, because then it - * erases the focus rect to white, but we've already drawn the + * Don't call this if we don't have the focus, because then it erases + * the focus rect to white, but we've already drawn the * highlightbackground above. */ @@ -216,17 +221,17 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) TkMacOSXRestoreDrawingContext(&dc); return 1; } + /* *-------------------------------------------------------------- * * TkpDrawSpinboxButtons -- * - * This procedure redraws the buttons of an spinbox widget. - * It overrides the generic button drawing code if the - * spinbox widget parameters are such that the native widget - * drawing is a good fit. - * This version just returns 0, so platforms that don't - * do special native drawing don't have to implement it. + * This procedure redraws the buttons of an spinbox widget. It overrides + * the generic button drawing code if the spinbox widget parameters are + * such that the native widget drawing is a good fit. This version just + * returns 0, so platforms that don't do special native drawing don't + * have to implement it. * * Results: * 1 if it has drawn the border, 0 if not. @@ -238,7 +243,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) */ int -TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d) +TkpDrawSpinboxButtons( + Spinbox *sbPtr, + Drawable d) { Rect inBounds; ThemeButtonKind inKind; @@ -265,10 +272,9 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d) } /* - * The actual sizes of the IncDec button are 21 for the normal, - * 18 for the small and 15 for the mini. But the spinbox still - * looks okay if the entry is a little bigger than this, so we - * give it a little slop. + * The actual sizes of the IncDec button are 21 for the normal, 18 for the + * small and 15 for the mini. But the spinbox still looks okay if the + * entry is a little bigger than this, so we give it a little slop. */ inKind = ComputeIncDecParameters(buttonHeight, &incDecWidth); @@ -297,9 +303,10 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d) inBounds.top = macDraw->yOff + MAC_OSX_FOCUS_WIDTH; inBounds.bottom = macDraw->yOff + Tk_Height(tkwin) - MAC_OSX_FOCUS_WIDTH; - /* We had to make the entry part of the window smaller so that we - * wouldn't overdraw the spin buttons with the focus highlight. So - * now we have to draw the highlightbackground. + /* + * We had to make the entry part of the window smaller so that we wouldn't + * overdraw the spin buttons with the focus highlight. So now we have to + * draw the highlightbackground. */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); @@ -317,4 +324,3 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d) TkMacOSXRestoreDrawingContext(&dc); return 1; } - diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 7bb7192..ee13904 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.18 2007/12/13 15:27:10 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.19 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -443,8 +443,8 @@ TkpDestroyMenuButton( */ void -TkpComputeMenuButtonGeometry(mbPtr) - register TkMenuButton *mbPtr; /* Widget record for menu button. */ +TkpComputeMenuButtonGeometry( + register TkMenuButton *mbPtr) /* Widget record for menu button. */ { int width, height, mm, pixels; int hasImageOrBitmap = 0; diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index b469c9b..71dfd27 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.20 2007/12/13 15:27:10 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.21 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -31,8 +31,8 @@ static Tcl_ThreadDataKey dataKey; static void TkMacOSXNotifyExitHandler(ClientData clientData); static void CarbonEventsSetupProc(ClientData clientData, int flags); static void CarbonEventsCheckProc(ClientData clientData, int flags); - - /* + +/* *---------------------------------------------------------------------- * * Tk_MacOSXSetupTkNotifier -- @@ -66,15 +66,20 @@ Tk_MacOSXSetupTkNotifier(void) GetMainEventQueue(); tsdPtr->initialized = 1; - /* Install Carbon events event source in main event loop thread. */ + + /* + * Install Carbon events event source in main event loop thread. + */ + if (GetCurrentEventLoop() == GetMainEventLoop()) { if (!pthread_main_np()) { /* - * Panic if the Carbon main event loop thread (i.e. the - * thread where HIToolbox was first loaded) is not the - * main application thread, as Carbon does not support - * this properly. + * Panic if the Carbon main event loop thread (i.e. the thread + * where HIToolbox was first loaded) is not the main + * application thread, as Carbon does not support this + * properly. */ + Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } @@ -103,8 +108,8 @@ Tk_MacOSXSetupTkNotifier(void) */ static void -TkMacOSXNotifyExitHandler(clientData) - ClientData clientData; /* Not used. */ +TkMacOSXNotifyExitHandler( + ClientData clientData) /* Not used. */ { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -119,24 +124,24 @@ TkMacOSXNotifyExitHandler(clientData) * * CarbonEventsSetupProc -- * - * This procedure implements the setup part of the Carbon Events - * event source. It is invoked by Tcl_DoOneEvent before entering - * the notifier to check for events. + * This procedure implements the setup part of the Carbon Events event + * source. It is invoked by Tcl_DoOneEvent before entering the notifier + * to check for events. * * Results: * None. * * Side effects: - * If Carbon events are queued, then the maximum block time will be - * set to 0 to ensure that the notifier returns control to Tcl. + * If Carbon events are queued, then the maximum block time will be set + * to 0 to ensure that the notifier returns control to Tcl. * *---------------------------------------------------------------------- */ static void -CarbonEventsSetupProc(clientData, flags) - ClientData clientData; - int flags; +CarbonEventsSetupProc( + ClientData clientData, + int flags) { static Tcl_Time blockTime = { 0, 0 }; @@ -144,7 +149,7 @@ CarbonEventsSetupProc(clientData, flags) return; } - if (GetNumEventsInQueue((EventQueueRef)clientData)) { + if (GetNumEventsInQueue((EventQueueRef) clientData)) { Tcl_SetMaxBlockTime(&blockTime); } } @@ -154,8 +159,7 @@ CarbonEventsSetupProc(clientData, flags) * * CarbonEventsCheckProc -- * - * This procedure processes events sitting in the Carbon event - * queue. + * This procedure processes events sitting in the Carbon event queue. * * Results: * None. @@ -167,9 +171,9 @@ CarbonEventsSetupProc(clientData, flags) */ static void -CarbonEventsCheckProc(clientData, flags) - ClientData clientData; - int flags; +CarbonEventsCheckProc( + ClientData clientData, + int flags) { int numFound; OSStatus err = noErr; @@ -178,9 +182,12 @@ CarbonEventsCheckProc(clientData, flags) return; } - numFound = GetNumEventsInQueue((EventQueueRef)clientData); + numFound = GetNumEventsInQueue((EventQueueRef) clientData); + + /* + * Avoid starving other event sources: + */ - /* Avoid starving other event sources: */ if (numFound > 4) { numFound = 4; } diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 5419cb0..ccf1991 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.27 2008/10/03 13:13:31 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.28 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -328,10 +328,10 @@ TkpDisplayScrollbar( */ void -TkpConfigureScrollbar(scrollPtr) - register TkScrollbar *scrollPtr; /* Information about widget; may or - * may not already have values for - * some fields. */ +TkpConfigureScrollbar( + register TkScrollbar *scrollPtr) + /* Information about widget; may or may not + * already have values for some fields. */ { } @@ -554,7 +554,9 @@ TkpScrollbarPosition( */ static pascal void -ThumbActionProc(ControlRef theControl, ControlPartCode partCode) +ThumbActionProc( + ControlRef theControl, + ControlPartCode partCode) { TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t) GetControlReference(theControl); diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 0b0ab49..daf39aa 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.29 2008/08/19 15:52:13 georgeps Exp $ + * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.30 2008/11/08 18:44:40 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -626,7 +626,8 @@ XGetWindowProperty( } void -XRefreshKeyboardMapping( XMappingEvent* x) +XRefreshKeyboardMapping( + XMappingEvent *x) { /* used by tkXEvent.c */ Debugger(); @@ -1077,24 +1078,24 @@ AddPixel( void XChangeWindowAttributes( - Display* display, + Display *display, Window w, unsigned long value_mask, - XSetWindowAttributes* attributes) + XSetWindowAttributes *attributes) { } void XSetWindowBackground( - Display *display, - Window window, - unsigned long value) + Display *display, + Window window, + unsigned long value) { } void XSetWindowBackgroundPixmap( - Display* display, + Display *display, Window w, Pixmap background_pixmap) { @@ -1102,7 +1103,7 @@ XSetWindowBackgroundPixmap( void XSetWindowBorder( - Display* display, + Display *display, Window w, unsigned long border_pixel) { @@ -1110,7 +1111,7 @@ XSetWindowBorder( void XSetWindowBorderPixmap( - Display* display, + Display *display, Window w, Pixmap border_pixmap) { @@ -1118,7 +1119,7 @@ XSetWindowBorderPixmap( void XSetWindowBorderWidth( - Display* display, + Display *display, Window w, unsigned int width) { @@ -1126,7 +1127,7 @@ XSetWindowBorderWidth( void XSetWindowColormap( - Display* display, + Display *display, Window w, Colormap colormap) { @@ -1135,24 +1136,25 @@ XSetWindowColormap( Status XStringListToTextProperty( - char** list, + char **list, int count, - XTextProperty* text_prop_return) + XTextProperty *text_prop_return) { Debugger(); return (Status) 0; } + void XSetWMClientMachine( - Display* display, + Display *display, Window w, - XTextProperty* text_prop) + XTextProperty *text_prop) { Debugger(); } + XIC -XCreateIC( - void) +XCreateIC(void) { Debugger(); return (XIC) 0; diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index b85b274..df8c3af 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixSelect.c,v 1.21 2007/05/03 22:16:00 dkf Exp $ + * RCS: @(#) $Id: tkUnixSelect.c,v 1.22 2008/11/08 18:44:40 dkf Exp $ */ #include "tkInt.h" @@ -326,7 +326,7 @@ TkSelPropProc( length = strlen(incrPtr->converts[i].buffer); strcpy((char *)buffer, incrPtr->converts[i].buffer); - numItems = (*selPtr->proc)(selPtr->clientData, + numItems = selPtr->proc(selPtr->clientData, incrPtr->converts[i].offset, ((char *) buffer) + length, TK_SEL_BYTES_AT_ONCE - length); @@ -594,7 +594,7 @@ TkSelEventProc( return; } interp = retrPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); /* * Convert the X selection data into UTF before passing it to the @@ -617,10 +617,10 @@ TkSelEventProc( Tcl_FreeEncoding(encoding); } - retrPtr->result = (*retrPtr->proc)(retrPtr->clientData, - interp, Tcl_DStringValue(&ds)); + retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, + Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } else if (type == dispPtr->utf8Atom) { /* * The X selection data is in UTF-8 format already. We can't @@ -646,7 +646,7 @@ TkSelEventProc( strcpy(propData, propInfo); propData[numItems] = '\0'; } - retrPtr->result = (*retrPtr->proc)(retrPtr->clientData, + retrPtr->result = retrPtr->proc(retrPtr->clientData, retrPtr->interp, propData); if (propData != propInfo) { ckfree((char *) propData); @@ -686,10 +686,10 @@ TkSelEventProc( SelCvtFromX((long *) propInfo, (int) numItems, type, (Tk_Window) winPtr, &ds); interp = retrPtr->interp; - Tcl_Preserve((ClientData) interp); - retrPtr->result = (*retrPtr->proc)(retrPtr->clientData, + Tcl_Preserve(interp); + retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(&ds)); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); Tcl_DStringFree(&ds); } XFree(propInfo); @@ -918,8 +918,8 @@ ConvertSelection( ip.nextPtr = TkSelGetInProgress(); TkSelSetInProgress(&ip); type = selPtr->format; - numItems = (*selPtr->proc)(selPtr->clientData, 0, - (char *) buffer, TK_SEL_BYTES_AT_ONCE); + numItems = selPtr->proc(selPtr->clientData, 0, (char *) buffer, + TK_SEL_BYTES_AT_ONCE); TkSelSetInProgress(ip.nextPtr); if ((ip.selPtr == NULL) || (numItems < 0)) { incr.multAtoms[2*i + 1] = None; @@ -1227,7 +1227,7 @@ SelRcvIncrProc( } Tcl_DStringSetLength(dstPtr, soFar); - result = (*retrPtr->proc)(retrPtr->clientData, interp, + result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(dstPtr)); Tcl_Release((ClientData) interp); @@ -1265,10 +1265,10 @@ SelRcvIncrProc( SelCvtFromX((long *) propInfo, (int) numItems, type, (Tk_Window) retrPtr->winPtr, &ds); interp = retrPtr->interp; - Tcl_Preserve((ClientData) interp); - result = (*retrPtr->proc)(retrPtr->clientData, interp, + Tcl_Preserve(interp); + result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(&ds)); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); Tcl_DStringFree(&ds); if (result != TCL_OK) { retrPtr->result = result; @@ -1314,7 +1314,7 @@ SelectionSize( TkSelSetInProgress(&ip); do { - chunkSize = (*selPtr->proc)(selPtr->clientData, size, (char *) buffer, + chunkSize = selPtr->proc(selPtr->clientData, size, (char *) buffer, TK_SEL_BYTES_AT_ONCE); if (ip.selPtr == NULL) { size = 0; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index ae5729d..358ba0f 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixWm.c,v 1.63 2008/10/17 23:18:53 nijtmans Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.64 2008/11/08 18:44:40 dkf Exp $ */ #include "tkUnixInt.h" @@ -7143,9 +7143,9 @@ TkpWmSetState( */ static void -RemapWindows(winPtr, parentPtr) - TkWindow *winPtr; - TkWindow *parentPtr; +RemapWindows( + TkWindow *winPtr, + TkWindow *parentPtr) { XWindowAttributes win_attr; diff --git a/win/nmakehlp.c b/win/nmakehlp.c index ace6d2b..b5f494e 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -11,7 +11,7 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * ---------------------------------------------------------------------------- - * RCS: @(#) $Id: nmakehlp.c,v 1.11 2007/12/14 02:19:43 patthoyts Exp $ + * RCS: @(#) $Id: nmakehlp.c,v 1.12 2008/11/08 18:44:40 dkf Exp $ * ---------------------------------------------------------------------------- */ @@ -592,7 +592,10 @@ typedef struct list_item_t { /* insert a list item into the list (list may be null) */ static list_item_t * -list_insert(list_item_t **listPtrPtr, const char *key, const char *value) +list_insert( + list_item_t **listPtrPtr, + const char *key, + const char *value) { list_item_t *itemPtr = malloc(sizeof(list_item_t)); if (itemPtr) { @@ -609,7 +612,8 @@ list_insert(list_item_t **listPtrPtr, const char *key, const char *value) } static void -list_free(list_item_t **listPtrPtr) +list_free( + list_item_t **listPtrPtr) { list_item_t *tmpPtr, *listPtr = *listPtrPtr; while (listPtr) { diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 093280c..6c021dd 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinClipboard.c,v 1.9 2007/01/11 15:35:40 dkf Exp $ + * RCS: @(#) $Id: tkWinClipboard.c,v 1.10 2008/11/08 18:44:40 dkf Exp $ */ #include "tkWinInt.h" @@ -158,7 +158,7 @@ TkSelGetSelection( * Pass the data off to the selection procedure. */ - result = (*proc)(clientData, interp, Tcl_DStringValue(&ds)); + result = proc(clientData, interp, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); CloseClipboard(); return result; diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 871eeee..8f41788 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinDialog.c,v 1.54 2008/10/17 23:18:38 nijtmans Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.55 2008/11/08 18:44:40 dkf Exp $ * */ @@ -467,8 +467,7 @@ ColorDlgHookProc( if ((title != NULL) && (title[0] != '\0')) { Tcl_DString ds; - (*tkWinProcs->setWindowText)(hDlg, - Tcl_WinUtfToTChar(title, -1, &ds)); + tkWinProcs->setWindowText(hDlg, Tcl_WinUtfToTChar(title,-1,&ds)); Tcl_DStringFree(&ds); } if (tsdPtr->debugFlag) { diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index c082b58..15821f3 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinDraw.c,v 1.21 2008/04/27 22:39:16 dkf Exp $ + * RCS: @(#) $Id: tkWinDraw.c,v 1.22 2008/11/08 18:44:40 dkf Exp $ */ #include "tkWinInt.h" @@ -814,7 +814,7 @@ RenderObject( SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE : WINDING); oldMemBrush = SelectObject(dcMem, CreateSolidBrush(gc->foreground)); - (*func)(dcMem, winPoints, npoints); + func(dcMem, winPoints, npoints); BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG); /* @@ -826,7 +826,7 @@ RenderObject( if (gc->fill_style == FillOpaqueStippled) { DeleteObject(SelectObject(dcMem, CreateSolidBrush(gc->background))); - (*func)(dcMem, winPoints, npoints); + func(dcMem, winPoints, npoints); BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYBG); } @@ -842,9 +842,7 @@ RenderObject( SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE : WINDING); - - (*func)(dc, winPoints, npoints); - + func(dc, winPoints, npoints); SelectObject(dc, oldPen); } DeleteObject(SelectObject(dc, oldBrush)); diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 727c0c4..2d38ae1 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinMenu.c,v 1.60 2008/10/17 23:18:38 nijtmans Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.61 2008/11/08 18:44:40 dkf Exp $ */ #define OEMRESOURCE @@ -669,7 +669,7 @@ ReconfigureWindowsMenu( } } if (!systemMenu) { - (*tkWinProcs->insertMenu)(winMenuHdl, 0xFFFFFFFF, flags, + tkWinProcs->insertMenu(winMenuHdl, 0xFFFFFFFF, flags, itemID, lpNewItem); } Tcl_DStringFree(&translatedText); diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 4b9480f..bd7c3e3 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinTest.c,v 1.20 2008/11/03 22:44:22 nijtmans Exp $ + * RCS: @(#) $Id: tkWinTest.c,v 1.21 2008/11/08 18:44:40 dkf Exp $ */ #include "tkWinInt.h" @@ -393,10 +393,13 @@ TestfindwindowObjCmd( } static BOOL CALLBACK -EnumChildrenProc(HWND hwnd, LPARAM lParam) +EnumChildrenProc( + HWND hwnd, + LPARAM lParam) { - Tcl_Obj *listObj = (Tcl_Obj *)lParam; - Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long)hwnd)); + Tcl_Obj *listObj = (Tcl_Obj *) lParam; + + Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long) hwnd)); return TRUE; } -- cgit v0.12