diff options
author | donal.k.fellows@manchester.ac.uk <dkf> | 2012-07-16 12:36:40 (GMT) |
---|---|---|
committer | donal.k.fellows@manchester.ac.uk <dkf> | 2012-07-16 12:36:40 (GMT) |
commit | 28d5754e102ceb55ec60fe998f47eb81cd8036c7 (patch) | |
tree | 83188d92aa77a52a178e0ae85ba5439c402f4eca /generic/tkConfig.c | |
parent | a9071191aeb6d0b8121f05cc9f4f9979cd9a25ab (diff) | |
download | tk-28d5754e102ceb55ec60fe998f47eb81cd8036c7.zip tk-28d5754e102ceb55ec60fe998f47eb81cd8036c7.tar.gz tk-28d5754e102ceb55ec60fe998f47eb81cd8036c7.tar.bz2 |
Working towards adding all the Tcl_SetErrorCode calls that should be there.
** WORK IN PROGRESS **
Diffstat (limited to 'generic/tkConfig.c')
-rw-r--r-- | generic/tkConfig.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 5262f58..51ac6dc 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -946,16 +946,13 @@ DoObjConfig( break; } - { - char buf[40+TCL_INTEGER_SPACE]; - default: - sprintf(buf, "bad config table: unknown type %d", - optionPtr->specPtr->type); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad config table: unknown type %d", + optionPtr->specPtr->type)); + Tcl_SetErrorCode(interp, "TK", "BAD_CONFIG", NULL); return TCL_ERROR; } - } /* * Release resources associated with the old value, if we're not returning @@ -1162,6 +1159,7 @@ GetOptionFromObj( error: if (interp != NULL) { Tcl_AppendResult(interp, "unknown option \"", name, "\"", NULL); + Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", name, NULL); } return NULL; } @@ -1231,9 +1229,10 @@ SetOptionFromAny( Tcl_AppendResult(interp, "can't convert value to option except via GetOptionFromObj API", NULL); + Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); return TCL_ERROR; } - + /* *---------------------------------------------------------------------- * @@ -1348,6 +1347,7 @@ Tk_SetOptions( if (interp != NULL) { Tcl_AppendResult(interp, "value for \"", Tcl_GetStringFromObj(*objv, NULL), "\" missing",NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", NULL); goto error; } } @@ -1369,11 +1369,9 @@ Tk_SetOptions( if (DoObjConfig(interp, recordPtr, optionPtr, objv[1], tkwin, (savePtr != NULL) ? &lastSavePtr->items[lastSavePtr->numItems] : NULL) != TCL_OK) { - char msg[100]; - - sprintf(msg, "\n (processing \"%.40s\" option)", - Tcl_GetStringFromObj(*objv, NULL)); - Tcl_AddErrorInfo(interp, msg); + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (processing \"%.40s\" option)", + Tcl_GetStringFromObj(*objv, NULL))); goto error; } if (savePtr != NULL) { @@ -1771,7 +1769,6 @@ FreeResources( * single option or all the configuration options in a table. * * Results: - * This function normally returns a pointer to an object. If namePtr * isn't NULL, then the result object is a list with five elements: the * option's name, its database name, database class, default value, and @@ -2154,8 +2151,7 @@ TkDebugConfig( Tcl_Obj *objPtr; objPtr = Tcl_NewObj(); - hashTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, OPTION_HASH_KEY, - NULL); + hashTablePtr = Tcl_GetAssocData(interp, OPTION_HASH_KEY, NULL); if (hashTablePtr == NULL) { return objPtr; } |