diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/FileSystem.3 | 26 | ||||
-rw-r--r-- | doc/source.n | 16 | ||||
-rw-r--r-- | doc/tclsh.1 | 20 |
3 files changed, 43 insertions, 19 deletions
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index c7113b9..acfb093 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: FileSystem.3,v 1.34 2003/07/28 12:16:02 vincentdarley Exp $ +'\" RCS: @(#) $Id: FileSystem.3,v 1.35 2003/09/05 21:52:11 dgp Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" @@ -28,10 +28,10 @@ void \fBTcl_FSMountsChanged\fR(\fIfsPtr\fR) .sp Tcl_Filesystem* -\fBTcl_FSGetFileSystemForPath\fR(\fIpathObjPtr\fR) +\fBTcl_FSGetFileSystemForPath\fR(\fIpathPtr\fR) .sp Tcl_PathType -\fBTcl_FSGetPathType\fR(\fIpathObjPtr\fR) +\fBTcl_FSGetPathType\fR(\fIpathPtr\fR) .sp int \fBTcl_FSCopyFile\fR(\fIsrcPathPtr, destPathPtr\fR) @@ -54,6 +54,11 @@ int Tcl_Obj* \fBTcl_FSListVolumes\fR(\fIvoid\fR) .sp +.VS 8.5 +int +\fBTcl_FSEvalFileEx\fR(\fIinterp, pathPtr, encodingName\fR) +.VE 8.5 +.sp int \fBTcl_FSEvalFile\fR(\fIinterp, pathPtr\fR) .sp @@ -138,7 +143,7 @@ Tcl_Obj* Tcl_StatBuf* \fBTcl_AllocStatBuf\fR() .SH ARGUMENTS -.AS Tcl_Filesystem *fsPtr in +.AS "CONST char" *encodingName in .AP Tcl_Filesystem *fsPtr in Points to a structure containing the addresses of procedures that can be called to perform the various filesystem operations. @@ -152,6 +157,9 @@ rename operation. .AP Tcl_Obj *destPathPtr in As for \fBpathPtr\fR, but used for the destination filename for a copy or rename operation. +.AP "CONST char" *encodingName in +The encoding of the data stored in the +file identified by \fBpathPtr\fR and to be evaluted. .AP "CONST char" *pattern in Only files or directories matching this pattern will be returned by \fBTcl_FSMatchInDirectory\fR. @@ -314,15 +322,23 @@ volumes' function and asks them to return their list of root volumes. It accumulates the return values in a list which is returned to the caller (with a refCount of 0). .PP -\fBTcl_FSEvalFile\fR reads the file given by \fIpathPtr\fR and evaluates +.VS 8.5 +\fBTcl_FSEvalFileEx\fR reads the file given by \fIpathPtr\fR using +the encoding identified by \fBencodingName\fR and evaluates its contents as a Tcl script. It returns the same information as \fBTcl_EvalObjEx\fR. +If \fBencodingName\fR is NULL, the system encoding is used for +reading the file contents. If the file couldn't be read then a Tcl error is returned to describe why the file couldn't be read. The eofchar for files is '\\32' (^Z) for all platforms. If you require a ``^Z'' in code for string comparison, you can use ``\\032'' or ``\\u001a'', which will be safely substituted by the Tcl interpreter into ``^Z''. +\fBTcl_FSEvalFile\fR is a simpler version of +\fBTcl_FSEvalFileEx\fR that always uses the system encoding +when reading the file. +.VE 8.5 .PP \fBTcl_FSLoadFile\fR dynamically loads a binary code file into memory and returns the addresses of two procedures within that file, if they are diff --git a/doc/source.n b/doc/source.n index 7276a9c..ffc04ab 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.5 2000/09/07 14:27:51 poenitz Exp $ +'\" RCS: @(#) $Id: source.n,v 1.6 2003/09/05 21:52:11 dgp Exp $ '\" .so man.macros .TH source n "" Tcl "Tcl Built-In Commands" @@ -17,6 +17,10 @@ source \- Evaluate a file or resource as a Tcl script .SH SYNOPSIS \fBsource \fIfileName\fR .sp +.VS 8.5 +\fBsource\fR \fB\-encoding \fIencodingName fileName\fR +.VE 8.5 +.sp \fBsource\fR \fB\-rsrc \fIresourceName \fR?\fIfileName\fR? .sp \fBsource\fR \fB\-rsrcid \fIresourceId \fR?\fIfileName\fR? @@ -33,7 +37,6 @@ If a \fBreturn\fR command is invoked from within the script then the remainder of the file will be skipped and the \fBsource\fR command will return normally with the result from the \fBreturn\fR command. .PP -.VS 8.4 The end-of-file character for files is '\\32' (^Z) for all platforms. The source command will read files up to this character. This restriction does not exist for the \fBread\fR or \fBgets\fR commands, @@ -41,7 +44,12 @@ allowing for files containing code and data segments (scripted documents). If you require a ``^Z'' in code for string comparison, you can use ``\\032'' or ``\\u001a'', which will be safely substituted by the Tcl interpreter into ``^Z''. -.VE 8.4 +.PP +.VS 8.5 +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 .PP The \fI\-rsrc\fR and \fI\-rsrcid\fR forms of this command are only available on Macintosh computers. These versions of the command @@ -52,7 +60,7 @@ application and any loaded C extensions. Alternatively, you may specify the \fIfileName\fR where the \fBTEXT\fR resource can be found. .SH "SEE ALSO" -file(n), cd(n) +file(n), cd(n), encoding(n) .SH KEYWORDS file, script diff --git a/doc/tclsh.1 b/doc/tclsh.1 index bda9e5e..ea3af4c 100644 --- a/doc/tclsh.1 +++ b/doc/tclsh.1 @@ -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: tclsh.1,v 1.8 2003/02/13 22:03:34 kennykb Exp $ +'\" RCS: @(#) $Id: tclsh.1,v 1.9 2003/09/05 21:52:11 dgp Exp $ '\" .so man.macros .TH tclsh 1 "" Tcl "Tcl Applications" @@ -14,7 +14,7 @@ .SH NAME tclsh \- Simple shell containing Tcl interpreter .SH SYNOPSIS -\fBtclsh\fR ?\fIfileName arg arg ...\fR? +\fBtclsh\fR ?-encoding \fIname\fR? ?\fIfileName arg arg ...\fR? .BE .SH DESCRIPTION @@ -28,18 +28,21 @@ It runs until the \fBexit\fR command is invoked or until it reaches end-of-file on its standard input. If there exists a file \fB.tclshrc\fR (or \fBtclshrc.tcl\fR on the Windows platforms) in the home directory of -the user, \fBtclsh\fR evaluates the file as a Tcl script +the user, interactive \fBtclsh\fR evaluates the file as a Tcl script just before reading the first command from standard input. .SH "SCRIPT FILES" .PP -If \fBtclsh\fR is invoked with arguments then the first argument -is the name of a script file and any additional arguments +.VS 8.5 +If \fBtclsh\fR is invoked with arguments then the first few arguments +specify the name of a script file, and, optionally, the encoding of +the text data stored in that script file. +.VE 8.5 +Any additional arguments are made available to the script as variables (see below). Instead of reading commands from standard input \fBtclsh\fR will read Tcl commands from the named file; \fBtclsh\fR will exit when it reaches the end of the file. -.VS 8.4 The end of the file may be marked either by the physical end of the medium, or by the character, '\\032' ('\\u001a', control-Z). If this character is present in the file, the \fBtclsh\fR application @@ -47,7 +50,6 @@ will read text up to but not including the character. An application that requires this character in the file may safely encode it as ``\\032'', ``\\x1a'', or ``\\u001a''; or may generate it by use of commands such as \fBformat\fR or \fBbinary\fR. -.VE There is no automatic evaluation of \fB.tclshrc\fR when the name of a script file is presented on the \fBtclsh\fR command line, but the script file can always \fBsource\fR it if desired. @@ -91,13 +93,11 @@ When \fBtclsh\fR starts up, it treats all three lines as comments, since the backslash at the end of the second line causes the third line to be treated as part of the comment on the second line. .PP -.VS You should note that it is also common practise to install tclsh with its version number as part of the name. This has the advantage of allowing multiple versions of Tcl to exist on the same system at once, but also the disadvantage of making it harder to write scripts that start up uniformly across different versions of Tcl. -.VE .SH "VARIABLES" .PP @@ -138,7 +138,7 @@ incomplete commands. See \fBTcl_StandardChannels\fR for more explanations. .SH "SEE ALSO" -fconfigure(n), tclvars(n) +encoding(n), fconfigure(n), tclvars(n) .SH KEYWORDS argument, interpreter, prompt, script file, shell |