From: Vince Darley Date: Wed, 31 Oct 2001 12:05:43 +0000 (+0000) Subject: more docs, examples X-Git-Tag: vfs-1-2~99 X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=75ddf91cfcf3d2040b3a232c806d8d22e8137589;p=tclvfs more docs, examples --- diff --git a/doc/vfs.n b/doc/vfs.n index a8a0eec..7774c53 100644 --- a/doc/vfs.n +++ b/doc/vfs.n @@ -21,8 +21,14 @@ .sp \fBvfs::filesystem\fR \fIunmount\fR .sp +\fBvfs::accessMode\fR \fImode\fR +.sp +\fBvfs::matchDirectories\fR \fItypes\fR +.sp +\fBvfs::matchFiles\fR \fItypes\fR +.sp +\fBvfs::matchCorrectTypes\fR \fItypes\fR \fIfilelist\fR \fI?inDir?\fR .sp -\fBvfs::foo \fIa b c\fR .BE .SH DESCRIPTION .PP @@ -216,7 +222,8 @@ extension. .PP The Tcl 'Tcl_FSMatchInDirectory' function takes a variety of type information in a Tcl_GlobTypeData structure. We currently only expose -the 'type' field from that structure. +the 'type' field from that structure (so the 'permissions' and MacOS +type/creator fields are ignored). .SH KEYWORDS vfs, filesystem, file diff --git a/doc/vfslib.n b/doc/vfslib.n new file mode 100644 index 0000000..44ea347 --- /dev/null +++ b/doc/vfslib.n @@ -0,0 +1,56 @@ +'\" +'\" Copyright (c) 2001, Vince Darley +'\" +'\" +.so man.macros +.TH vfslib n 1.0 Vfslib "Tcl-only Virtual File Systems" +.BS +'\" Note: do not modify the .sh NAME line immediately below! +.SH NAME +::vfslib \- Procedures to interact with virtual filesystems +.SH SYNOPSIS +.BS +.sp +\fBpackage require Tcl 8.4\fR +.sp +\fBpackage require vfs ?1.0?\fR +.sp +\fBvfs::zip::Mount\fR \fIpath\fR \fIto\fR +.sp +\fBvfs::ftp::Mount\fR \fIpath\fR \fIto\fR +.sp +\fBvfs::http::Mount\fR \fIpath\fR \fIto\fR +.sp +\fBvfs::mk4::Mount\fR \fIpath\fR \fIto\fR +.sp +\fBvfs::ns::Mount\fR \fIpath\fR \fIto\fR +.sp +\fBvfs::urltype::Mount\fR \fItype\fR +.sp +.BE +.SH DESCRIPTION +.PP +The \fB::vfs\fR package includes a library of Tcl code, informally +known as 'vfslib' which can be accessed through \fBpackage require +vfs\fP. +.PP +.SH SUPPORTED VFS TYPES +.PP +The current supported types are ftp, http, zip, mk4, ns. In addition +there is the ability to mount any 'urltype' as a new volume, provided +an appropriate vfs is supported. This means that you can treat +'ftp://', 'http://' and 'file://' urls as files. To do this, simply +evaluate the command +.PP +\fIvfs::urltype::Mount ftp\fR +.PP +for instance. +.PP +.SH LIMITATIONS +.PP +Most of the vfs types listed above have not been very well debugged +as yet. Please test them! +.SH KEYWORDS +vfs, vfslib, filesystem, zip, ftp, http, file + + diff --git a/examples/simpleExamples.tcl b/examples/simpleExamples.tcl new file mode 100644 index 0000000..abcc4df --- /dev/null +++ b/examples/simpleExamples.tcl @@ -0,0 +1,32 @@ +catch {console show} + +puts "(pwd is '[pwd]', file volumes is '[file volumes]')" + +package require vfs + +puts "Adding ftp:// volume..." +vfs::urltype::Mount ftp +set listing [glob -dir ftp://ftp.scriptics.com/pub *] +puts "ftp.scriptics.com/pub listing" +puts "$listing" +puts "----" +puts "(file volumes is '[file volumes]')" + +puts "Adding http:// volume..." +vfs::urltype::Mount http +set fd [open http://sourceforge.net/projects/tcl] +set contents [read $fd] ; close $fd +puts "Contents of web page" +puts [string range $contents 0 100] +puts "(first 100 out of [string length $contents] characters)" +puts "----" +puts "(file volumes is '[file volumes]')" + +puts "Mounting ftp://ftp.ucsd.edu/pub/alpha/ ..." +vfs::ftp::Mount ftp://ftp.ucsd.edu/pub/alpha/ localmount +cd localmount ; cd tcl +puts "(pwd is now '[pwd]')" +puts "sourcing remote file 'vfsTest.tcl', using 'source vfsTest.tcl'" +source vfsTest.tcl + +puts "Done"