summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/Interp.313
-rw-r--r--doc/SetResult.314
-rw-r--r--generic/tclBasic.c10
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclLoad.c3
-rw-r--r--generic/tclResult.c17
-rw-r--r--generic/tclStubLib.c4
7 files changed, 14 insertions, 51 deletions
diff --git a/doc/Interp.3 b/doc/Interp.3
index d908057..d5006f9 100644
--- a/doc/Interp.3
+++ b/doc/Interp.3
@@ -33,19 +33,6 @@ the pointer as described below is no longer supported. The supported
public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR,
\fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead.
.PP
-For legacy programs and extensions no longer being maintained, compiles
-against the Tcl 8.6 header files are only possible with the compiler
-directives
-.CS
-#define USE_INTERP_RESULT
-.CE
-and/or
-.CS
-#define USE_INTERP_ERRORLINE
-.CE
-depending on which fields of the \fBTcl_Interp\fR struct are accessed.
-These directives may be embedded in code or supplied via compiler options.
-.PP
The \fIresult\fR and \fIfreeProc\fR fields are used to return
results or error messages from commands.
This information is returned by command procedures back to \fBTcl_Eval\fR,
diff --git a/doc/SetResult.3 b/doc/SetResult.3
index bbeedf1..c863c5a 100644
--- a/doc/SetResult.3
+++ b/doc/SetResult.3
@@ -199,17 +199,11 @@ change \fIinterp->result\fR or clear error state.
is about to replace one result value with another.
.SS "DIRECT ACCESS TO INTERP->RESULT"
.PP
-It used to be legal for programs to
-directly read and write \fIinterp->result\fR
-to manipulate the interpreter result. The Tcl headers no longer
-permit this access by default, and C code still doing this must
-be updated to use supported routines \fBTcl_GetObjResult\fR,
+It used to be legal for programs to directly read and write
+\fIinterp->result\fR to manipulate the interpreter result.
+The Tcl headers no longer permit this access, and C code still
+doing this must be updated to use supported routines \fBTcl_GetObjResult\fR,
\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR.
-As a migration aid, access can be restored with the compiler directive
-.CS
-#define USE_INTERP_RESULT
-.CE
-but this is meant only to offer life support to otherwise dead code.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 24a1082..7202184 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -486,7 +486,11 @@ Tcl_CreateInterp(void)
interp = (Tcl_Interp *) iPtr;
iPtr->legacyResult = NULL;
+ /* Special invalid value: Any attempt to free the legacy result
+ * will cause a crash. */
+ iPtr->legacyFreeProc = (void (*) (void))-1;
iPtr->errorLine = 0;
+ iPtr->stubTable = &tclStubs;
iPtr->objResultPtr = Tcl_NewObj();
Tcl_IncrRefCount(iPtr->objResultPtr);
iPtr->handle = TclHandleCreate(iPtr);
@@ -681,12 +685,6 @@ Tcl_CreateInterp(void)
#endif /* TCL_COMPILE_STATS */
/*
- * Initialise the stub table pointer.
- */
-
- iPtr->stubTable = &tclStubs;
-
- /*
* Initialize the ensemble error message rewriting support.
*/
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 5192688..0efb1b6 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -1811,8 +1811,8 @@ typedef struct Interp {
* that one undisturbed.
*/
- char *legacyResult;
- Tcl_FreeProc *legacyFreeProc;
+ const char *legacyResult;
+ void (*legacyFreeProc) (void);
int errorLine; /* When TCL_ERROR is returned, this gives the
* line number in the command where the error
* occurred (1 means first line). */
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 80efdd8..75e513d 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -470,7 +470,7 @@ Tcl_LoadObjCmd(
if (code != TCL_OK) {
Interp *iPtr = (Interp *) target;
- if (iPtr->legacyResult != NULL) {
+ if (iPtr->legacyResult && !iPtr->legacyFreeProc) {
/*
* A call to Tcl_InitStubs() determined the caller extension and
* this interp are incompatible in their stubs mechanisms, and
@@ -478,6 +478,7 @@ Tcl_LoadObjCmd(
*/
Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1));
iPtr->legacyResult = NULL;
+ iPtr->legacyFreeProc = (void (*) (void))-1;
}
Tcl_TransferResult(target, code, interp);
goto done;
diff --git a/generic/tclResult.c b/generic/tclResult.c
index b8f9c92..618b7d8 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -474,23 +474,6 @@ Tcl_AppendResultVA(
}
Tcl_AppendStringsToObjVA(objPtr, argList);
Tcl_SetObjResult(interp, objPtr);
-
- /*
- * Strictly we should call Tcl_GetStringResult(interp) here to make sure
- * that interp->result is correct according to the old contract, but that
- * makes the performance of much code (e.g. in Tk) absolutely awful. So we
- * leave it out; code that really wants interp->result can just insert the
- * calls to Tcl_GetStringResult() itself. [Patch 1041072 discussion]
- */
-
-#ifdef USE_INTERP_RESULT
- /*
- * Ensure that the interp->result is legal so old Tcl 7.* code still
- * works. There's still embarrasingly much of it about...
- */
-
- (void) Tcl_GetStringResult(interp);
-#endif /* USE_INTERP_RESULT */
}
/*
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 501072c..9a2e063 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -47,8 +47,8 @@ HasStubSupport(
return iPtr->stubTable;
}
iPtr->legacyResult
- = (char *) "interpreter uses an incompatible stubs mechanism";
- iPtr->legacyFreeProc = TCL_STATIC;
+ = "interpreter uses an incompatible stubs mechanism";
+ iPtr->legacyFreeProc = 0; /* TCL_STATIC */
return NULL;
}