diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-28 12:56:23 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-28 12:56:23 (GMT) |
commit | cb6caf171d10b8568ec7002b261dee6dbe7e77bc (patch) | |
tree | a7b1435d71321f8f7eef7e39212a6b5b1c7b3a72 /doc | |
parent | 4c592a9067ad846bafeecd1bbe492053470bb4f6 (diff) | |
download | tcl-cb6caf171d10b8568ec7002b261dee6dbe7e77bc.zip tcl-cb6caf171d10b8568ec7002b261dee6dbe7e77bc.tar.gz tcl-cb6caf171d10b8568ec7002b261dee6dbe7e77bc.tar.bz2 |
Added example
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source.n | 15 | ||||
-rw-r--r-- | doc/update.n | 18 |
2 files changed, 31 insertions, 2 deletions
diff --git a/doc/source.n b/doc/source.n index 9bbe7ce..c936d71 100644 --- a/doc/source.n +++ b/doc/source.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: source.n,v 1.8 2004/03/17 18:45:49 das Exp $ +'\" RCS: @(#) $Id: source.n,v 1.9 2004/05/28 12:59:01 dkf Exp $ '\" .so man.macros .TH source n "" Tcl "Tcl Built-In Commands" @@ -46,6 +46,19 @@ The \fB-encoding\fR option is used to specify the encoding of the data stored in \fIfileName\fR. When the \fB-encoding\fR option is omitted, the system encoding is assumed. .VE 8.5 +.SH EXAMPLE +Run the script in the file \fBfoo.tcl\fR and then the script in the +file \fBbar.tcl\fR: +.CS +source foo.tcl +source bar.tcl +.CE +Alternatively: +.CS +foreach scriptFile {foo.tcl bar.tcl} { + source $scriptFile +} +.CE .SH "SEE ALSO" file(n), cd(n), encoding(n) diff --git a/doc/update.n b/doc/update.n index 87c2a7d..060ffb7 100644 --- a/doc/update.n +++ b/doc/update.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: update.n,v 1.4 2000/09/07 14:27:52 poenitz Exp $ +'\" RCS: @(#) $Id: update.n,v 1.5 2004/05/28 12:56:23 dkf Exp $ '\" .so man.macros .TH update n 7.5 Tcl "Tcl Built-In Commands" @@ -43,6 +43,22 @@ you are performing a long-running computation but you still want the application to respond to events such as user interactions; if you occasionally call \fBupdate\fR then user input will be processed during the next call to \fBupdate\fR. +.SH EXAMPLE +Run computations for about a second and then finish: +.CS +set x 1000 +set done 0 +after 1000 set done 1 +while {!$done} { + # A very silly example! + set x [expr {log($x) ** 2.8}] + + # Test to see if our time-limit has been hit. This would + # also give a chance for serving network sockets and, if + # the Tk package is loaded, updating a user interface. + \fBupdate\fR +} +.CE .SH "SEE ALSO" after(n), bgerror(n) |