diff options
author | dkf <dkf@noemail.net> | 2010-12-09 15:09:07 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2010-12-09 15:09:07 (GMT) |
commit | 45a8fcb6e17795fa642ab5cf0d4176590f785048 (patch) | |
tree | ce38d69f9ab51ef0a83d6e83b49177e042a74a31 /generic/tclIOCmd.c | |
parent | ccd7caf20a876bcc0bca8620282cb00353dca1b9 (diff) | |
download | tcl-45a8fcb6e17795fa642ab5cf0d4176590f785048.zip tcl-45a8fcb6e17795fa642ab5cf0d4176590f785048.tar.gz tcl-45a8fcb6e17795fa642ab5cf0d4176590f785048.tar.bz2 |
* generic/tclCmdAH.c (TclInitFileCmd, TclMakeFileCommandSafe, ...):
Break up [file] into an ensemble. Note that the ensemble is safe in
itself, but the majority of its subcommands are not.
* generic/tclFCmd.c (FileCopyRename,TclFileDeleteCmd,TclFileAttrsCmd)
(TclFileMakeDirsCmd): Adjust these subcommand implementations to work
inside an ensemble.
(TclFileLinkCmd, TclFileReadLinkCmd, TclFileTemporaryCmd): Move these
subcommand implementations from tclCmdAH.c, where they didn't really
belong.
* generic/tclIOCmd.c (TclChannelNamesCmd): Move to more appropriate
source file.
* generic/tclEnsemble.c (TclMakeEnsemble): Start of code to make
partially-safe ensembles. Currently does not function as expected due
to various shortcomings in how safe interpreters are constructed.
* tests/cmdAH.test, tests/fCmd.test, tests/interp.test: Test updates
to take into account systematization of error messages.
FossilOrigin-Name: 264ccb78f6fab91cf8c37d3c2f2126be9f368fe3
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 696b3ac..59d7b3b 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.69 2010/08/22 18:53:26 nijtmans Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.70 2010/12/09 15:09:07 dkf Exp $ */ #include "tclInt.h" @@ -1898,6 +1898,39 @@ ChanPipeObjCmd( /* *---------------------------------------------------------------------- * + * TclChannelNamesCmd -- + * + * This function is invoked to process the "chan names" and "file + * channels" Tcl commands. See the user documentation for details on + * what they do. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclChannelNamesCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + if (objc < 1 || objc > 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?pattern?"); + return TCL_ERROR; + } + return Tcl_GetChannelNamesEx(interp, + ((objc == 1) ? NULL : TclGetString(objv[1]))); +} + +/* + *---------------------------------------------------------------------- + * * TclInitChanCmd -- * * This function is invoked to create the "chan" Tcl command. See the @@ -1932,6 +1965,7 @@ TclInitChanCmd( {"event", Tcl_FileEventObjCmd, NULL, NULL, NULL}, {"flush", Tcl_FlushObjCmd, NULL, NULL, NULL}, {"gets", Tcl_GetsObjCmd, NULL, NULL, NULL}, + {"names", TclChannelNamesCmd}, {"pending", ChanPendingObjCmd, NULL, NULL, NULL}, /* TIP #287 */ {"pop", TclChanPopObjCmd, NULL, NULL, NULL}, /* TIP #230 */ {"postevent", TclChanPostEventObjCmd, NULL, NULL, NULL}, /* TIP #219 */ @@ -1946,7 +1980,6 @@ TclInitChanCmd( }; static const char *const extras[] = { "configure", "::fconfigure", - "names", "::file channels", NULL }; Tcl_Command ensemble; |