summaryrefslogtreecommitdiffstats
path: root/carbon
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-29 17:55:29 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-29 17:55:29 (GMT)
commit27b42b57118a651074b7f1fcc859fc4ae00090d0 (patch)
tree08f1a3f320a79a97a0575dbb2738fa3fde376755 /carbon
parent77acd42d86b6416b8ee9420f6e9ff759f06c28ab (diff)
downloadtk-27b42b57118a651074b7f1fcc859fc4ae00090d0.zip
tk-27b42b57118a651074b7f1fcc859fc4ae00090d0.tar.gz
tk-27b42b57118a651074b7f1fcc859fc4ae00090d0.tar.bz2
Purged Tcl_AppendElement from all non-test code.
Diffstat (limited to 'carbon')
-rw-r--r--carbon/tkMacOSXWm.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/carbon/tkMacOSXWm.c b/carbon/tkMacOSXWm.c
index 2f1caa1..09c796b 100644
--- a/carbon/tkMacOSXWm.c
+++ b/carbon/tkMacOSXWm.c
@@ -1166,10 +1166,9 @@ WmColormapwindowsCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- TkWindow **cmapList;
- TkWindow *winPtr2;
+ TkWindow **cmapList, *winPtr2;
int i, windowObjc, gotToplevel = 0;
- Tcl_Obj **windowObjv;
+ Tcl_Obj **windowObjv, *resultObj;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?");
@@ -1177,13 +1176,16 @@ WmColormapwindowsCmd(
}
if (objc == 3) {
Tk_MakeWindowExist((Tk_Window) winPtr);
+ resultObj = Tcl_NewObj();
for (i = 0; i < wmPtr->cmapCount; i++) {
if ((i == (wmPtr->cmapCount-1))
&& (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
break;
}
- Tcl_AppendElement(interp, wmPtr->cmapList[i]->pathName);
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ TkNewWindowObj((Tk_Window) wmPtr->cmapList[i]));
}
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
if (Tcl_ListObjGetElements(interp, objv[3], &windowObjc, &windowObjv)
@@ -2480,6 +2482,7 @@ WmProtocolCmd(
Atom protocol;
char *cmd;
int cmdLength;
+ Tcl_Obj *resultObj;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
@@ -2490,11 +2493,13 @@ WmProtocolCmd(
* Return a list of all defined protocols for the window.
*/
+ resultObj = Tcl_NewObj();
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
- Tcl_AppendElement(interp,
- Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
+ Tk_GetAtomName((Tk_Window)winPtr, protPtr->protocol),-1));
}
+ Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
}
protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3]));
@@ -2707,11 +2712,14 @@ WmStackorderCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- TkWindow **windows, **window_ptr;
+ TkWindow **windows, **windowPtr;
static const char *const optionStrings[] = {
- "isabove", "isbelow", NULL };
+ "isabove", "isbelow", NULL
+ };
enum options {
- OPT_ISABOVE, OPT_ISBELOW };
+ OPT_ISABOVE, OPT_ISBELOW
+ };
+ Tcl_Obj *resultObj;
int index;
if ((objc != 3) && (objc != 5)) {
@@ -2725,14 +2733,17 @@ WmStackorderCmd(
Tcl_Panic("TkWmStackorderToplevel failed");
}
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ resultObj = Tcl_NewObj();
+ for (windowPtr = windows; *windowPtr ; windowPtr++) {
+ Tcl_ListObjAppendElement(NULL, resultObj,
+ TkNewWindowObj((Tk_Window) *windowPtr));
}
+ Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
return TCL_OK;
} else {
TkWindow *winPtr2;
- int index1=-1, index2=-1, result;
+ int index1 = -1, index2 = -1, result;
if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
!= TCL_OK) {
@@ -2772,12 +2783,12 @@ WmStackorderCmd(
return TCL_ERROR;
}
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr) {
- index1 = (window_ptr - windows);
+ for (windowPtr = windows; *windowPtr ; windowPtr++) {
+ if (*windowPtr == winPtr) {
+ index1 = windowPtr - windows;
}
- if (*window_ptr == winPtr2) {
- index2 = (window_ptr - windows);
+ if (*windowPtr == winPtr2) {
+ index2 = windowPtr - windows;
}
}
if (index1 == -1) {
@@ -5939,7 +5950,7 @@ TkWmStackorderToplevel(
TkWindow *parentPtr) /* Parent toplevel window. */
{
WindowRef frontWindow;
- TkWindow *childWinPtr, **windows, **window_ptr;
+ TkWindow *childWinPtr, **windows, **windowPtr;
Tcl_HashTable table;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -5974,17 +5985,17 @@ TkWmStackorderToplevel(
ckfree(windows);
windows = NULL;
} else {
- window_ptr = windows + table.numEntries;
- *window_ptr-- = NULL;
+ windowPtr = windows + table.numEntries;
+ *windowPtr-- = NULL;
while (frontWindow != NULL) {
hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
if (hPtr != NULL) {
childWinPtr = Tcl_GetHashValue(hPtr);
- *window_ptr-- = childWinPtr;
+ *windowPtr-- = childWinPtr;
}
frontWindow = GetNextWindow(frontWindow);
}
- if (window_ptr != (windows-1)) {
+ if (windowPtr != windows-1) {
Tcl_Panic("num matched toplevel windows does not equal num "
"children");
}