Posted to tcl by patthoyts at Sun Jul 06 23:07:32 GMT 2008view pretty
static int BackgroundEvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int flags) { Tcl_DString errorInfo, errorCode; Tcl_SavedResult state; int r = TCL_OK; Tcl_DStringInit(&errorInfo); Tcl_DStringInit(&errorCode); /* * 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. */ r = Tcl_EvalObjv(interp, objc, objv, flags); if (r == TCL_ERROR) { Tcl_AddErrorInfo(interp, "\n (background event handler)"); Tcl_BackgroundError(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; }