1Tcl_SaveResult(3) Tcl Library Procedures Tcl_SaveResult(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult - save and restore
9 an interpreter's result
10
12 #include <tcl.h>
13
14 Tcl_SaveResult(interp, statePtr)
15
16 Tcl_RestoreResult(interp, statePtr)
17
18 Tcl_DiscardResult(statePtr)
19
21 Tcl_Interp *interp (in) Interpreter for which state
22 should be saved.
23
24 Tcl_SavedResult *statePtr (in) Pointer to location where inter‐
25 preter result should be saved or
26 restored.
27_________________________________________________________________
28
29
31 These routines allows a C procedure to take a snapshot of the current
32 interpreter result so that it can be restored after a call to Tcl_Eval
33 or some other routine that modifies the interpreter result. These rou‐
34 tines are passed a pointer to a structure that is used to store enough
35 information to restore the interpreter result state. This structure
36 can be allocated on the stack of the calling procedure. These routines
37 do not save the state of any error information in the interpreter (e.g.
38 the errorCode or errorInfo variables).
39
40 Tcl_SaveResult moves the string and object results of interp into the
41 location specified by statePtr. Tcl_SaveResult clears the result for
42 interp and leaves the result in its normal empty initialized state.
43
44 Tcl_RestoreResult moves the string and object results from statePtr
45 back into interp. Any result or error that was already in the inter‐
46 preter will be cleared. The statePtr is left in an uninitialized state
47 and cannot be used until another call to Tcl_SaveResult.
48
49 Tcl_DiscardResult releases the saved interpreter state stored at
50 statePtr. The state structure is left in an uninitialized state and
51 cannot be used until another call to Tcl_SaveResult.
52
53 Once Tcl_SaveResult is called to save the interpreter result, either
54 Tcl_RestoreResult or Tcl_DiscardResult must be called to properly clean
55 up the memory associated with the saved state.
56
57
59 result, state, interp
60
61
62
63Tcl 8.1 Tcl_SaveResult(3)