source: project/wiki/eggref/4/lzma @ 15019

Last change on this file since 15019 was 15019, checked in by svnwiki, 11 years ago

Changes applied for C-Keen (153.96.215.151) through svnwiki:

removed lzma: prefix as it is not exported as such anymore

  • Property svnwiki:title set to lzma
File size: 3.1 KB
Line 
1[[tags:egg]]
2
3== Introduction
4
5The lzma egg provides a simple wrapper around the C library lzmalib,
6which in turn provides access to the excellent
7[[http://en.wikipedia.org/wiki/LZMA|Lempel-Ziv-Markov chain
8algorithm]].
9
10Two functions are provided, which simply compress or decompress a
11buffer represented as a Chicken blob object.
12
13== Examples
14
15<examples>
16<example>
17<init>(use lzma)</init>
18<expr>(blob->string (decompress (compress (string->blob "Hello, World!"))))</expr>
19<result>"Hello, World!"</result>
20</example>
21<example>
22<init>(use lzma)</init>
23<expr>(blob-size (compress (string->blob "Hello, World!")))</expr>
24<result>32</result>
25</example>
26<example>
27<init>(use lzma)</init>
28<expr>(blob-size (compress (string->blob "Hello, World! Hello, World! Hello, World!")))</expr>
29<result>36</result>
30</example>
31</examples>
32
33== Library functions
34
35<procedure>(compress BLOB) => BLOB</procedure>
36
37Given a blob, returns a blob that's hopefully smaller, and contains
38all the entropy of the original blob. Returns #f in the event of
39failure (typically, an out-of-memory condition).
40
41<procedure>(decompress BLOB) => BLOB</procedure>
42
43Given a blob returned by {{compress}}, returns the original
44blob. Returns #f in the event of failure (typically, an out-of-memory
45condition or an invalid input).
46
47== Authors
48
49[[alaric-blagrave-snellpym|Alaric B. Snell-Pym]]
50
51== License
52
53  Copyright (c) 2003-2009, Warhead.org.uk Ltd
54  All rights reserved.
55
56  Redistribution and use in source and binary forms, with or without
57  modification, are permitted provided that the following conditions
58  are met:
59
60  Redistributions of source code must retain the above copyright
61  notice, this list of conditions and the following disclaimer.
62
63  Redistributions in binary form must reproduce the above copyright
64  notice, this list of conditions and the following disclaimer in the
65  documentation and/or other materials provided with the distribution.
66
67  Neither the names of Warhead.org.uk Ltd, Snell Systems, nor Kitten
68  Technologies, nor the names of their contributors may be used to
69  endorse or promote products derived from this software without
70  specific prior written permission.
71
72  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
73  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
74  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
75  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
76  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
77  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
78  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
80  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
81  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
82  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
83  POSSIBILITY OF SUCH DAMAGE.
84
85== Requirements
86
87You'll need lzmalib installed. Source of this can be had from
88[[http://tokyocabinet.sourceforge.net/misc/lzmalib-0.0.1.tar.gz]].
89
90== Version History
91
92* 1.1: Schoolboy errors fixed
93* 1.0: Initial release
Note: See TracBrowser for help on using the repository browser.