Tcl Library Procedures Tcl_SubstObj(3TCL)
_________________________________________________________________
NAME
Tcl_SubstObj - perform substitutions on Tcl objects
SYNOPSIS
#include
Tcl_Obj *
Tcl_SubstObj(interp, objPtr, flags)
ARGUMENTSTcl_Interp *interp (in) Interpreter in which to
execute Tcl scripts and lookup variables. If an error occurs, the interpreter's result is modified to hold an error message.Tcl_Obj *objPtr (in) A Tcl object containing
the string to perform substitutions on. int flags (in) ORed combination of flag bits that specify whichsubstitutions to per-
form. The flagsTCL_SUBST_COMMANDS,
TCL_SUBST_VARIABLES and
TCL_SUBST_BACKSLASHES
are currently supported,and TCL_SUBST_ALL is
provided as a conveni-
ence for the common case where all substitutions are desired._________________________________________________________________
DESCRIPTION
The Tcl_SubstObj function is used to perform substitutions
on strings in the fashion of the subst command. It gets thevalue of the string contained in objPtr and scans it, copy-
ing characters and performing the chosen substitutions as it goes to an output object which is returned as the result of the function. In the event of an error occurring during theexecution of a command or variable substitution, the func-
tion returns NULL and an error message is left in interp's result. Tcl Last change: 8.4 1Tcl Library Procedures Tcl_SubstObj(3TCL)
Three kinds of substitutions are supported. When theTCL_SUBST_BACKSLASHES bit is set in flags, sequences that
look like backslash substitutions for Tcl commands are replaced by their corresponding character.When the TCL_SUBST_VARIABLES bit is set in flags, sequences
that look like variable substitutions for Tcl commands are replaced by the contents of the named variable.When th TCL_SUBST_COMMANDS bit is set in flags, sequences
that look like command substitutions for Tcl commands are replaced by the result of evaluating that script. Where an uncaught continue exception occurs during the evaluation of a command substitution, an empty string is substituted forthe command. Where an uncaught break exception occurs dur-
ing the evaluation of a command substitution, the result of the whole substitution on objPtr will be truncated at thepoint immediately before the start of the command substitu-
tion, and no characters will be added to the result or sub-
stitutions performed after that point.SEE ALSO
subst(1T) KEYWORDSbackslash substitution, command substitution, variable sub-
stitutionATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:_______________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE|
|____________________|__________________|_
| Availability | runtime/tcl-8 |
|____________________|__________________|_
| Interface Stability| Uncommitted ||____________________|_________________|
NOTES Source for Tcl is available on http://opensolaris.org. Tcl Last change: 8.4 2