diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-30 07:46:19 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-30 07:46:19 (GMT) |
commit | ca5623894dd113cd5642189574cf6c104c64cad8 (patch) | |
tree | 7e57204b12abc171ad343d007edecaf1b17cdf09 /unix | |
parent | 27b42b57118a651074b7f1fcc859fc4ae00090d0 (diff) | |
download | tk-ca5623894dd113cd5642189574cf6c104c64cad8.zip tk-ca5623894dd113cd5642189574cf6c104c64cad8.tar.gz tk-ca5623894dd113cd5642189574cf6c104c64cad8.tar.bz2 |
Working towards making the error codes more consistent.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixCursor.c | 20 | ||||
-rw-r--r-- | unix/tkUnixEmbed.c | 16 | ||||
-rw-r--r-- | unix/tkUnixWm.c | 12 |
3 files changed, 22 insertions, 26 deletions
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 3103cc1..8a19c7b 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -277,7 +277,7 @@ TkGetCursorByName( if (TkParseColor(display, Tk_Colormap(tkwin), argv[1], &fg) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", argv[1])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "FGCOL", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL); goto cleanup; } if (argc == 2) { @@ -287,7 +287,7 @@ TkGetCursorByName( &bg) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", argv[2])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "BGCOL", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL); goto cleanup; } } @@ -428,7 +428,7 @@ CreateCursorFromTableOrFile( if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap data for \"%s\"", argv[0])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAPDATA", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_DATA", NULL); goto cleanup; } @@ -440,7 +440,7 @@ CreateCursorFromTableOrFile( &source, &xHot, &yHot) != BitmapSuccess) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cleanup reading bitmap file \"%s\"", &argv[0][1])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAPFILE", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_FILE", NULL); goto cleanup; } } @@ -469,7 +469,7 @@ CreateCursorFromTableOrFile( if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", fgColor)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "FGCOL", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL); goto cleanup; } if (inTkTable) { @@ -489,13 +489,13 @@ CreateCursorFromTableOrFile( if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", fgColor)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "FGCOL", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL); goto cleanup; } if (TkParseColor(display, Tk_Colormap(tkwin), bgColor, &bg) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", bgColor)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "BGCOL", NULL); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "COLOR", NULL); goto cleanup; } } @@ -526,7 +526,7 @@ CreateCursorFromTableOrFile( if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap mask data for \"%s\"", argv[0])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASKDATA", -1); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_DATA", NULL); goto cleanup; } @@ -540,7 +540,7 @@ CreateCursorFromTableOrFile( &mask, &dummy1, &dummy2) != BitmapSuccess) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cleanup reading bitmap file \"%s\"", argv[1])); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASKFILE", -1); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_FILE", NULL); goto cleanup; } } @@ -548,7 +548,7 @@ CreateCursorFromTableOrFile( if ((maskWidth != width) || (maskHeight != height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "source and mask bitmaps have different sizes", -1)); - Tcl_SetErrorCode(interp, "TK", "CURSOR", "SIZE_MATCH", -1); + Tcl_SetErrorCode(interp, "TK", "CURSOR", "SIZE_MATCH", NULL); goto cleanup; } diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index d94157c..8a4c368 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -121,14 +121,12 @@ TkpUseWindow( parent = (Window) id; usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, parent); - if (usePtr != NULL) { - if (!(usePtr->flags & TK_CONTAINER)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window \"%s\" doesn't have -container option set", - usePtr->pathName)); - Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL); - return TCL_ERROR; - } + if (usePtr != NULL && !(usePtr->flags & TK_CONTAINER)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "window \"%s\" doesn't have -container option set", + usePtr->pathName)); + Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL); + return TCL_ERROR; } /* @@ -150,7 +148,7 @@ TkpUseWindow( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't create child of window \"%s\"", string)); - Tcl_SetErrorCode(interp, "TK", "EMBED", "CHILD", NULL); + Tcl_SetErrorCode(interp, "TK", "EMBED", "NO_TARGET", NULL); } return TCL_ERROR; } diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 0142768..e63da88 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -2208,31 +2208,29 @@ WmIconifyCmd( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); - Tcl_SetErrorCode(interp, "TK", "WM", "CANNOT_ICONIFY", - "OVERRIDE_REDIRECT", NULL); + Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", + NULL); return TCL_ERROR; } if (wmPtr->masterPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); - Tcl_SetErrorCode(interp, "TK", "WM", "CANNOT_ICONIFY", "TRANSIENT", - NULL); + Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "TRANSIENT", NULL); return TCL_ERROR; } if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify %s: it is an icon for %s", winPtr->pathName, Tk_PathName(wmPtr->iconFor))); - Tcl_SetErrorCode(interp, "TK", "WM", "CANNOT_ICONIFY", "ICON", NULL); + Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify %s: it is an embedded window", winPtr->pathName)); - Tcl_SetErrorCode(interp, "TK", "WM", "CANNOT_ICONIFY", "EMBEDDED", - NULL); + Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; } if (TkpWmSetState(winPtr, IconicState) == 0) { |