diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-07 15:50:35 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-07 15:50:35 (GMT) |
commit | 392e20939456b9a272de1d2894c26b1caeb5a0a4 (patch) | |
tree | 9319497cc22af399b1fc40f2dec8a9e8ceeae091 /generic | |
parent | a1f4c67a693a22af90d85e8a263d35259e44e177 (diff) | |
download | tk-392e20939456b9a272de1d2894c26b1caeb5a0a4.zip tk-392e20939456b9a272de1d2894c26b1caeb5a0a4.tar.gz tk-392e20939456b9a272de1d2894c26b1caeb5a0a4.tar.bz2 |
ANSIfy
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkFrame.c | 255 | ||||
-rw-r--r-- | generic/tkGet.c | 504 |
2 files changed, 364 insertions, 395 deletions
diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 4cdee7e..9163a62 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.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: tkFrame.c,v 1.22 2005/08/10 22:02:22 dkf Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.23 2005/11/07 15:50:35 dkf Exp $ */ #include "default.h" @@ -167,7 +167,7 @@ enum labelanchor { static char *labelAnchorStrings[] = { "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws", - (char *) NULL + NULL }; /* @@ -179,20 +179,18 @@ static Tk_OptionSpec commonOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_FRAME_BG_COLOR, -1, Tk_Offset(Frame, border), TK_OPTION_NULL_OK, (ClientData) DEF_FRAME_BG_MONO, 0}, - {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL, - (char *) NULL, 0, -1, 0, (ClientData) "-background", 0}, + {TK_OPTION_SYNONYM, "-bg", NULL, NULL, + NULL, 0, -1, 0, (ClientData) "-background", 0}, {TK_OPTION_STRING, "-colormap", "colormap", "Colormap", DEF_FRAME_COLORMAP, -1, Tk_Offset(Frame, colormapName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-container", "container", "Container", - DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer), - 0, 0, 0}, + DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_FRAME_CURSOR, -1, Tk_Offset(Frame, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height), - 0, 0, 0}, + DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, -1, Tk_Offset(Frame, highlightBgColorPtr), 0, 0, 0}, @@ -215,64 +213,55 @@ static Tk_OptionSpec commonOptSpec[] = { DEF_FRAME_VISUAL, -1, Tk_Offset(Frame, visualName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), - 0, 0, 0}, - {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL, - (char *) NULL, 0, 0, 0, 0, 0} + DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0}, + {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static Tk_OptionSpec frameOptSpec[] = { - {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, - (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, + {TK_OPTION_SYNONYM, "-bd", NULL, NULL, + NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), - 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), - 0, 0, 0}, + DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), - 0, 0, 0}, - {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL, - (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} + DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, + {TK_OPTION_END, NULL, NULL, NULL, + NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; static Tk_OptionSpec toplevelOptSpec[] = { - {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, - (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, + {TK_OPTION_SYNONYM, "-bd", NULL, NULL, + NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), - 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), - 0, 0, 0}, + DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), - 0, 0, 0}, + DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-screen", "screen", "Screen", DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-use", "use", "Use", DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL, - (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} + {TK_OPTION_END, NULL, NULL, NULL, + NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; static Tk_OptionSpec labelframeOptSpec[] = { - {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, - (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, + {TK_OPTION_SYNONYM, "-bd", NULL, NULL, + NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_LABELFRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className), - 0, 0, 0}, - {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL, - (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0}, + DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, + {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, + NULL, 0, -1, 0, (ClientData) "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_LABELFRAME_FONT, -1, Tk_Offset(Labelframe, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", @@ -281,16 +270,14 @@ static Tk_OptionSpec labelframeOptSpec[] = { DEF_LABELFRAME_LABELANCHOR, -1, Tk_Offset(Labelframe, labelAnchor), 0, (ClientData) labelAnchorStrings, 0}, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", - (char *) NULL, -1, Tk_Offset(Labelframe, labelWin), - TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, Tk_Offset(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief), - 0, 0, 0}, + DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_LABELFRAME_TEXT, Tk_Offset(Labelframe, textPtr), -1, TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL, - (char *) NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} + {TK_OPTION_END, NULL, NULL, NULL, + NULL, 0, 0, 0, (ClientData) commonOptSpec, 0} }; /* @@ -300,8 +287,8 @@ static Tk_OptionSpec labelframeOptSpec[] = { static char *classNames[] = {"Frame", "Toplevel", "Labelframe"}; /* - * The following table maps from FrameType to the option template for - * that class of widgets. + * The following table maps from FrameType to the option template for that + * class of widgets. */ static Tk_OptionSpec *optionSpecs[] = { @@ -349,8 +336,8 @@ static Tk_ClassProcs frameClass = { }; /* - * The structure below defines the official type record for the - * labelframe's geometry manager: + * The structure below defines the official type record for the labelframe's + * geometry manager: */ static Tk_GeomMgr frameGeomType = { @@ -358,7 +345,6 @@ static Tk_GeomMgr frameGeomType = { FrameRequestProc, /* requestProc */ FrameLostSlaveProc /* lostSlaveProc */ }; - /* *-------------------------------------------------------------- @@ -380,36 +366,33 @@ static Tk_GeomMgr frameGeomType = { */ int -Tk_FrameObjCmd(clientData, interp, objc, objv) - ClientData clientData; /* Either NULL or pointer to option table. */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +Tk_FrameObjCmd( + ClientData clientData, /* Either NULL or pointer to option table. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, - (char *) NULL); + return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL); } int -Tk_ToplevelObjCmd(clientData, interp, objc, objv) - ClientData clientData; /* Either NULL or pointer to option table. */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +Tk_ToplevelObjCmd( + ClientData clientData, /* Either NULL or pointer to option table. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, - (char *) NULL); + return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL); } int -Tk_LabelframeObjCmd(clientData, interp, objc, objv) - ClientData clientData; /* Either NULL or pointer to option table. */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +Tk_LabelframeObjCmd( + ClientData clientData, /* Either NULL or pointer to option table. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, - (char *) NULL); + return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL); } /* @@ -432,14 +415,14 @@ Tk_LabelframeObjCmd(clientData, interp, objc, objv) */ int -TkCreateFrame(clientData, interp, argc, argv, toplevel, appName) - ClientData clientData; /* Either NULL or pointer to option table. */ - Tcl_Interp *interp; /* Current interpreter. */ - int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ - int toplevel; /* Non-zero means create a toplevel window, +TkCreateFrame( + ClientData clientData, /* Either NULL or pointer to option table. */ + Tcl_Interp *interp, /* Current interpreter. */ + int argc, /* Number of arguments. */ + char **argv, /* Argument strings. */ + int toplevel, /* Non-zero means create a toplevel window, * zero means create a frame. */ - char *appName; /* Should only be non-NULL if there is no main + char *appName) /* Should only be non-NULL if there is no main * window associated with the interpreter. * Gives the base name to use for the new * application. */ @@ -462,13 +445,13 @@ TkCreateFrame(clientData, interp, argc, argv, toplevel, appName) } static int -CreateFrame(clientData, interp, objc, objv, type, appName) - ClientData clientData; /* NULL. */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ - enum FrameType type; /* What widget type to create. */ - char *appName; /* Should only be non-NULL if there are no +CreateFrame( + ClientData clientData, /* NULL. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument objects. */ + enum FrameType type, /* What widget type to create. */ + char *appName) /* Should only be non-NULL if there are no * Main window associated with the * interpreter. Gives the base name to use for * the new application. */ @@ -562,7 +545,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) */ Tcl_AppendResult(interp, "unable to create widget \"", - Tcl_GetString(objv[1]), "\"", (char *) NULL); + Tcl_GetString(objv[1]), "\"", NULL); new = NULL; } else { /* @@ -600,7 +583,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) } if (visualName != NULL) { visual = Tk_GetVisual(interp, new, visualName, &depth, - (colormapName == NULL) ? &colormap : (Colormap *) NULL); + (colormapName == NULL) ? &colormap : NULL); if (visual == NULL) { goto error; } @@ -676,7 +659,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) TkpMakeContainer(framePtr->tkwin); } else { Tcl_AppendResult(interp, "A window cannot have both the -use ", - "and the -container option set.", (char *) NULL); + "and the -container option set.", NULL); goto error; } } @@ -712,14 +695,14 @@ CreateFrame(clientData, interp, objc, objv, type, appName) */ static int -FrameWidgetObjCmd(clientData, interp, objc, objv) - ClientData clientData; /* Information about frame widget. */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +FrameWidgetObjCmd( + ClientData clientData, /* Information about frame widget. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[]) /* Argument objects. */ { static CONST char *frameOptions[] = { - "cget", "configure", (char *) NULL + "cget", "configure", NULL }; enum options { FRAME_CGET, FRAME_CONFIGURE @@ -758,7 +741,7 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, (char *) framePtr, framePtr->optionTable, - (objc == 3) ? objv[2] : (Tcl_Obj *) NULL, + (objc == 3) ? objv[2] : NULL, framePtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; @@ -799,7 +782,7 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) } } else { Tcl_AppendResult(interp, "can't modify ", arg, - " option after widget is created", (char *) NULL); + " option after widget is created", NULL); result = TCL_ERROR; goto done; } @@ -834,8 +817,8 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) */ static void -DestroyFrame(memPtr) - char *memPtr; /* Info about frame widget. */ +DestroyFrame( + char *memPtr) /* Info about frame widget. */ { register Frame *framePtr = (Frame *) memPtr; register Labelframe *labelframePtr = (Labelframe *) memPtr; @@ -871,16 +854,15 @@ DestroyFrame(memPtr) */ static void -DestroyFramePartly(framePtr) - Frame *framePtr; /* Info about frame widget. */ +DestroyFramePartly( + Frame *framePtr) /* Info about frame widget. */ { register Labelframe *labelframePtr = (Labelframe *) framePtr; if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, FrameStructureProc, (ClientData) framePtr); - Tk_ManageGeometry(labelframePtr->labelWin, (Tk_GeomMgr *) NULL, - (ClientData) NULL); + Tk_ManageGeometry(labelframePtr->labelWin, NULL, (ClientData) NULL); if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) { Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin); } @@ -913,12 +895,12 @@ DestroyFramePartly(framePtr) */ static int -ConfigureFrame(interp, framePtr, objc, objv) - Tcl_Interp *interp; /* Used for error reporting. */ - register Frame *framePtr; /* Information about widget; may or may not +ConfigureFrame( + Tcl_Interp *interp, /* Used for error reporting. */ + register Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ - int objc; /* Number of valid entries in objv. */ - Tcl_Obj *CONST objv[]; /* Arguments. */ + int objc, /* Number of valid entries in objv. */ + Tcl_Obj *CONST objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; char *oldMenuName; @@ -941,7 +923,7 @@ ConfigureFrame(interp, framePtr, objc, objv) } if (Tk_SetOptions(interp, (char *) framePtr, framePtr->optionTable, objc, objv, - framePtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) { + framePtr->tkwin, &savedOptions, NULL) != TCL_OK) { if (oldMenuName != NULL) { ckfree(oldMenuName); } @@ -992,8 +974,7 @@ ConfigureFrame(interp, framePtr, objc, objv) if (oldWindow != NULL) { Tk_DeleteEventHandler(oldWindow, StructureNotifyMask, FrameStructureProc, (ClientData) framePtr); - Tk_ManageGeometry(oldWindow, (Tk_GeomMgr *) NULL, - (ClientData) NULL); + Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL); Tk_UnmaintainGeometry(oldWindow, framePtr->tkwin); Tk_UnmapWindow(oldWindow); } @@ -1017,7 +998,7 @@ ConfigureFrame(interp, framePtr, objc, objv) badWindow: Tcl_AppendResult(interp, "can't use ", Tk_PathName(labelframePtr->labelWin), - " as label in this frame", (char *) NULL); + " as label in this frame", NULL); labelframePtr->labelWin = NULL; return TCL_ERROR; } @@ -1070,8 +1051,8 @@ ConfigureFrame(interp, framePtr, objc, objv) */ static void -FrameWorldChanged(instanceData) - ClientData instanceData; /* Information about widget. */ +FrameWorldChanged( + ClientData instanceData) /* Information about widget. */ { Frame *framePtr = (Frame *) instanceData; Labelframe *labelframePtr = (Labelframe *) framePtr; @@ -1238,8 +1219,8 @@ FrameWorldChanged(instanceData) */ static void -ComputeFrameGeometry(framePtr) - register Frame *framePtr; /* Information about widget. */ +ComputeFrameGeometry( + register Frame *framePtr) /* Information about widget. */ { int otherWidth, otherHeight, otherWidthT, otherHeightT, padding; int maxWidth, maxHeight; @@ -1379,8 +1360,8 @@ ComputeFrameGeometry(framePtr) */ static void -DisplayFrame(clientData) - ClientData clientData; /* Information about widget. */ +DisplayFrame( + ClientData clientData) /* Information about widget. */ { register Frame *framePtr = (Frame *) clientData; register Tk_Window tkwin = framePtr->tkwin; @@ -1595,9 +1576,9 @@ DisplayFrame(clientData) */ static void -FrameEventProc(clientData, eventPtr) - ClientData clientData; /* Information about window. */ - register XEvent *eventPtr; /* Information about event. */ +FrameEventProc( + ClientData clientData, /* Information about window. */ + register XEvent *eventPtr) /* Information about event. */ { register Frame *framePtr = (Frame *) clientData; @@ -1688,8 +1669,8 @@ FrameEventProc(clientData, eventPtr) */ static void -FrameCmdDeletedProc(clientData) - ClientData clientData; /* Pointer to widget record for widget. */ +FrameCmdDeletedProc( + ClientData clientData) /* Pointer to widget record for widget. */ { Frame *framePtr = (Frame *) clientData; Tk_Window tkwin = framePtr->tkwin; @@ -1739,8 +1720,8 @@ FrameCmdDeletedProc(clientData) */ static void -MapFrame(clientData) - ClientData clientData; /* Pointer to frame structure. */ +MapFrame( + ClientData clientData) /* Pointer to frame structure. */ { Frame *framePtr = (Frame *) clientData; @@ -1791,8 +1772,8 @@ MapFrame(clientData) */ void -TkInstallFrameMenu(tkwin) - Tk_Window tkwin; /* The window that was just created. */ +TkInstallFrameMenu( + Tk_Window tkwin) /* The window that was just created. */ { TkWindow *winPtr = (TkWindow *) tkwin; @@ -1826,9 +1807,9 @@ TkInstallFrameMenu(tkwin) */ static void -FrameStructureProc(clientData, eventPtr) - ClientData clientData; /* Pointer to record describing frame. */ - XEvent *eventPtr; /* Describes what just happened. */ +FrameStructureProc( + ClientData clientData, /* Pointer to record describing frame. */ + XEvent *eventPtr) /* Describes what just happened. */ { Labelframe *labelframePtr = (Labelframe *) clientData; @@ -1864,9 +1845,9 @@ FrameStructureProc(clientData, eventPtr) */ static void -FrameRequestProc(clientData, tkwin) - ClientData clientData; /* Pointer to record for frame. */ - Tk_Window tkwin; /* Window that changed its desired size. */ +FrameRequestProc( + ClientData clientData, /* Pointer to record for frame. */ + Tk_Window tkwin) /* Window that changed its desired size. */ { Frame *framePtr = (Frame *) clientData; @@ -1891,10 +1872,10 @@ FrameRequestProc(clientData, tkwin) */ static void -FrameLostSlaveProc(clientData, tkwin) - ClientData clientData; /* Frame structure for slave window that was +FrameLostSlaveProc( + ClientData clientData, /* Frame structure for slave window that was * stolen away. */ - Tk_Window tkwin; /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the slave window. */ { Frame *framePtr = (Frame *) clientData; Labelframe *labelframePtr = (Labelframe *) clientData; @@ -1937,9 +1918,9 @@ FrameLostSlaveProc(clientData, tkwin) */ Tk_Window -TkToplevelWindowForCommand(interp, cmdName) - Tcl_Interp *interp; - CONST char *cmdName; +TkToplevelWindowForCommand( + Tcl_Interp *interp, + CONST char *cmdName) { Tcl_CmdInfo cmdInfo; Frame *framePtr; diff --git a/generic/tkGet.c b/generic/tkGet.c index 4d62c27..b58ae03 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -1,29 +1,28 @@ -/* +/* * tkGet.c -- * - * This file contains a number of "Tk_GetXXX" procedures, which - * parse text strings into useful forms for Tk. This file has - * the simpler procedures, like Tk_GetDirection and Tk_GetUid. - * The more complex procedures like Tk_GetColor are in separate - * files. + * This file contains a number of "Tk_GetXXX" procedures, which parse + * text strings into useful forms for Tk. This file has the simpler + * functions, like Tk_GetDirection and Tk_GetUid. The more complex + * functions like Tk_GetColor are in separate files. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGet.c,v 1.10 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkGet.c,v 1.11 2005/11/07 15:58:21 dkf Exp $ */ #include "tkInt.h" #include "tkPort.h" /* - * One of these structures is created per thread to store - * thread-specific data. In this case, it is used to house the - * Tk_Uid structs used by each thread. The "dataKey" below is - * used to locate the ThreadSpecificData for the current thread. + * One of these structures is created per thread to store thread-specific + * data. In this case, it is used to house the Tk_Uid structs used by each + * thread. The "dataKey" below is used to locate the ThreadSpecificData for + * the current thread. */ typedef struct ThreadSpecificData { @@ -32,7 +31,7 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; -static void FreeUidThreadExitProc _ANSI_ARGS_((ClientData clientData)); +static void FreeUidThreadExitProc(ClientData clientData); /* * The following tables defines the string values for reliefs, which are @@ -40,12 +39,11 @@ static void FreeUidThreadExitProc _ANSI_ARGS_((ClientData clientData)); */ static CONST char *anchorStrings[] = { - "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", (char *) NULL + "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL }; static CONST char *justifyStrings[] = { - "left", "right", "center", (char *) NULL + "left", "right", "center", NULL }; - /* *---------------------------------------------------------------------- @@ -66,17 +64,17 @@ static CONST char *justifyStrings[] = { */ int -Tk_GetAnchorFromObj(interp, objPtr, anchorPtr) - Tcl_Interp *interp; /* Used for error reporting. */ - Tcl_Obj *objPtr; /* The object we are trying to get the - * value from. */ - Tk_Anchor *anchorPtr; /* Where to place the Tk_Anchor that +Tk_GetAnchorFromObj( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Obj *objPtr, /* The object we are trying to get the value + * from. */ + Tk_Anchor *anchorPtr) /* Where to place the Tk_Anchor that * corresponds to the string value of * objPtr. */ { int index, code; - code = Tcl_GetIndexFromObj(interp, objPtr, anchorStrings, "anchor", 0, + code = Tcl_GetIndexFromObj(interp, objPtr, anchorStrings, "anchor", 0, &index); if (code == TCL_OK) { *anchorPtr = (Tk_Anchor) index; @@ -92,11 +90,10 @@ Tk_GetAnchorFromObj(interp, objPtr, anchorPtr) * Given a string, return the corresponding Tk_Anchor. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * position is stored at *anchorPtr; otherwise TCL_ERROR - * is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the position is stored at + * *anchorPtr; otherwise TCL_ERROR is returned and an error message is + * left in the interp's result. * * Side effects: * None. @@ -105,62 +102,61 @@ Tk_GetAnchorFromObj(interp, objPtr, anchorPtr) */ int -Tk_GetAnchor(interp, string, anchorPtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - CONST char *string; /* String describing a direction. */ - Tk_Anchor *anchorPtr; /* Where to store Tk_Anchor corresponding - * to string. */ +Tk_GetAnchor( + Tcl_Interp *interp, /* Use this for error reporting. */ + CONST char *string, /* String describing a direction. */ + Tk_Anchor *anchorPtr) /* Where to store Tk_Anchor corresponding to + * string. */ { switch (string[0]) { - case 'n': - if (string[1] == 0) { - *anchorPtr = TK_ANCHOR_N; - return TCL_OK; - } else if ((string[1] == 'e') && (string[2] == 0)) { - *anchorPtr = TK_ANCHOR_NE; - return TCL_OK; - } else if ((string[1] == 'w') && (string[2] == 0)) { - *anchorPtr = TK_ANCHOR_NW; - return TCL_OK; - } - goto error; - case 's': - if (string[1] == 0) { - *anchorPtr = TK_ANCHOR_S; - return TCL_OK; - } else if ((string[1] == 'e') && (string[2] == 0)) { - *anchorPtr = TK_ANCHOR_SE; - return TCL_OK; - } else if ((string[1] == 'w') && (string[2] == 0)) { - *anchorPtr = TK_ANCHOR_SW; - return TCL_OK; - } else { - goto error; - } - case 'e': - if (string[1] == 0) { - *anchorPtr = TK_ANCHOR_E; - return TCL_OK; - } - goto error; - case 'w': - if (string[1] == 0) { - *anchorPtr = TK_ANCHOR_W; - return TCL_OK; - } - goto error; - case 'c': - if (strncmp(string, "center", strlen(string)) == 0) { - *anchorPtr = TK_ANCHOR_CENTER; - return TCL_OK; - } + case 'n': + if (string[1] == 0) { + *anchorPtr = TK_ANCHOR_N; + return TCL_OK; + } else if ((string[1] == 'e') && (string[2] == 0)) { + *anchorPtr = TK_ANCHOR_NE; + return TCL_OK; + } else if ((string[1] == 'w') && (string[2] == 0)) { + *anchorPtr = TK_ANCHOR_NW; + return TCL_OK; + } + goto error; + case 's': + if (string[1] == 0) { + *anchorPtr = TK_ANCHOR_S; + return TCL_OK; + } else if ((string[1] == 'e') && (string[2] == 0)) { + *anchorPtr = TK_ANCHOR_SE; + return TCL_OK; + } else if ((string[1] == 'w') && (string[2] == 0)) { + *anchorPtr = TK_ANCHOR_SW; + return TCL_OK; + } else { goto error; + } + case 'e': + if (string[1] == 0) { + *anchorPtr = TK_ANCHOR_E; + return TCL_OK; + } + goto error; + case 'w': + if (string[1] == 0) { + *anchorPtr = TK_ANCHOR_W; + return TCL_OK; + } + goto error; + case 'c': + if (strncmp(string, "center", strlen(string)) == 0) { + *anchorPtr = TK_ANCHOR_CENTER; + return TCL_OK; + } + goto error; } - error: + error: Tcl_AppendResult(interp, "bad anchor position \"", string, - "\": must be n, ne, e, se, s, sw, w, nw, or center", - (char *) NULL); + "\": must be n, ne, e, se, s, sw, w, nw, or center", NULL); return TCL_ERROR; } @@ -169,8 +165,7 @@ Tk_GetAnchor(interp, string, anchorPtr) * * Tk_NameOfAnchor -- * - * Given a Tk_Anchor, return the string that corresponds - * to it. + * Given a Tk_Anchor, return the string that corresponds to it. * * Results: * None. @@ -182,20 +177,20 @@ Tk_GetAnchor(interp, string, anchorPtr) */ CONST char * -Tk_NameOfAnchor(anchor) - Tk_Anchor anchor; /* Anchor for which identifying string - * is desired. */ +Tk_NameOfAnchor( + Tk_Anchor anchor) /* Anchor for which identifying string is + * desired. */ { switch (anchor) { - case TK_ANCHOR_N: return "n"; - case TK_ANCHOR_NE: return "ne"; - case TK_ANCHOR_E: return "e"; - case TK_ANCHOR_SE: return "se"; - case TK_ANCHOR_S: return "s"; - case TK_ANCHOR_SW: return "sw"; - case TK_ANCHOR_W: return "w"; - case TK_ANCHOR_NW: return "nw"; - case TK_ANCHOR_CENTER: return "center"; + case TK_ANCHOR_N: return "n"; + case TK_ANCHOR_NE: return "ne"; + case TK_ANCHOR_E: return "e"; + case TK_ANCHOR_SE: return "se"; + case TK_ANCHOR_S: return "s"; + case TK_ANCHOR_SW: return "sw"; + case TK_ANCHOR_W: return "w"; + case TK_ANCHOR_NW: return "nw"; + case TK_ANCHOR_CENTER: return "center"; } return "unknown anchor position"; } @@ -208,11 +203,10 @@ Tk_NameOfAnchor(anchor) * Given a string, return the corresponding Tk JoinStyle. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * justification is stored at *joinPtr; otherwise - * TCL_ERROR is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the justification is stored at + * *joinPtr; otherwise TCL_ERROR is returned and an error message is left + * in the interp's result. * * Side effects: * None. @@ -221,11 +215,11 @@ Tk_NameOfAnchor(anchor) */ int -Tk_GetJoinStyle(interp, string, joinPtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - CONST char *string; /* String describing a justification style. */ - int *joinPtr; /* Where to store join style corresponding - * to string. */ +Tk_GetJoinStyle( + Tcl_Interp *interp, /* Use this for error reporting. */ + CONST char *string, /* String describing a justification style. */ + int *joinPtr) /* Where to store join style corresponding to + * string. */ { int c; size_t length; @@ -247,8 +241,7 @@ Tk_GetJoinStyle(interp, string, joinPtr) } Tcl_AppendResult(interp, "bad join style \"", string, - "\": must be bevel, miter, or round", - (char *) NULL); + "\": must be bevel, miter, or round", NULL); return TCL_ERROR; } @@ -257,8 +250,7 @@ Tk_GetJoinStyle(interp, string, joinPtr) * * Tk_NameOfJoinStyle -- * - * Given a Tk JoinStyle, return the string that corresponds - * to it. + * Given a Tk JoinStyle, return the string that corresponds to it. * * Results: * None. @@ -270,14 +262,14 @@ Tk_GetJoinStyle(interp, string, joinPtr) */ CONST char * -Tk_NameOfJoinStyle(join) - int join; /* Join style for which identifying string - * is desired. */ +Tk_NameOfJoinStyle( + int join) /* Join style for which identifying string is + * desired. */ { switch (join) { - case JoinBevel: return "bevel"; - case JoinMiter: return "miter"; - case JoinRound: return "round"; + case JoinBevel: return "bevel"; + case JoinMiter: return "miter"; + case JoinRound: return "round"; } return "unknown join style"; } @@ -290,11 +282,10 @@ Tk_NameOfJoinStyle(join) * Given a string, return the corresponding Tk CapStyle. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * justification is stored at *capPtr; otherwise - * TCL_ERROR is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the justification is stored at + * *capPtr; otherwise TCL_ERROR is returned and an error message is left + * in the interp's result. * * Side effects: * None. @@ -303,11 +294,11 @@ Tk_NameOfJoinStyle(join) */ int -Tk_GetCapStyle(interp, string, capPtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - CONST char *string; /* String describing a justification style. */ - int *capPtr; /* Where to store cap style corresponding - * to string. */ +Tk_GetCapStyle( + Tcl_Interp *interp, /* Use this for error reporting. */ + CONST char *string, /* String describing a justification style. */ + int *capPtr) /* Where to store cap style corresponding to + * string. */ { int c; size_t length; @@ -329,8 +320,7 @@ Tk_GetCapStyle(interp, string, capPtr) } Tcl_AppendResult(interp, "bad cap style \"", string, - "\": must be butt, projecting, or round", - (char *) NULL); + "\": must be butt, projecting, or round", NULL); return TCL_ERROR; } @@ -339,8 +329,7 @@ Tk_GetCapStyle(interp, string, capPtr) * * Tk_NameOfCapStyle -- * - * Given a Tk CapStyle, return the string that corresponds - * to it. + * Given a Tk CapStyle, return the string that corresponds to it. * * Results: * None. @@ -352,14 +341,14 @@ Tk_GetCapStyle(interp, string, capPtr) */ CONST char * -Tk_NameOfCapStyle(cap) - int cap; /* Cap style for which identifying string - * is desired. */ +Tk_NameOfCapStyle( + int cap) /* Cap style for which identifying string is + * desired. */ { switch (cap) { - case CapButt: return "butt"; - case CapProjecting: return "projecting"; - case CapRound: return "round"; + case CapButt: return "butt"; + case CapProjecting: return "projecting"; + case CapRound: return "round"; } return "unknown cap style"; } @@ -383,11 +372,11 @@ Tk_NameOfCapStyle(cap) */ int -Tk_GetJustifyFromObj(interp, objPtr, justifyPtr) - Tcl_Interp *interp; /* Used for error reporting. */ - Tcl_Obj *objPtr; /* The object we are trying to get the - * value from. */ - Tk_Justify *justifyPtr; /* Where to place the Tk_Justify that +Tk_GetJustifyFromObj( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Obj *objPtr, /* The object we are trying to get the value + * from. */ + Tk_Justify *justifyPtr) /* Where to place the Tk_Justify that * corresponds to the string value of * objPtr. */ { @@ -409,11 +398,10 @@ Tk_GetJustifyFromObj(interp, objPtr, justifyPtr) * Given a string, return the corresponding Tk_Justify. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * justification is stored at *justifyPtr; otherwise - * TCL_ERROR is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the justification is stored at + * *justifyPtr; otherwise TCL_ERROR is returned and an error message is + * left in the interp's result. * * Side effects: * None. @@ -422,11 +410,11 @@ Tk_GetJustifyFromObj(interp, objPtr, justifyPtr) */ int -Tk_GetJustify(interp, string, justifyPtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - CONST char *string; /* String describing a justification style. */ - Tk_Justify *justifyPtr; /* Where to store Tk_Justify corresponding - * to string. */ +Tk_GetJustify( + Tcl_Interp *interp, /* Use this for error reporting. */ + CONST char *string, /* String describing a justification style. */ + Tk_Justify *justifyPtr) /* Where to store Tk_Justify corresponding to + * string. */ { int c; size_t length; @@ -448,8 +436,7 @@ Tk_GetJustify(interp, string, justifyPtr) } Tcl_AppendResult(interp, "bad justification \"", string, - "\": must be left, right, or center", - (char *) NULL); + "\": must be left, right, or center", NULL); return TCL_ERROR; } @@ -471,14 +458,14 @@ Tk_GetJustify(interp, string, justifyPtr) */ CONST char * -Tk_NameOfJustify(justify) - Tk_Justify justify; /* Justification style for which - * identifying string is desired. */ +Tk_NameOfJustify( + Tk_Justify justify) /* Justification style for which identifying + * string is desired. */ { switch (justify) { - case TK_JUSTIFY_LEFT: return "left"; - case TK_JUSTIFY_RIGHT: return "right"; - case TK_JUSTIFY_CENTER: return "center"; + case TK_JUSTIFY_LEFT: return "left"; + case TK_JUSTIFY_RIGHT: return "right"; + case TK_JUSTIFY_CENTER: return "center"; } return "unknown justification style"; } @@ -500,10 +487,10 @@ Tk_NameOfJustify(justify) */ static void -FreeUidThreadExitProc(clientData) - ClientData clientData; /* Not used. */ +FreeUidThreadExitProc( + ClientData clientData) /* Not used. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DeleteHashTable(&tsdPtr->uidTable); tsdPtr->initialized = 0; @@ -514,17 +501,16 @@ FreeUidThreadExitProc(clientData) * * Tk_GetUid -- * - * Given a string, this procedure returns a unique identifier - * for the string. + * Given a string, this function returns a unique identifier for the + * string. * * Results: - * This procedure returns a Tk_Uid corresponding to the "string" - * argument. The Tk_Uid has a string value identical to string - * (strcmp will return 0), but it's guaranteed that any other - * calls to this procedure with a string equal to "string" will - * return exactly the same result (i.e. can compare Tk_Uid - * *values* directly, without having to call strcmp on what they - * point to). + * This function returns a Tk_Uid corresponding to the "string" argument. + * The Tk_Uid has a string value identical to string (strcmp will return + * 0), but it's guaranteed that any other calls to this function with a + * string equal to "string" will return exactly the same result (i.e. can + * compare Tk_Uid *values* directly, without having to call strcmp on + * what they point to). * * Side effects: * New information may be entered into the identifier table. @@ -533,11 +519,11 @@ FreeUidThreadExitProc(clientData) */ Tk_Uid -Tk_GetUid(string) - CONST char *string; /* String to convert. */ +Tk_GetUid( + CONST char *string) /* String to convert. */ { int dummy; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashTable *tablePtr = &tsdPtr->uidTable; @@ -555,15 +541,14 @@ Tk_GetUid(string) * * Tk_GetScreenMM -- * - * Given a string, returns the number of screen millimeters - * corresponding to that string. + * Given a string, returns the number of screen millimeters corresponding + * to that string. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * screen distance is stored at *doublePtr; otherwise - * TCL_ERROR is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the screen distance is stored + * at *doublePtr; otherwise TCL_ERROR is returned and an error message is + * left in the interp's result. * * Side effects: * None. @@ -572,13 +557,13 @@ Tk_GetUid(string) */ int -Tk_GetScreenMM(interp, tkwin, string, doublePtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - Tk_Window tkwin; /* Window whose screen determines conversion +Tk_GetScreenMM( + Tcl_Interp *interp, /* Use this for error reporting. */ + Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string; /* String describing a screen distance. */ - double *doublePtr; /* Place to store converted result. */ + CONST char *string, /* String describing a screen distance. */ + double *doublePtr) /* Place to store converted result. */ { char *end; double d; @@ -586,35 +571,34 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr) d = strtod(string, &end); if (end == string) { error: - Tcl_AppendResult(interp, "bad screen distance \"", string, - "\"", (char *) NULL); + Tcl_AppendResult(interp, "bad screen distance \"", string, "\"", NULL); return TCL_ERROR; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; } switch (*end) { - case 0: - d /= WidthOfScreen(Tk_Screen(tkwin)); - d *= WidthMMOfScreen(Tk_Screen(tkwin)); - break; - case 'c': - d *= 10; - end++; - break; - case 'i': - d *= 25.4; - end++; - break; - case 'm': - end++; - break; - case 'p': - d *= 25.4/72.0; - end++; - break; - default: - goto error; + case 0: + d /= WidthOfScreen(Tk_Screen(tkwin)); + d *= WidthMMOfScreen(Tk_Screen(tkwin)); + break; + case 'c': + d *= 10; + end++; + break; + case 'i': + d *= 25.4; + end++; + break; + case 'm': + end++; + break; + case 'p': + d *= 25.4/72.0; + end++; + break; + default: + goto error; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; @@ -631,15 +615,14 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr) * * Tk_GetPixels -- * - * Given a string, returns the number of pixels corresponding - * to that string. + * Given a string, returns the number of pixels corresponding to that + * string. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * rounded pixel distance is stored at *intPtr; otherwise - * TCL_ERROR is returned and an error message is left in - * the interp's result. + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the rounded pixel distance is + * stored at *intPtr; otherwise TCL_ERROR is returned and an error + * message is left in the interp's result. * * Side effects: * None. @@ -648,13 +631,13 @@ Tk_GetScreenMM(interp, tkwin, string, doublePtr) */ int -Tk_GetPixels(interp, tkwin, string, intPtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - Tk_Window tkwin; /* Window whose screen determines conversion +Tk_GetPixels( + Tcl_Interp *interp, /* Use this for error reporting. */ + Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string; /* String describing a number of pixels. */ - int *intPtr; /* Place to store converted result. */ + CONST char *string, /* String describing a number of pixels. */ + int *intPtr) /* Place to store converted result. */ { double d; @@ -674,15 +657,15 @@ Tk_GetPixels(interp, tkwin, string, intPtr) * * TkGetDoublePixels -- * - * Given a string, returns the number of pixels corresponding - * to that string. + * Given a string, returns the number of pixels corresponding to that + * string. * * Results: - * The return value is a standard Tcl return result. If - * TCL_OK is returned, then everything went well and the - * pixel distance is stored at *doublePtr; otherwise - * TCL_ERROR is returned and an error message is left in - * interp->result. + + * The return value is a standard Tcl return result. If TCL_OK is + * returned, then everything went well and the pixel distance is stored + * at *doublePtr; otherwise TCL_ERROR is returned and an error message is + * left in interp->result. * * Side effects: * None. @@ -691,52 +674,51 @@ Tk_GetPixels(interp, tkwin, string, intPtr) */ int -TkGetDoublePixels(interp, tkwin, string, doublePtr) - Tcl_Interp *interp; /* Use this for error reporting. */ - Tk_Window tkwin; /* Window whose screen determines conversion +TkGetDoublePixels( + Tcl_Interp *interp, /* Use this for error reporting. */ + Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string; /* String describing a number of pixels. */ - double *doublePtr; /* Place to store converted result. */ + CONST char *string, /* String describing a number of pixels. */ + double *doublePtr) /* Place to store converted result. */ { char *end; double d; d = strtod((char *) string, &end); if (end == string) { - error: - Tcl_AppendResult(interp, "bad screen distance \"", string, - "\"", (char *) NULL); + error: + Tcl_AppendResult(interp, "bad screen distance \"", string, "\"", NULL); return TCL_ERROR; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; } switch (*end) { - case 0: - break; - case 'c': - d *= 10*WidthOfScreen(Tk_Screen(tkwin)); - d /= WidthMMOfScreen(Tk_Screen(tkwin)); - end++; - break; - case 'i': - d *= 25.4*WidthOfScreen(Tk_Screen(tkwin)); - d /= WidthMMOfScreen(Tk_Screen(tkwin)); - end++; - break; - case 'm': - d *= WidthOfScreen(Tk_Screen(tkwin)); - d /= WidthMMOfScreen(Tk_Screen(tkwin)); - end++; - break; - case 'p': - d *= (25.4/72.0)*WidthOfScreen(Tk_Screen(tkwin)); - d /= WidthMMOfScreen(Tk_Screen(tkwin)); - end++; - break; - default: - goto error; + case 0: + break; + case 'c': + d *= 10*WidthOfScreen(Tk_Screen(tkwin)); + d /= WidthMMOfScreen(Tk_Screen(tkwin)); + end++; + break; + case 'i': + d *= 25.4*WidthOfScreen(Tk_Screen(tkwin)); + d /= WidthMMOfScreen(Tk_Screen(tkwin)); + end++; + break; + case 'm': + d *= WidthOfScreen(Tk_Screen(tkwin)); + d /= WidthMMOfScreen(Tk_Screen(tkwin)); + end++; + break; + case 'p': + d *= (25.4/72.0)*WidthOfScreen(Tk_Screen(tkwin)); + d /= WidthMMOfScreen(Tk_Screen(tkwin)); + end++; + break; + default: + goto error; } while ((*end != '\0') && isspace(UCHAR(*end))) { end++; @@ -747,5 +729,11 @@ TkGetDoublePixels(interp, tkwin, string, doublePtr) *doublePtr = d; return TCL_OK; } - - + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |