diff options
Diffstat (limited to 'generic/tkUtil.c')
-rw-r--r-- | generic/tkUtil.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 2a8240b..bfa5d5c 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -976,89 +976,6 @@ TkFindStateNumObj( } /* - * ---------------------------------------------------------------------- - * - * TkBackgroundEvalObjv -- - * - * Evaluate a command while ensuring that we do not affect the - * interpreters state. This is important when evaluating script - * during background tasks. - * - * Results: - * A standard Tcl result code. - * - * Side Effects: - * The interpreters variables and code may be modified by the script - * but the result will not be modified. - * - * ---------------------------------------------------------------------- - */ - -int -TkBackgroundEvalObjv( - Tcl_Interp *interp, - int objc, - Tcl_Obj *const *objv, - int flags) -{ - Tcl_DString errorInfo, errorCode; - Tcl_SavedResult state; - int n, r = TCL_OK; - - Tcl_DStringInit(&errorInfo); - Tcl_DStringInit(&errorCode); - - Tcl_Preserve(interp); - - /* - * Record the state of the interpreter - */ - - Tcl_SaveResult(interp, &state); - Tcl_DStringAppend(&errorInfo, - Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1); - Tcl_DStringAppend(&errorCode, - Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY), -1); - - /* - * Evaluate the command and handle any error. - */ - - for (n = 0; n < objc; ++n) { - Tcl_IncrRefCount(objv[n]); - } - r = Tcl_EvalObjv(interp, objc, objv, flags); - for (n = 0; n < objc; ++n) { - Tcl_DecrRefCount(objv[n]); - } - if (r == TCL_ERROR) { - Tcl_AddErrorInfo(interp, "\n (background event handler)"); - Tcl_BackgroundError(interp); - } - - Tcl_Release(interp); - - /* - * Restore the state of the interpreter - */ - - Tcl_SetVar(interp, "errorInfo", - Tcl_DStringValue(&errorInfo), TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "errorCode", - Tcl_DStringValue(&errorCode), TCL_GLOBAL_ONLY); - Tcl_RestoreResult(interp, &state); - - /* - * Clean up references. - */ - - Tcl_DStringFree(&errorInfo); - Tcl_DStringFree(&errorCode); - - return r; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 |