NAME

Tcl_SetObjResult, Tcl_GetObjResult, Tcl_ResetObjResult - manipulate Tcl result string

SYNOPSIS

#include <tcl.h>
Tcl_SetObjResult(interp, objPtr)
Tcl_Obj *
Tcl_GetObjResult(interp)
Tcl_ResetObjResult(interp)

ARGUMENTS

Tcl_Interp *interp (out)
Interpreter whose object result is to be modified.

Tcl_Obj *objPtr (in)
The object value to become the object result for interp.

DESCRIPTION

The procedures described here are utilities for setting the result/error object for a Tcl interpreter.

Tcl_SetObjResult arranges for objPtr to be the result object for the current Tcl command in interp, replacing any existing result object. If objPtr is NULL, the interpreter's result object is set to a new Tcl object containing an empty string. Otherwise, the result object is left pointing to the object referenced by objPtr. objPtr's reference count is incremented since there is now a new reference to it from interp. The reference count for any old result object is decremented and the old object result is freed if no references to it remain. This result object can be retrieved using Tcl_GetObjResult.

Tcl_GetObjResult returns the Tcl object result value for interp. The object's reference count is not incremented; if the caller needs to retain a pointer to object they should use Tcl_IncrRefCount to increment its reference count in order to keep it from being freed too early or accidently changed.

Tcl_ResetObjResult clears the object result for interp. It sets the interpreter's result object to an object containing an empty string after decrementing the reference count for any old result object. Tcl_ResetObjResult also clears the error state managed by Tcl_AddObjErrorInfo and Tcl_AddErrorInfo and Tcl_SetErrorCode.

SEE ALSO

Tcl_AddErrorInfo, Tcl_SetErrorCode, Tcl_Interp, Tcl_Obj

KEYWORDS

append, command, object, result, return value
Copyright © 1996-1997 Sun Microsystems, Inc.
Copyright © 1995, 1996 Roger E. Critchlow Jr.