Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/SubstObj.3 @ 33

Last change on this file since 33 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 2.8 KB
Line 
1'\"
2'\" Copyright (c) 2001 Donal K. Fellows
3'\"
4'\" See the file "license.terms" for information on usage and redistribution
5'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6'\"
7'\" RCS: @(#) $Id: SubstObj.3,v 1.7 2007/12/13 15:22:32 dgp Exp $
8'\"
9.so man.macros
10.TH Tcl_SubstObj 3 8.4 Tcl "Tcl Library Procedures"
11.BS
12.SH NAME
13Tcl_SubstObj \- perform substitutions on Tcl objects
14.SH SYNOPSIS
15.nf
16\fB#include <tcl.h>\fR
17.sp
18Tcl_Obj *
19\fBTcl_SubstObj\fR(\fIinterp, objPtr, flags\fR)
20.SH ARGUMENTS
21.AS Tcl_Interp **termPtr
22.AP Tcl_Interp *interp in
23Interpreter in which to execute Tcl scripts and lookup variables.  If
24an error occurs, the interpreter's result is modified to hold an error
25message.
26.AP Tcl_Obj *objPtr in
27A Tcl object containing the string to perform substitutions on.
28.AP int flags in
29ORed combination of flag bits that specify which substitutions to
30perform.  The flags \fBTCL_SUBST_COMMANDS\fR,
31\fBTCL_SUBST_VARIABLES\fR and \fBTCL_SUBST_BACKSLASHES\fR are
32currently supported, and \fBTCL_SUBST_ALL\fR is provided as a
33convenience for the common case where all substitutions are desired.
34.BE
35.SH DESCRIPTION
36.PP
37The \fBTcl_SubstObj\fR function is used to perform substitutions on
38strings in the fashion of the \fBsubst\fR command.  It gets the value
39of the string contained in \fIobjPtr\fR and scans it, copying
40characters and performing the chosen substitutions as it goes to an
41output object which is returned as the result of the function.  In the
42event of an error occurring during the execution of a command or
43variable substitution, the function returns NULL and an error message
44is left in \fIinterp\fR's result.
45.PP
46Three kinds of substitutions are supported.  When the
47\fBTCL_SUBST_BACKSLASHES\fR bit is set in \fIflags\fR, sequences that
48look like backslash substitutions for Tcl commands are replaced by
49their corresponding character.
50.PP
51When the \fBTCL_SUBST_VARIABLES\fR bit is set in \fIflags\fR,
52sequences that look like variable substitutions for Tcl commands are
53replaced by the contents of the named variable.
54.PP
55When the \fBTCL_SUBST_COMMANDS\fR bit is set in \fIflags\fR, sequences
56that look like command substitutions for Tcl commands are replaced by
57the result of evaluating that script.  Where an uncaught
58.QW "continue exception"
59occurs during the evaluation of a command substitution, an
60empty string is substituted for the command.  Where an uncaught
61.QW "break exception"
62occurs during the evaluation of a command substitution, the
63result of the whole substitution on \fIobjPtr\fR will be truncated at
64the point immediately before the start of the command substitution,
65and no characters will be added to the result or substitutions
66performed after that point.
67.SH "SEE ALSO"
68subst(n)
69.SH KEYWORDS
70backslash substitution, command substitution, variable substitution
Note: See TracBrowser for help on using the repository browser.