diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-21 08:11:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-21 08:11:21 (GMT) |
commit | ed7fb54396eee6e5122bfe611b2a14cf422970fa (patch) | |
tree | 2155194029aa5ccfd6cdf90913ff12109c494add /generic/tkCanvWind.c | |
parent | f4db69f3300fe5cdb3da35c67bf608674950a72c (diff) | |
download | tk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.zip tk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.tar.gz tk-ed7fb54396eee6e5122bfe611b2a14cf422970fa.tar.bz2 |
consistent error formatting, added error codes
Diffstat (limited to 'generic/tkCanvWind.c')
-rw-r--r-- | generic/tkCanvWind.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 0c54741..ef4cc03 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -259,6 +259,8 @@ WinItemCoords( } else if (objc != 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 2, got %d", objc)); + Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "WINDOW", + NULL); return TCL_ERROR; } } @@ -271,6 +273,7 @@ WinItemCoords( } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 2, got %d", objc)); + Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "WINDOW", NULL); return TCL_ERROR; } return TCL_OK; @@ -337,8 +340,7 @@ ConfigureWinItem( */ parent = Tk_Parent(winItemPtr->tkwin); - for (ancestor = canvasTkwin; ; - ancestor = Tk_Parent(ancestor)) { + for (ancestor = canvasTkwin ;; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } @@ -370,8 +372,10 @@ ConfigureWinItem( return TCL_OK; badWindow: - Tcl_AppendResult(interp, "can't use ", Tk_PathName(winItemPtr->tkwin), - " in a window item of this canvas", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't use %s in a window item of this canvas", + Tk_PathName(winItemPtr->tkwin))); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); winItemPtr->tkwin = NULL; return TCL_ERROR; } @@ -842,7 +846,7 @@ CanvasPsWindow( Tcl_DStringInit(&buffer1); Tcl_DStringInit(&buffer2); Tcl_DStringGetResult(interp, &buffer2); - sprintf(buffer, "%s postscript -prolog 0\n", Tk_PathName(tkwin)); + sprintf(buffer, "%s postscript -prolog 0", Tk_PathName(tkwin)); result = Tcl_Eval(interp, buffer); Tcl_DStringGetResult(interp, &buffer1); Tcl_DStringResult(interp, &buffer2); |