diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-11 07:24:40 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-11 07:24:40 (GMT) |
commit | 5719d6ca309368052fc677e594c4c480e15ae526 (patch) | |
tree | 00a1f772153b09acbbcd0f54be1d32f33d04eb76 /generic/tclZipfs.c | |
parent | 58d332cff948e96f4a0f554ebe7ab3b43724669b (diff) | |
download | tcl-5719d6ca309368052fc677e594c4c480e15ae526.zip tcl-5719d6ca309368052fc677e594c4c480e15ae526.tar.gz tcl-5719d6ca309368052fc677e594c4c480e15ae526.tar.bz2 |
Put documented [zipfs find] in ensemble. Add examples to docs.
Diffstat (limited to 'generic/tclZipfs.c')
-rw-r--r-- | generic/tclZipfs.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e60d94d..c9b1a63 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4737,8 +4737,8 @@ TclZipfs_Init( " }\n" " return $result\n" "}\n" - "proc ::tcl::zipfs::find dir {\n" - " return [lsort [Find $dir]]\n" + "proc ::tcl::zipfs::find {directoryName} {\n" + " return [lsort [Find $directoryName]]\n" "}\n"; /* @@ -4753,11 +4753,22 @@ TclZipfs_Init( Unlock(); if (interp) { + Tcl_Command ensemble; + Tcl_Obj *mapObj; + Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); Tcl_LinkVar(interp, "::tcl::zipfs::wrmax", (char *) &ZipFS.wrmax, TCL_LINK_INT); - TclMakeEnsemble(interp, "zipfs", + ensemble = TclMakeEnsemble(interp, "zipfs", Tcl_IsSafe(interp) ? (initMap + 4) : initMap); + + /* + * Add the [zipfs find] subcommand. + */ + + Tcl_GetEnsembleMappingDict(NULL, ensemble, &mapObj); + Tcl_DictObjPut(NULL, mapObj, Tcl_NewStringObj("find", -1), + Tcl_NewStringObj("::tcl::zipfs::find", -1)); Tcl_PkgProvide(interp, "zipfs", "2.0"); } return TCL_OK; |