diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-16 12:36:40 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-16 12:36:40 (GMT) |
commit | f4db69f3300fe5cdb3da35c67bf608674950a72c (patch) | |
tree | 83188d92aa77a52a178e0ae85ba5439c402f4eca /generic/tkConfig.c | |
parent | 8f22ecfac96ac10f3c1aa3df10a10071ed591d9b (diff) | |
download | tk-f4db69f3300fe5cdb3da35c67bf608674950a72c.zip tk-f4db69f3300fe5cdb3da35c67bf608674950a72c.tar.gz tk-f4db69f3300fe5cdb3da35c67bf608674950a72c.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; } |