diff options
Diffstat (limited to 'generic/tkOldConfig.c')
-rw-r--r-- | generic/tkOldConfig.c | 1082 |
1 files changed, 536 insertions, 546 deletions
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index bbb673f..97ad5cb 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -1,106 +1,101 @@ -/* +/* * tkOldConfig.c -- * - * This file contains the Tk_ConfigureWidget procedure. THIS FILE - * IS HERE FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION - * PACKAGE SHOULD BE USED FOR NEW PROJECTS. + * This file contains the Tk_ConfigureWidget function. THIS FILE IS HERE + * FOR BACKWARD COMPATIBILITY; THE NEW CONFIGURATION PACKAGE SHOULD BE + * USED FOR NEW PROJECTS. * * Copyright (c) 1990-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. */ #include "tkPort.h" -#include "tk.h" /* - * Values for "flags" field of Tk_ConfigSpec structures. Be sure - * to coordinate these values with those defined in tk.h - * (TK_CONFIG_COLOR_ONLY, etc.). There must not be overlap! + * Values for "flags" field of Tk_ConfigSpec structures. Be sure to coordinate + * these values with those defined in tk.h (TK_CONFIG_COLOR_ONLY, etc.) There + * must not be overlap! * - * INIT - Non-zero means (char *) things have been - * converted to Tk_Uid's. + * INIT - Non-zero means (char *) things have been converted to + * Tk_Uid's. */ #define INIT 0x20 /* - * Forward declarations for procedures defined later in this file: + * Forward declarations for functions defined later in this file: */ -static int DoConfig _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specPtr, - Tk_Uid value, int valueIsUid, char *widgRec)); -static Tk_ConfigSpec * FindConfigSpec _ANSI_ARGS_((Tcl_Interp *interp, +static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, + Tk_ConfigSpec *specPtr, Tk_Uid value, + int valueIsUid, char *widgRec); +static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, Tk_ConfigSpec *specs, CONST char *argvName, - int needFlags, int hateFlags)); -static char * FormatConfigInfo _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specPtr, - char *widgRec)); -static CONST char * FormatConfigValue _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specPtr, - char *widgRec, char *buffer, - Tcl_FreeProc **freeProcPtr)); -static Tk_ConfigSpec * GetCachedSpecs _ANSI_ARGS_((Tcl_Interp *interp, - const Tk_ConfigSpec *staticSpecs)); -static void DeleteSpecCacheTable _ANSI_ARGS_(( - ClientData clientData, Tcl_Interp *interp)); + int needFlags, int hateFlags); +static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, + Tk_ConfigSpec *specPtr, char *widgRec); +static CONST char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, + Tk_ConfigSpec *specPtr, char *widgRec, + char *buffer, Tcl_FreeProc **freeProcPtr); +static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, + const Tk_ConfigSpec *staticSpecs); +static void DeleteSpecCacheTable(ClientData clientData, + Tcl_Interp *interp); /* *-------------------------------------------------------------- * * Tk_ConfigureWidget -- * - * Process command-line options and database options to - * fill in fields of a widget record with resources and - * other parameters. + * Process command-line options and database options to fill in fields of + * a widget record with resources and other parameters. * * Results: - * A standard Tcl return value. In case of an error, - * the interp's result will hold an error message. + * A standard Tcl return value. In case of an error, the interp's result + * will hold an error message. * * Side effects: - * The fields of widgRec get filled in with information from - * argc/argv and the option database. Old information in - * widgRec's fields gets recycled. A copy of the spec-table is - * taken with (some of) the char* *fields converted into Tk_Uid - * fields; this copy will be released when *the interpreter - * terminates. + * The fields of widgRec get filled in with information from argc/argv + * and the option database. Old information in widgRec's fields gets + * recycled. A copy of the spec-table is taken with (some of) the char* + * fields converted into Tk_Uid fields; this copy will be released when + * the interpreter terminates. * *-------------------------------------------------------------- */ int -Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) - Tcl_Interp *interp; /* Interpreter for error reporting. */ - Tk_Window tkwin; /* Window containing widget (needed to - * set up X resources). */ - Tk_ConfigSpec *origSpecs; /* Describes legal options. */ - int argc; /* Number of elements in argv. */ - CONST char **argv; /* Command-line options. */ - char *widgRec; /* Record whose fields are to be - * modified. Values must be properly - * initialized. */ - int flags; /* Used to specify additional flags - * that must be present in config specs - * for them to be considered. Also, - * may have TK_CONFIG_ARGV_ONLY set. */ +Tk_ConfigureWidget( + Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tk_Window tkwin, /* Window containing widget (needed to set up + * X resources). */ + Tk_ConfigSpec *specs, /* Describes legal options. */ + int argc, /* Number of elements in argv. */ + CONST char **argv, /* Command-line options. */ + char *widgRec, /* Record whose fields are to be modified. + * Values must be properly initialized. */ + int flags) /* Used to specify additional flags that must + * be present in config specs for them to be + * considered. Also, may have + * TK_CONFIG_ARGV_ONLY set. */ { - register Tk_ConfigSpec *specs, *specPtr, *origSpecPtr; + register Tk_ConfigSpec *specPtr; Tk_Uid value; /* Value of option from database. */ - int needFlags; /* Specs must contain this set of flags - * or else they are not considered. */ - int hateFlags; /* If a spec contains any bits here, it's - * not considered. */ + int needFlags; /* Specs must contain this set of flags or + * else they are not considered. */ + int hateFlags; /* If a spec contains any bits here, it's not + * considered. */ if (tkwin == NULL) { /* * Either we're not really in Tk, or the main window was destroyed and * we're on our way out of the application */ - Tcl_AppendResult(interp, "NULL main window", (char *)NULL); + + Tcl_AppendResult(interp, "NULL main window", NULL); return TCL_ERROR; } @@ -112,19 +107,14 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) } /* - * Get the build of the config for this interpreter and reset any - * indication of changed options. + * Get the build of the config for this interpreter. */ - specs = GetCachedSpecs(interp, origSpecs); - - for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { - specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED; - } + specs = GetCachedSpecs(interp, specs); /* - * Pass one: scan through all of the arguments, processing those - * that match entries in the specs. + * Pass one: scan through all of the arguments, processing those that + * match entries in the specs. */ for ( ; argc > 0; argc -= 2, argv += 2) { @@ -145,8 +135,7 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) */ if (argc < 2) { - Tcl_AppendResult(interp, "value for \"", arg, - "\" missing", (char *) NULL); + Tcl_AppendResult(interp, "value for \"", arg, "\" missing", NULL); return TCL_ERROR; } if (flags & TK_CONFIG_OBJS) { @@ -162,25 +151,15 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) Tcl_AddErrorInfo(interp, msg); return TCL_ERROR; } - specPtr->specFlags |= TK_CONFIG_OPTION_SPECIFIED; - } - - /* - * Thread Unsafe! For compatibility through 8.4.x, we set the original - * specPtr flags to indicate changed options. This has been removed - * from 8.5. Switch to Tcl_Obj-based options instead. [Bug 749908] - */ - - for (origSpecPtr = origSpecs, specPtr = specs; - specPtr->type != TK_CONFIG_END; origSpecPtr++, specPtr++) { - origSpecPtr->specFlags = specPtr->specFlags; + if (!(flags & TK_CONFIG_ARGV_ONLY)) { + specPtr->specFlags |= TK_CONFIG_OPTION_SPECIFIED; + } } /* - * Pass two: scan through all of the specs again; if no - * command-line argument matched a spec, then check for info - * in the option database. If there was nothing in the - * database, then use the default. + * Pass two: scan through all of the specs again; if no command-line + * argument matched a spec, then check for info in the option database. + * If there was nothing in the database, then use the default. */ if (!(flags & TK_CONFIG_ARGV_ONLY)) { @@ -188,6 +167,7 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) if ((specPtr->specFlags & TK_CONFIG_OPTION_SPECIFIED) || (specPtr->argvName == NULL) || (specPtr->type == TK_CONFIG_SYNONYM)) { + specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED; continue; } if (((specPtr->specFlags & needFlags) != needFlags) @@ -241,13 +221,13 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) * * FindConfigSpec -- * - * Search through a table of configuration specs, looking for - * one that matches a given argvName. + * Search through a table of configuration specs, looking for one that + * matches a given argvName. * * Results: - * The return value is a pointer to the matching entry, or NULL - * if nothing matched. In that case an error message is left - * in the interp's result. + * The return value is a pointer to the matching entry, or NULL if + * nothing matched. In that case an error message is left in the interp's + * result. * * Side effects: * None. @@ -256,16 +236,16 @@ Tk_ConfigureWidget(interp, tkwin, origSpecs, argc, argv, widgRec, flags) */ static Tk_ConfigSpec * -FindConfigSpec(interp, specs, argvName, needFlags, hateFlags) - Tcl_Interp *interp; /* Used for reporting errors. */ - Tk_ConfigSpec *specs; /* Pointer to table of configuration +FindConfigSpec( + Tcl_Interp *interp, /* Used for reporting errors. */ + Tk_ConfigSpec *specs, /* Pointer to table of configuration * specifications for a widget. */ - CONST char *argvName; /* Name (suitable for use in a "config" + CONST char *argvName, /* Name (suitable for use in a "config" * command) identifying particular option. */ - int needFlags; /* Flags that must be present in matching + int needFlags, /* Flags that must be present in matching + * entry. */ + int hateFlags) /* Flags that must NOT be present in matching * entry. */ - int hateFlags; /* Flags that must NOT be present in - * matching entry. */ { register Tk_ConfigSpec *specPtr; register char c; /* First character of current argument. */ @@ -293,34 +273,32 @@ FindConfigSpec(interp, specs, argvName, needFlags, hateFlags) } if (matchPtr != NULL) { Tcl_AppendResult(interp, "ambiguous option \"", argvName, - "\"", (char *) NULL); - return (Tk_ConfigSpec *) NULL; + "\"", NULL); + return NULL; } matchPtr = specPtr; } if (matchPtr == NULL) { - Tcl_AppendResult(interp, "unknown option \"", argvName, - "\"", (char *) NULL); - return (Tk_ConfigSpec *) NULL; + Tcl_AppendResult(interp, "unknown option \"", argvName, "\"", NULL); + return NULL; } /* - * Found a matching entry. If it's a synonym, then find the - * entry that it's a synonym for. + * Found a matching entry. If it's a synonym, then find the entry that + * it's a synonym for. */ - gotMatch: + gotMatch: specPtr = matchPtr; if (specPtr->type == TK_CONFIG_SYNONYM) { for (specPtr = specs; ; specPtr++) { if (specPtr->type == TK_CONFIG_END) { - Tcl_AppendResult(interp, - "couldn't find synonym for option \"", - argvName, "\"", (char *) NULL); - return (Tk_ConfigSpec *) NULL; + Tcl_AppendResult(interp, "couldn't find synonym for option \"", + argvName, "\"", NULL); + return NULL; } - if ((specPtr->dbName == matchPtr->dbName) + if ((specPtr->dbName == matchPtr->dbName) && (specPtr->type != TK_CONFIG_SYNONYM) && ((specPtr->specFlags & needFlags) == needFlags) && !(specPtr->specFlags & hateFlags)) { @@ -336,32 +314,30 @@ FindConfigSpec(interp, specs, argvName, needFlags, hateFlags) * * DoConfig -- * - * This procedure applies a single configuration option - * to a widget record. + * This function applies a single configuration option to a widget + * record. * * Results: * A standard Tcl return value. * * Side effects: - * WidgRec is modified as indicated by specPtr and value. - * The old value is recycled, if that is appropriate for - * the value type. + * WidgRec is modified as indicated by specPtr and value. The old value + * is recycled, if that is appropriate for the value type. * *-------------------------------------------------------------- */ static int -DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) - Tcl_Interp *interp; /* Interpreter for error reporting. */ - Tk_Window tkwin; /* Window containing widget (needed to - * set up X resources). */ - Tk_ConfigSpec *specPtr; /* Specifier to apply. */ - Tk_Uid value; /* Value to use to fill in widgRec. */ - int valueIsUid; /* Non-zero means value is a Tk_Uid; - * zero means it's an ordinary string. */ - char *widgRec; /* Record whose fields are to be - * modified. Values must be properly - * initialized. */ +DoConfig( + Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tk_Window tkwin, /* Window containing widget (needed to set up + * X resources). */ + Tk_ConfigSpec *specPtr, /* Specifier to apply. */ + Tk_Uid value, /* Value to use to fill in widgRec. */ + int valueIsUid, /* Non-zero means value is a Tk_Uid; zero + * means it's an ordinary string. */ + char *widgRec) /* Record whose fields are to be modified. + * Values must be properly initialized. */ { char *ptr; Tk_Uid uid; @@ -375,211 +351,209 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) do { ptr = widgRec + specPtr->offset; switch (specPtr->type) { - case TK_CONFIG_BOOLEAN: - if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) { - return TCL_ERROR; - } - break; - case TK_CONFIG_INT: - if (Tcl_GetInt(interp, value, (int *) ptr) != TCL_OK) { - return TCL_ERROR; - } - break; - case TK_CONFIG_DOUBLE: - if (Tcl_GetDouble(interp, value, (double *) ptr) != TCL_OK) { - return TCL_ERROR; - } - break; - case TK_CONFIG_STRING: { - char *old, *new; - - if (nullValue) { - new = NULL; - } else { - new = (char *) ckalloc((unsigned) (strlen(value) + 1)); - strcpy(new, value); - } - old = *((char **) ptr); - if (old != NULL) { - ckfree(old); - } - *((char **) ptr) = new; - break; + case TK_CONFIG_BOOLEAN: + if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) { + return TCL_ERROR; } - case TK_CONFIG_UID: - if (nullValue) { - *((Tk_Uid *) ptr) = NULL; - } else { - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - *((Tk_Uid *) ptr) = uid; - } - break; - case TK_CONFIG_COLOR: { - XColor *newPtr, *oldPtr; - - if (nullValue) { - newPtr = NULL; - } else { - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - newPtr = Tk_GetColor(interp, tkwin, uid); - if (newPtr == NULL) { - return TCL_ERROR; - } - } - oldPtr = *((XColor **) ptr); - if (oldPtr != NULL) { - Tk_FreeColor(oldPtr); - } - *((XColor **) ptr) = newPtr; - break; + break; + case TK_CONFIG_INT: + if (Tcl_GetInt(interp, value, (int *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_DOUBLE: + if (Tcl_GetDouble(interp, value, (double *) ptr) != TCL_OK) { + return TCL_ERROR; } - case TK_CONFIG_FONT: { - Tk_Font new; + break; + case TK_CONFIG_STRING: { + char *oldStr, *newStr; - if (nullValue) { - new = NULL; - } else { - new = Tk_GetFont(interp, tkwin, value); - if (new == NULL) { - return TCL_ERROR; - } - } - Tk_FreeFont(*((Tk_Font *) ptr)); - *((Tk_Font *) ptr) = new; - break; + if (nullValue) { + newStr = NULL; + } else { + newStr = (char *) ckalloc((unsigned) (strlen(value) + 1)); + strcpy(newStr, value); } - case TK_CONFIG_BITMAP: { - Pixmap new, old; - - if (nullValue) { - new = None; - } else { - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - new = Tk_GetBitmap(interp, tkwin, uid); - if (new == None) { - return TCL_ERROR; - } - } - old = *((Pixmap *) ptr); - if (old != None) { - Tk_FreeBitmap(Tk_Display(tkwin), old); - } - *((Pixmap *) ptr) = new; - break; + oldStr = *((char **) ptr); + if (oldStr != NULL) { + ckfree(oldStr); } - case TK_CONFIG_BORDER: { - Tk_3DBorder new, old; - - if (nullValue) { - new = NULL; - } else { - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - new = Tk_Get3DBorder(interp, tkwin, uid); - if (new == NULL) { - return TCL_ERROR; - } - } - old = *((Tk_3DBorder *) ptr); - if (old != NULL) { - Tk_Free3DBorder(old); - } - *((Tk_3DBorder *) ptr) = new; - break; + *((char **) ptr) = newStr; + break; + } + case TK_CONFIG_UID: + if (nullValue) { + *((Tk_Uid *) ptr) = NULL; + } else { + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + *((Tk_Uid *) ptr) = uid; } - case TK_CONFIG_RELIEF: + break; + case TK_CONFIG_COLOR: { + XColor *newPtr, *oldPtr; + + if (nullValue) { + newPtr = NULL; + } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) { + newPtr = Tk_GetColor(interp, tkwin, uid); + if (newPtr == NULL) { return TCL_ERROR; } - break; - case TK_CONFIG_CURSOR: - case TK_CONFIG_ACTIVE_CURSOR: { - Tk_Cursor new, old; - - if (nullValue) { - new = None; - } else { - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - new = Tk_GetCursor(interp, tkwin, uid); - if (new == None) { - return TCL_ERROR; - } - } - old = *((Tk_Cursor *) ptr); - if (old != None) { - Tk_FreeCursor(Tk_Display(tkwin), old); - } - *((Tk_Cursor *) ptr) = new; - if (specPtr->type == TK_CONFIG_ACTIVE_CURSOR) { - Tk_DefineCursor(tkwin, new); - } - break; } - case TK_CONFIG_JUSTIFY: - uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - if (Tk_GetJustify(interp, uid, (Tk_Justify *) ptr) != TCL_OK) { + oldPtr = *((XColor **) ptr); + if (oldPtr != NULL) { + Tk_FreeColor(oldPtr); + } + *((XColor **) ptr) = newPtr; + break; + } + case TK_CONFIG_FONT: { + Tk_Font newFont; + + if (nullValue) { + newFont = NULL; + } else { + newFont = Tk_GetFont(interp, tkwin, value); + if (newFont == NULL) { return TCL_ERROR; } - break; - case TK_CONFIG_ANCHOR: + } + Tk_FreeFont(*((Tk_Font *) ptr)); + *((Tk_Font *) ptr) = newFont; + break; + } + case TK_CONFIG_BITMAP: { + Pixmap newBmp, oldBmp; + + if (nullValue) { + newBmp = None; + } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - if (Tk_GetAnchor(interp, uid, (Tk_Anchor *) ptr) != TCL_OK) { + newBmp = Tk_GetBitmap(interp, tkwin, uid); + if (newBmp == None) { return TCL_ERROR; } - break; - case TK_CONFIG_CAP_STYLE: + } + oldBmp = *((Pixmap *) ptr); + if (oldBmp != None) { + Tk_FreeBitmap(Tk_Display(tkwin), oldBmp); + } + *((Pixmap *) ptr) = newBmp; + break; + } + case TK_CONFIG_BORDER: { + Tk_3DBorder newBorder, oldBorder; + + if (nullValue) { + newBorder = NULL; + } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - if (Tk_GetCapStyle(interp, uid, (int *) ptr) != TCL_OK) { + newBorder = Tk_Get3DBorder(interp, tkwin, uid); + if (newBorder == NULL) { return TCL_ERROR; } - break; - case TK_CONFIG_JOIN_STYLE: + } + oldBorder = *((Tk_3DBorder *) ptr); + if (oldBorder != NULL) { + Tk_Free3DBorder(oldBorder); + } + *((Tk_3DBorder *) ptr) = newBorder; + break; + } + case TK_CONFIG_RELIEF: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_CURSOR: + case TK_CONFIG_ACTIVE_CURSOR: { + Tk_Cursor newCursor, oldCursor; + + if (nullValue) { + newCursor = None; + } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); - if (Tk_GetJoinStyle(interp, uid, (int *) ptr) != TCL_OK) { - return TCL_ERROR; - } - break; - case TK_CONFIG_PIXELS: - if (Tk_GetPixels(interp, tkwin, value, (int *) ptr) - != TCL_OK) { - return TCL_ERROR; - } - break; - case TK_CONFIG_MM: - if (Tk_GetScreenMM(interp, tkwin, value, (double *) ptr) - != TCL_OK) { + newCursor = Tk_GetCursor(interp, tkwin, uid); + if (newCursor == None) { return TCL_ERROR; } - break; - case TK_CONFIG_WINDOW: { - Tk_Window tkwin2; - - if (nullValue) { - tkwin2 = NULL; - } else { - tkwin2 = Tk_NameToWindow(interp, value, tkwin); - if (tkwin2 == NULL) { - return TCL_ERROR; - } - } - *((Tk_Window *) ptr) = tkwin2; - break; } - case TK_CONFIG_CUSTOM: - if ((*specPtr->customPtr->parseProc)( - specPtr->customPtr->clientData, interp, tkwin, - value, widgRec, specPtr->offset) != TCL_OK) { + oldCursor = *((Tk_Cursor *) ptr); + if (oldCursor != None) { + Tk_FreeCursor(Tk_Display(tkwin), oldCursor); + } + *((Tk_Cursor *) ptr) = newCursor; + if (specPtr->type == TK_CONFIG_ACTIVE_CURSOR) { + Tk_DefineCursor(tkwin, newCursor); + } + break; + } + case TK_CONFIG_JUSTIFY: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetJustify(interp, uid, (Tk_Justify *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_ANCHOR: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetAnchor(interp, uid, (Tk_Anchor *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_CAP_STYLE: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetCapStyle(interp, uid, (int *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_JOIN_STYLE: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetJoinStyle(interp, uid, (int *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_PIXELS: + if (Tk_GetPixels(interp, tkwin, value, (int *) ptr) + != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_MM: + if (Tk_GetScreenMM(interp, tkwin, value, (double*)ptr) != TCL_OK) { + return TCL_ERROR; + } + break; + case TK_CONFIG_WINDOW: { + Tk_Window tkwin2; + + if (nullValue) { + tkwin2 = NULL; + } else { + tkwin2 = Tk_NameToWindow(interp, value, tkwin); + if (tkwin2 == NULL) { return TCL_ERROR; } - break; - default: { - char buf[64 + TCL_INTEGER_SPACE]; - - sprintf(buf, "bad config table: unknown type %d", - specPtr->type); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + } + *((Tk_Window *) ptr) = tkwin2; + break; + } + case TK_CONFIG_CUSTOM: + if ((*specPtr->customPtr->parseProc)( + specPtr->customPtr->clientData, interp, tkwin, value, + widgRec, specPtr->offset) != TCL_OK) { return TCL_ERROR; } + break; + default: { + char buf[64 + TCL_INTEGER_SPACE]; + + sprintf(buf, "bad config table: unknown type %d", specPtr->type); + Tcl_SetResult(interp, buf, TCL_VOLATILE); + return TCL_ERROR; + } } specPtr++; } while ((specPtr->argvName == NULL) && (specPtr->type != TK_CONFIG_END)); @@ -591,24 +565,22 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) * * Tk_ConfigureInfo -- * - * Return information about the configuration options - * for a window, and their current values. + * Return information about the configuration options for a window, and + * their current values. * * Results: - * Always returns TCL_OK. The interp's result will be modified - * hold a description of either a single configuration option - * available for "widgRec" via "specs", or all the configuration - * options available. In the "all" case, the result will - * available for "widgRec" via "specs". The result will - * be a list, each of whose entries describes one option. - * Each entry will itself be a list containing the option's - * name for use on command lines, database name, database - * class, default value, and current value (empty string - * if none). For options that are synonyms, the list will - * contain only two values: name and synonym name. If the - * "name" argument is non-NULL, then the only information - * returned is that for the named argument (i.e. the corresponding - * entry in the overall list is returned). + * Always returns TCL_OK. The interp's result will be modified hold a + * description of either a single configuration option available for + * "widgRec" via "specs", or all the configuration options available. In + * the "all" case, the result will available for "widgRec" via "specs". + * The result will be a list, each of whose entries describes one option. + * Each entry will itself be a list containing the option's name for use + * on command lines, database name, database class, default value, and + * current value (empty string if none). For options that are synonyms, + * the list will contain only two values: name and synonym name. If the + * "name" argument is non-NULL, then the only information returned is + * that for the named argument (i.e. the corresponding entry in the + * overall list is returned). * * Side effects: * None. @@ -617,18 +589,18 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) */ int -Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) - Tcl_Interp *interp; /* Interpreter for error reporting. */ - Tk_Window tkwin; /* Window corresponding to widgRec. */ - Tk_ConfigSpec *specs; /* Describes legal options. */ - char *widgRec; /* Record whose fields contain current - * values for options. */ - CONST char *argvName; /* If non-NULL, indicates a single option - * whose info is to be returned. Otherwise +Tk_ConfigureInfo( + Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tk_Window tkwin, /* Window corresponding to widgRec. */ + Tk_ConfigSpec *specs, /* Describes legal options. */ + char *widgRec, /* Record whose fields contain current values + * for options. */ + CONST char *argvName, /* If non-NULL, indicates a single option + * whose info is to be returned. Otherwise * info is returned for all options. */ - int flags; /* Used to specify additional flags - * that must be present in config specs - * for them to be considered. */ + int flags) /* Used to specify additional flags that must + * be present in config specs for them to be + * considered. */ { register Tk_ConfigSpec *specPtr; int needFlags, hateFlags; @@ -649,11 +621,11 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) specs = GetCachedSpecs(interp, specs); /* - * If information is only wanted for a single configuration - * spec, then handle that one spec specially. + * If information is only wanted for a single configuration spec, then + * handle that one spec specially. */ - Tcl_SetResult(interp, (char *) NULL, TCL_STATIC); + Tcl_SetResult(interp, NULL, TCL_STATIC); if (argvName != NULL) { specPtr = FindConfigSpec(interp, specs, argvName, needFlags,hateFlags); if (specPtr == NULL) { @@ -666,8 +638,8 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) } /* - * Loop through all the specs, creating a big list with all - * their information. + * Loop through all the specs, creating a big list with all their + * information. */ for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { @@ -682,7 +654,7 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) continue; } list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); - Tcl_AppendResult(interp, leader, list, "}", (char *) NULL); + Tcl_AppendResult(interp, leader, list, "}", NULL); ckfree(list); leader = " {"; } @@ -694,12 +666,12 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) * * FormatConfigInfo -- * - * Create a valid Tcl list holding the configuration information - * for a single configuration option. + * Create a valid Tcl list holding the configuration information for a + * single configuration option. * * Results: - * A Tcl list, dynamically allocated. The caller is expected to - * arrange for this list to be freed eventually. + * A Tcl list, dynamically allocated. The caller is expected to arrange + * for this list to be freed eventually. * * Side effects: * Memory is allocated. @@ -708,19 +680,20 @@ Tk_ConfigureInfo(interp, tkwin, specs, widgRec, argvName, flags) */ static char * -FormatConfigInfo(interp, tkwin, specPtr, widgRec) - Tcl_Interp *interp; /* Interpreter to use for things - * like floating-point precision. */ - Tk_Window tkwin; /* Window corresponding to widget. */ - register Tk_ConfigSpec *specPtr; /* Pointer to information describing - * option. */ - char *widgRec; /* Pointer to record holding current - * values of info for widget. */ +FormatConfigInfo( + Tcl_Interp *interp, /* Interpreter to use for things like + * floating-point precision. */ + Tk_Window tkwin, /* Window corresponding to widget. */ + register Tk_ConfigSpec *specPtr, + /* Pointer to information describing + * option. */ + char *widgRec) /* Pointer to record holding current values of + * info for widget. */ { CONST char *argv[6]; char *result; char buffer[200]; - Tcl_FreeProc *freeProc = (Tcl_FreeProc *) NULL; + Tcl_FreeProc *freeProc = NULL; argv[0] = specPtr->argvName; argv[1] = specPtr->dbName; @@ -759,16 +732,14 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec) * * FormatConfigValue -- * - * This procedure formats the current value of a configuration - * option. + * This function formats the current value of a configuration option. * * Results: - * The return value is the formatted value of the option given - * by specPtr and widgRec. If the value is static, so that it - * need not be freed, *freeProcPtr will be set to NULL; otherwise - * *freeProcPtr will be set to the address of a procedure to - * free the result, and the caller must invoke this procedure - * when it is finished with the result. + * The return value is the formatted value of the option given by specPtr + * and widgRec. If the value is static, so that it need not be freed, + * *freeProcPtr will be set to NULL; otherwise *freeProcPtr will be set + * to the address of a function to free the result, and the caller must + * invoke this function when it is finished with the result. * * Side effects: * None. @@ -777,18 +748,18 @@ FormatConfigInfo(interp, tkwin, specPtr, widgRec) */ static CONST char * -FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr) - Tcl_Interp *interp; /* Interpreter for use in real conversions. */ - Tk_Window tkwin; /* Window corresponding to widget. */ - Tk_ConfigSpec *specPtr; /* Pointer to information describing option. +FormatConfigValue( + Tcl_Interp *interp, /* Interpreter for use in real conversions. */ + Tk_Window tkwin, /* Window corresponding to widget. */ + Tk_ConfigSpec *specPtr, /* Pointer to information describing option. * Must not point to a synonym option. */ - char *widgRec; /* Pointer to record holding current - * values of info for widget. */ - char *buffer; /* Static buffer to use for small values. + char *widgRec, /* Pointer to record holding current values of + * info for widget. */ + char *buffer, /* Static buffer to use for small values. * Must have at least 200 bytes of storage. */ - Tcl_FreeProc **freeProcPtr; /* Pointer to word to fill in with address - * of procedure to free the result, or NULL - * if result is static. */ + Tcl_FreeProc **freeProcPtr) /* Pointer to word to fill in with address of + * function to free the result, or NULL if + * result is static. */ { CONST char *ptr, *result; @@ -796,109 +767,115 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr) ptr = widgRec + specPtr->offset; result = ""; switch (specPtr->type) { - case TK_CONFIG_BOOLEAN: - if (*((int *) ptr) == 0) { - result = "0"; - } else { - result = "1"; - } - break; - case TK_CONFIG_INT: - sprintf(buffer, "%d", *((int *) ptr)); - result = buffer; - break; - case TK_CONFIG_DOUBLE: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); - result = buffer; - break; - case TK_CONFIG_STRING: - result = (*(char **) ptr); - if (result == NULL) { - result = ""; - } - break; - case TK_CONFIG_UID: { - Tk_Uid uid = *((Tk_Uid *) ptr); - if (uid != NULL) { - result = uid; - } - break; + case TK_CONFIG_BOOLEAN: + if (*((int *) ptr) == 0) { + result = "0"; + } else { + result = "1"; } - case TK_CONFIG_COLOR: { - XColor *colorPtr = *((XColor **) ptr); - if (colorPtr != NULL) { - result = Tk_NameOfColor(colorPtr); - } - break; + break; + case TK_CONFIG_INT: + sprintf(buffer, "%d", *((int *) ptr)); + result = buffer; + break; + case TK_CONFIG_DOUBLE: + Tcl_PrintDouble(interp, *((double *) ptr), buffer); + result = buffer; + break; + case TK_CONFIG_STRING: + result = (*(char **) ptr); + if (result == NULL) { + result = ""; } - case TK_CONFIG_FONT: { - Tk_Font tkfont = *((Tk_Font *) ptr); - if (tkfont != NULL) { - result = Tk_NameOfFont(tkfont); - } - break; + break; + case TK_CONFIG_UID: { + Tk_Uid uid = *((Tk_Uid *) ptr); + + if (uid != NULL) { + result = uid; } - case TK_CONFIG_BITMAP: { - Pixmap pixmap = *((Pixmap *) ptr); - if (pixmap != None) { - result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); - } - break; + break; + } + case TK_CONFIG_COLOR: { + XColor *colorPtr = *((XColor **) ptr); + + if (colorPtr != NULL) { + result = Tk_NameOfColor(colorPtr); } - case TK_CONFIG_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) ptr); - if (border != NULL) { - result = Tk_NameOf3DBorder(border); - } - break; + break; + } + case TK_CONFIG_FONT: { + Tk_Font tkfont = *((Tk_Font *) ptr); + + if (tkfont != NULL) { + result = Tk_NameOfFont(tkfont); } - case TK_CONFIG_RELIEF: - result = Tk_NameOfRelief(*((int *) ptr)); - break; - case TK_CONFIG_CURSOR: - case TK_CONFIG_ACTIVE_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) ptr); - if (cursor != None) { - result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); - } - break; + break; + } + case TK_CONFIG_BITMAP: { + Pixmap pixmap = *((Pixmap *) ptr); + + if (pixmap != None) { + result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); } - case TK_CONFIG_JUSTIFY: - result = Tk_NameOfJustify(*((Tk_Justify *) ptr)); - break; - case TK_CONFIG_ANCHOR: - result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr)); - break; - case TK_CONFIG_CAP_STYLE: - result = Tk_NameOfCapStyle(*((int *) ptr)); - break; - case TK_CONFIG_JOIN_STYLE: - result = Tk_NameOfJoinStyle(*((int *) ptr)); - break; - case TK_CONFIG_PIXELS: - sprintf(buffer, "%d", *((int *) ptr)); - result = buffer; - break; - case TK_CONFIG_MM: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); - result = buffer; - break; - case TK_CONFIG_WINDOW: { - Tk_Window tkwin; + break; + } + case TK_CONFIG_BORDER: { + Tk_3DBorder border = *((Tk_3DBorder *) ptr); - tkwin = *((Tk_Window *) ptr); - if (tkwin != NULL) { - result = Tk_PathName(tkwin); - } - break; + if (border != NULL) { + result = Tk_NameOf3DBorder(border); } - case TK_CONFIG_CUSTOM: - result = (*specPtr->customPtr->printProc)( - specPtr->customPtr->clientData, tkwin, widgRec, - specPtr->offset, freeProcPtr); - break; - default: - result = "?? unknown type ??"; + break; + } + case TK_CONFIG_RELIEF: + result = Tk_NameOfRelief(*((int *) ptr)); + break; + case TK_CONFIG_CURSOR: + case TK_CONFIG_ACTIVE_CURSOR: { + Tk_Cursor cursor = *((Tk_Cursor *) ptr); + + if (cursor != None) { + result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); + } + break; + } + case TK_CONFIG_JUSTIFY: + result = Tk_NameOfJustify(*((Tk_Justify *) ptr)); + break; + case TK_CONFIG_ANCHOR: + result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr)); + break; + case TK_CONFIG_CAP_STYLE: + result = Tk_NameOfCapStyle(*((int *) ptr)); + break; + case TK_CONFIG_JOIN_STYLE: + result = Tk_NameOfJoinStyle(*((int *) ptr)); + break; + case TK_CONFIG_PIXELS: + sprintf(buffer, "%d", *((int *) ptr)); + result = buffer; + break; + case TK_CONFIG_MM: + Tcl_PrintDouble(interp, *((double *) ptr), buffer); + result = buffer; + break; + case TK_CONFIG_WINDOW: { + Tk_Window tkwin; + + tkwin = *((Tk_Window *) ptr); + if (tkwin != NULL) { + result = Tk_PathName(tkwin); + } + break; + } + case TK_CONFIG_CUSTOM: + result = (*specPtr->customPtr->printProc)( + specPtr->customPtr->clientData, tkwin, widgRec, + specPtr->offset, freeProcPtr); + break; + default: + result = "?? unknown type ??"; } return result; } @@ -908,14 +885,14 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr) * * Tk_ConfigureValue -- * - * This procedure returns the current value of a configuration - * option for a widget. + * This function returns the current value of a configuration option for + * a widget. * * Results: * The return value is a standard Tcl completion code (TCL_OK or - * TCL_ERROR). The interp's result will be set to hold either the value - * of the option given by argvName (if TCL_OK is returned) or - * an error message (if TCL_ERROR is returned). + * TCL_ERROR). The interp's result will be set to hold either the value + * of the option given by argvName (if TCL_OK is returned) or an error + * message (if TCL_ERROR is returned). * * Side effects: * None. @@ -924,17 +901,17 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr) */ int -Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags) - Tcl_Interp *interp; /* Interpreter for error reporting. */ - Tk_Window tkwin; /* Window corresponding to widgRec. */ - Tk_ConfigSpec *specs; /* Describes legal options. */ - char *widgRec; /* Record whose fields contain current - * values for options. */ - CONST char *argvName; /* Gives the command-line name for the - * option whose value is to be returned. */ - int flags; /* Used to specify additional flags - * that must be present in config specs - * for them to be considered. */ +Tk_ConfigureValue( + Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tk_Window tkwin, /* Window corresponding to widgRec. */ + Tk_ConfigSpec *specs, /* Describes legal options. */ + char *widgRec, /* Record whose fields contain current values + * for options. */ + CONST char *argvName, /* Gives the command-line name for the option + * whose value is to be returned. */ + int flags) /* Used to specify additional flags that must + * be present in config specs for them to be + * considered. */ { Tk_ConfigSpec *specPtr; int needFlags, hateFlags; @@ -959,7 +936,8 @@ Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags) if (specPtr == NULL) { return TCL_ERROR; } - result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, &freeProc); + result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, + &freeProc); Tcl_SetResult(interp, (char *) result, TCL_VOLATILE); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { @@ -982,24 +960,27 @@ Tk_ConfigureValue(interp, tkwin, specs, widgRec, argvName, flags) * None. * * Side effects: - * Any resource in widgRec that is controlled by a configuration - * option (e.g. a Tk_3DBorder or XColor) is freed in the appropriate - * fashion. + * Any resource in widgRec that is controlled by a configuration option + * (e.g. a Tk_3DBorder or XColor) is freed in the appropriate fashion. + * + * Notes: + * Since this is not looking anything up, this uses the static version of + * the config specs. * *---------------------------------------------------------------------- */ /* ARGSUSED */ void -Tk_FreeOptions(specs, widgRec, display, needFlags) - Tk_ConfigSpec *specs; /* Describes legal options. */ - char *widgRec; /* Record whose fields contain current - * values for options. */ - Display *display; /* X display; needed for freeing some +Tk_FreeOptions( + Tk_ConfigSpec *specs, /* Describes legal options. */ + char *widgRec, /* Record whose fields contain current values + * for options. */ + Display *display, /* X display; needed for freeing some * resources. */ - int needFlags; /* Used to specify additional flags - * that must be present in config specs - * for them to be considered. */ + int needFlags) /* Used to specify additional flags that must + * be present in config specs for them to be + * considered. */ { register Tk_ConfigSpec *specPtr; char *ptr; @@ -1010,40 +991,40 @@ Tk_FreeOptions(specs, widgRec, display, needFlags) } ptr = widgRec + specPtr->offset; switch (specPtr->type) { - case TK_CONFIG_STRING: - if (*((char **) ptr) != NULL) { - ckfree(*((char **) ptr)); - *((char **) ptr) = NULL; - } - break; - case TK_CONFIG_COLOR: - if (*((XColor **) ptr) != NULL) { - Tk_FreeColor(*((XColor **) ptr)); - *((XColor **) ptr) = NULL; - } - break; - case TK_CONFIG_FONT: - Tk_FreeFont(*((Tk_Font *) ptr)); - *((Tk_Font *) ptr) = NULL; - break; - case TK_CONFIG_BITMAP: - if (*((Pixmap *) ptr) != None) { - Tk_FreeBitmap(display, *((Pixmap *) ptr)); - *((Pixmap *) ptr) = None; - } - break; - case TK_CONFIG_BORDER: - if (*((Tk_3DBorder *) ptr) != NULL) { - Tk_Free3DBorder(*((Tk_3DBorder *) ptr)); - *((Tk_3DBorder *) ptr) = NULL; - } - break; - case TK_CONFIG_CURSOR: - case TK_CONFIG_ACTIVE_CURSOR: - if (*((Tk_Cursor *) ptr) != None) { - Tk_FreeCursor(display, *((Tk_Cursor *) ptr)); - *((Tk_Cursor *) ptr) = None; - } + case TK_CONFIG_STRING: + if (*((char **) ptr) != NULL) { + ckfree(*((char **) ptr)); + *((char **) ptr) = NULL; + } + break; + case TK_CONFIG_COLOR: + if (*((XColor **) ptr) != NULL) { + Tk_FreeColor(*((XColor **) ptr)); + *((XColor **) ptr) = NULL; + } + break; + case TK_CONFIG_FONT: + Tk_FreeFont(*((Tk_Font *) ptr)); + *((Tk_Font *) ptr) = NULL; + break; + case TK_CONFIG_BITMAP: + if (*((Pixmap *) ptr) != None) { + Tk_FreeBitmap(display, *((Pixmap *) ptr)); + *((Pixmap *) ptr) = None; + } + break; + case TK_CONFIG_BORDER: + if (*((Tk_3DBorder *) ptr) != NULL) { + Tk_Free3DBorder(*((Tk_3DBorder *) ptr)); + *((Tk_3DBorder *) ptr) = NULL; + } + break; + case TK_CONFIG_CURSOR: + case TK_CONFIG_ACTIVE_CURSOR: + if (*((Tk_Cursor *) ptr) != None) { + Tk_FreeCursor(display, *((Tk_Cursor *) ptr)); + *((Tk_Cursor *) ptr) = None; + } } } } @@ -1053,28 +1034,28 @@ Tk_FreeOptions(specs, widgRec, display, needFlags) * * GetCachedSpecs -- * - *Returns a writable per-interpreter (and hence thread-local) copy of - *the given spec-table with (some of) the char* fields converted into - *Tk_Uid fields; this copy will be released when the interpreter - *terminates (during AssocData cleanup). + * Returns a writable per-interpreter (and hence thread-local) copy of + * the given spec-table with (some of) the char* fields converted into + * Tk_Uid fields; this copy will be released when the interpreter + * terminates (during AssocData cleanup). * * Results: - *A pointer to the copied table. + * A pointer to the copied table. * * Notes: - *The conversion to Tk_Uid is only done the first time, when the table - *copy is taken. After that, the table is assumed to have Tk_Uids where - *they are needed. The time of deletion of the caches isn't very - *important unless you've got a lot of code that uses Tk_ConfigureWidget - *(or *Info or *Value} when the interpreter is being deleted. + * The conversion to Tk_Uid is only done the first time, when the table + * copy is taken. After that, the table is assumed to have Tk_Uids where + * they are needed. The time of deletion of the caches isn't very + * important unless you've got a lot of code that uses Tk_ConfigureWidget + * (or *Info or *Value} when the interpreter is being deleted. * *-------------------------------------------------------------- */ static Tk_ConfigSpec * -GetCachedSpecs(interp, staticSpecs) - Tcl_Interp *interp; /* Interpreter in which to store the cache. */ - const Tk_ConfigSpec *staticSpecs; +GetCachedSpecs( + Tcl_Interp *interp, /* Interpreter in which to store the cache. */ + const Tk_ConfigSpec *staticSpecs) /* Value to cache a copy of; it is also used * as a key into the cache. */ { @@ -1126,7 +1107,7 @@ GetCachedSpecs(interp, staticSpecs) */ cachedSpecs = (Tk_ConfigSpec *) ckalloc(entrySpace); - memcpy((void *) cachedSpecs, (void *) staticSpecs, entrySpace); + memcpy(cachedSpecs, staticSpecs, entrySpace); Tcl_SetHashValue(entryPtr, (ClientData) cachedSpecs); /* @@ -1147,6 +1128,7 @@ GetCachedSpecs(interp, staticSpecs) specPtr->defValue = Tk_GetUid(specPtr->defValue); } } + specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED; } } else { cachedSpecs = (Tk_ConfigSpec *) Tcl_GetHashValue(entryPtr); @@ -1167,15 +1149,15 @@ GetCachedSpecs(interp, staticSpecs) * None * * Side effects: - * None + * None (does *not* use any Tk API). * *-------------------------------------------------------------- */ static void -DeleteSpecCacheTable(clientData, interp) - ClientData clientData; - Tcl_Interp *interp; +DeleteSpecCacheTable( + ClientData clientData, + Tcl_Interp *interp) { Tcl_HashTable *tablePtr = (Tcl_HashTable *) clientData; Tcl_HashEntry *entryPtr; @@ -1192,3 +1174,11 @@ DeleteSpecCacheTable(clientData, interp) Tcl_DeleteHashTable(tablePtr); ckfree((char *) tablePtr); } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |