File tkined-tcl85.patch of Package scotty
Index: tkined/generic/tkiEditor.c
===================================================================
--- tkined/generic/tkiEditor.c.orig
+++ tkined/generic/tkiEditor.c
@@ -124,7 +124,7 @@ Tki_CreateEditor (clientData, interp, ar
sprintf(buffer, "tkined%d", lastid++);
if (argc != 1) {
- interp->result = "wrong # args";
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
return TCL_ERROR;
}
@@ -162,14 +162,14 @@ Tki_CreateEditor (clientData, interp, ar
/* get the colormodel for this editor */
Tcl_Eval (interp, "winfo depth . ");
- editor->color = atoi (interp->result) > 2;
+ editor->color = atoi (Tcl_GetStringResult(interp)) > 2;
Tcl_ResetResult (interp);
ClearEditor (editor, interp, 0, (char **) NULL);
numEditors++;
- interp->result = editor->id;
+ Tcl_SetResult(interp, editor->id, TCL_STATIC);
return TCL_OK;
}
@@ -333,7 +333,7 @@ GetId (editor, interp, argc, argv)
int argc;
char **argv;
{
- interp->result = editor->id;
+ Tcl_SetResult(interp, editor->id, TCL_STATIC);
return TCL_OK;
}
@@ -352,11 +352,11 @@ Toplevel (editor, interp, argc, argv)
if (argc > 0 ) {
STRCOPY (editor->toplevel, argv[0]);
Tcl_VarEval (interp, "Editor__toplevel ", editor->id, (char *) NULL);
- fprintf (stderr, interp->result);
+ fprintf (stderr, Tcl_GetStringResult(interp));
Tcl_ResetResult (interp);
}
- interp->result = editor->toplevel;
+ Tcl_SetResult(interp, editor->toplevel, TCL_STATIC);
return TCL_OK;
}
@@ -456,8 +456,7 @@ GetColor (editor, interp, argc, argv)
int argc;
char **argv;
{
- sprintf (interp->result, "%d", editor->color);
-
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(editor->color));
return TCL_OK;
}
@@ -472,7 +471,7 @@ GetWidth (editor, interp, argc, argv)
int argc;
char **argv;
{
- sprintf (interp->result, "%d", editor->width);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(editor->width));
return TCL_OK;
}
@@ -487,7 +486,7 @@ GetHeight (editor, interp, argc, argv)
int argc;
char **argv;
{
- sprintf (interp->result, "%d", editor->height);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(editor->height));
return TCL_OK;
}
@@ -502,7 +501,7 @@ GetPageWidth (editor, interp, argc, argv
int argc;
char **argv;
{
- sprintf (interp->result, "%d", editor->pagewidth);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(editor->pagewidth));
return TCL_OK;
}
@@ -517,7 +516,7 @@ GetPageHeight (editor, interp, argc, arg
int argc;
char **argv;
{
- sprintf (interp->result, "%d", editor->pageheight);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(editor->pageheight));
return TCL_OK;
}
@@ -621,7 +620,7 @@ Tki_EditorPageSize (editor, interp, argc
Tcl_ResetResult (interp);
}
- interp->result = editor->pagesize;
+ Tcl_SetResult(interp, editor->pagesize, TCL_STATIC);
return TCL_OK;
}
@@ -666,9 +665,9 @@ Tki_EditorOrientation (editor, interp, a
}
if (editor->landscape) {
- interp->result = "landscape";
+ Tcl_SetResult(interp, "landscape", TCL_STATIC);
} else {
- interp->result = "portrait";
+ Tcl_SetResult(interp, "portrait", TCL_STATIC);
}
return TCL_OK;
@@ -702,7 +701,7 @@ Tki_EditorAttribute (editor, interp, arg
entryPtr = Tcl_FindHashEntry (&(editor->attr), argv[0]);
if (entryPtr != NULL) {
- interp->result = (char *) Tcl_GetHashValue (entryPtr);
+ Tcl_SetResult(interp, (char *) Tcl_GetHashValue (entryPtr), TCL_STATIC);
} else {
Tcl_ResetResult (interp);
}
@@ -713,7 +712,7 @@ Tki_EditorAttribute (editor, interp, arg
editor->id, argv[0], argv[1]);
} else {
fprintf (stderr, "-- %s attribute %s (%s)\n",
- editor->id, argv[0], interp->result);
+ editor->id, argv[0], Tcl_GetStringResult(interp));
}
}
@@ -794,6 +793,7 @@ do_dump (editor, interp, object, dstp)
Tki_Object *object;
Tcl_DString *dstp;
{
+ char *result;
if (object->done) return;
@@ -846,8 +846,10 @@ do_dump (editor, interp, object, dstp)
default:
Tcl_ResetResult (interp);
}
- if (*interp->result != '\0') {
- Tcl_DStringAppend (dstp, interp->result, -1);
+
+ result = Tcl_GetStringResult(interp);
+ if (*result != '\0') {
+ Tcl_DStringAppend (dstp, result, -1);
Tcl_DStringAppend (dstp, "\n", 1);
}
@@ -996,9 +998,9 @@ do_set (editor, interp, line)
line[len] = '\0';
if (do_ined (editor, interp, line) == TCL_OK) {
- line = Tcl_SetVar (interp, var, interp->result, TCL_GLOBAL_ONLY);
+ line = Tcl_SetVar (interp, var, Tcl_GetStringResult(interp), TCL_GLOBAL_ONLY);
if (line) {
- Tki_Object *object = Tki_LookupObject (interp->result);
+ Tki_Object *object = Tki_LookupObject (Tcl_GetStringResult(interp));
if (object) object->loaded = 1;
return TCL_OK;
}
@@ -1422,7 +1424,7 @@ LoadMap (editor, interp, argc, argv)
char *p;
if (argc != 1) {
- interp->result = "wrong # args";
+ Tcl_SetResult(interp,"wrong # args", TCL_STATIC);
return TCL_ERROR;
}
@@ -1490,7 +1492,7 @@ SaveMap (editor, interp, argc, argv)
Tki_Object *object;
if (argc != 1) {
- interp->result = "wrong # args";
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
return TCL_ERROR;
}
@@ -1529,7 +1531,7 @@ SaveMap (editor, interp, argc, argv)
if (object->editor == editor && (object->type == TKINED_INTERPRETER)) {
if (strlen(object->action) != 0) {
Tki_DumpObject (interp, object);
- fputs (interp->result, f);
+ fputs (Tcl_GetStringResult(interp), f);
fputs ("\n", f);
Tcl_ResetResult (interp);
}
@@ -1661,7 +1663,7 @@ EditorCommand (clientData, interp, argc,
Method *ds;
if (argc < 2) {
- interp->result = "wrong # args";
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
return TCL_ERROR;
}