1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Common Lisp ZIP library</title>
<style type="text/css">
body {
color: #000000;
background-color: #ffffff;
margin-bottom: 10%;
padding-left: 30px;
}
h1,h2,h3 {
margin-left: -30px;
}
pre {
background-color: #eeeeee;
border: solid 1px #d0d0d0;
padding: 1em;
margin-right: 10%;
}
.def {
background-color: #ddddff;
font-weight: bold;
}
.nomargin {
margin-bottom: 0;
margin-top: 0;
}
</style>
</head>
<body>
<h1>Common Lisp ZIP library</h1>
<p>A library for .zip-file reading and writing, written in Common Lisp.</p>
<p>
Written by David Lichteblau <david@lichteblau.com>.
</p>
<p>
Send bug reports to <a
href="mailto:zip-devel@common-lisp.net"><zip-devel@common-lisp.net></a>
(<a
href="http://common-lisp.net/cgi-bin/mailman/listinfo/zip-devel">list information</a>).
</p>
<p>
Thanks to <a href="http://common-lisp.net">common-lisp.net</a> for
hosting.
</p>
<p>
Uses <a href="http://www.xach.com/lisp/salza2/">salza2</a> for
compression, <a
href="http://www.weitz.de/flexi-streams/">flexi-streams</a> for external
format support, <a
href="http://common-lisp.net/project/cl-plus-ssl/#trivial-gray-streams">trivial-gray-streams</a>
for gray streams portability, and includes <a
href="http://opensource.franz.com/deflate/">inflate.cl</a>
for decompression.
</p>
<h2>Recent changes</h2>
<p>
2006-xx-yy: Fixed the gray stream port, including a data
corruption bug that was in CVS for some time. (Thanks to Kevin
Reid and others.) Switched to flexi-stream external-format
functions for portability. Uses trivial-gray-streams now.
Allegro 8.0 fix (thanks to Edi Weitz). Comment support (thanks
to Surendra Singhi). Incompatible change: Don't bind
<tt>*locale*</tt> on Allegro anymore.
<p>
</p>
2005-04-05: ACL fixes (thank to Edi Weitz). Lispworks port
(thanks to Sean Ross). Store <tt>file-write-date</tt> (also fixes
FilZip compatibility).
</p>
<h2>Download</h2>
<ul>
<li>asdf-install: <pre>(asdf-install:install :zip)</pre></li>
<li>Anoncvs (<a href="http://common-lisp.net/cgi-bin/viewcvs.cgi/zip/?cvsroot=zip">browse</a>):
<pre>$ export CVSROOT=:pserver:anonymous@common-lisp.net:/project/zip/cvsroot
$ cvs login
Logging in to :pserver:anonymous@common-lisp.net:2401/project/zip/cvsroot
CVS password: anonymous
$ cvs co zip</pre>
</li>
<li><a href="http://common-lisp.net/project/zip/zip.tgz">Tarball</a></li>
</ul>
<p>Installation (without asdf-install):</p>
<pre>$ ln -s `pwd`/zip.asd /your/system/directory
* (asdf:operate 'asdf:load-op :zip)</pre>
<h2>Portability</h2>
<p>
Needs gray streams. Currently works out-of-the-box on SBCL,
Lispworks, and ACL. Should be trivial to port to other Lisps.
</p>
<p>
Handles Unicode characters in filenames on ACL and Lispworks
(within the zip-file), is waiting for someone to fix Unicode
handling on SBCL.
</p>
<h2>ZIP-file reading</h2>
<p>
Zip archives are represented as opaque handles. Entries of the
zip-file are named by strings and represented as objects, too.
</p>
<div class="def">Function OPEN-ZIPFILE (pathname) => zipfile</div>
<p>
Open .zip-file <tt>pathname</tt> for reading and return a handle for it.
</p>
<div class="def">Function CLOSE-ZIPFILE (zipfile)</div>
<p>
Close the file handle.
</p>
<div class="def">Macro WITH-ZIPFILE ((var pathname) &body body) => result of body</div>
<p>
Bind <tt>var</tt> to the result of <tt>open-zipfile</tt>, evaluate
body as an implicit progn and call <tt>close-zipfile</tt> before
exiting.
</p>
<div class="def">Function GET-ZIPFILE-ENTRY (name zipfile) => zipfile-entry</div>
<p>Return an entry handle for the file called <tt>name</tt>.</p>
<div class="def">Function ZIPFILE-ENTRIES (zipfile) => hash-table</div>
<p>
Return a hash-table mapping filenames to entry handles for all
files contained in the zip archive.
</p>
<div class="def">Macro DO-ZIPFILE-ENTRIES ((name-var entry-var zipfile) &body body) => nil</div>
<p>
Map over all entries in <tt>zipfile</tt> binding <tt>name-var</tt>
and <tt>entry-var</tt> to each file name and entry handle in
turn. Establish implicit block named <tt>nil</tt> around the
loop.
</p>
<div class="def">Function ZIPFILE-ENTRY-NAME (zipfile-entry) => string</div>
<p>Return an entry's file name as a string.</p>
<div class="def">Function ZIPFILE-ENTRY-CONTENTS (entry &optional
stream) => see below</div>
<p>
If <tt>stream</tt> is given, extract <tt>entry</tt> to the
<tt>(unsigned-byte 8)</tt> stream given as the argument.
Otherwise, return the entry contents as an <tt>(unsigned-byte
8)</tt> vector.
</p>
<div class="def">Function UNZIP (pathname target-directory &key if-exists verbose) => nil</div>
<p>
Extract all entries from the zip archive at <tt>pathname</tt> into
<tt>target-directory</tt>. <tt>if-exists</tt> as for <a
href="http://www.xach.com/clhs.php?open">cl:open</a>.
</p>
<h2>ZIP-file writing</h2>
<p>
<tt>zipwriter</tt>s are handles used to create zip archives. They
are distinct from the zip handles used for reading.
</p>
<div class="def">Macro WITH-OUTPUT-TO-ZIPFILE ((var pathname &key if-exists) &body body)</div>
<p>
</p>
<div class="def">Function WRITE-ZIPENTRY (zipwriter name data &key file-write-date)</div>
<p>
Append a new entry called <tt>name</tt> to <tt>zipwriter</tt>.
Read data from <tt>(unsigned-byte 8)</tt> stream <tt>data</tt>
until EOF and compress it into "deflate"-format.
Use <tt>file-write-date</tt> as the entry's date and time.
Default to <tt>(file-write-date data)</tt>, use 1980-01-01T00:00
if <tt>nil</tt>.
</p>
<div class="def">Function ZIP (pathname source-directory &key if-exists)</div>
<p>
Compress all files in <tt>source-directory</tt> recursively into a
new zip archive at <tt>pathname</tt>. Note that entry file names
will not contain the name <tt>source-directory</tt>.
</p>
<h2>Bookmark</h2>
<p>
<a href="http://www.pkware.com/company/standards/appnote/appnote.txt">spec</a>
</p>
</body>
</html>
|