• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmake/H07-Apr-2015-735675

rockspec/H07-Apr-2015-6153

.travis.ymlH A D07-Apr-20151.1 KiB5242

CHANGESH A D07-Apr-20151 KiB4328

MakefileH A D07-Apr-20151.3 KiB6342

READMEH A D07-Apr-20154 KiB11386

README.lgzipH A D07-Apr-20154.5 KiB10979

dist.infoH A D07-Apr-2015302 1612

gzip.luaH A D07-Apr-20151.8 KiB8362

lakefileH A D07-Apr-20151.4 KiB5947

lzlib.cH A D07-Apr-201527.4 KiB987661

test_gzip.luaH A D07-Apr-20151.5 KiB10268

test_prologue.luaH A D07-Apr-201590 32

test_zlib2.luaH A D07-Apr-20151.7 KiB9378

test_zlib3.luaH A D07-Apr-2015770 3020

test_zlib_dict.luaH A D07-Apr-20152.2 KiB3523

zlib.defH A D07-Apr-201523 32

README

1*************************************************************************
2* Author    : Tiago Dionizio <tiago.dionizio@gmail.com>                 *
3* Library   : lzlib - Lua 5.1 interface to access zlib library functions*
4*                                                                       *
5* Permission is hereby granted, free of charge, to any person obtaining *
6* a copy of this software and associated documentation files (the       *
7* "Software"), to deal in the Software without restriction, including   *
8* without limitation the rights to use, copy, modify, merge, publish,   *
9* distribute, sublicense, and/or sell copies of the Software, and to    *
10* permit persons to whom the Software is furnished to do so, subject to *
11* the following conditions:                                             *
12*                                                                       *
13* The above copyright notice and this permission notice shall be        *
14* included in all copies or substantial portions of the Software.       *
15*                                                                       *
16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
17* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
18* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
19* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  *
20* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  *
21* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     *
22* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                *
23*************************************************************************
24
25To use this library you need zlib library.
26You can get it from http://www.gzip.org/zlib/
27
28
29Loading the library:
30
31    If you built the library as a loadable package
32        [local] zlib = require 'zlib'
33
34    If you compiled the package statically into your application, call
35    the function "luaopen_zlib(L)". It will create a table with the zlib
36    functions and leave it on the stack.
37
38-- zlib functions --
39
40zlib.version()
41	returns zlib version
42
43zlib.adler32([int adler32, string buffer])
44	Without any parameters, returns the inicial adler32 value.
45
46	Call to update the adler32 value, adler is the current value, buffer is passed
47	to adler32 zlib function and the updated value is returned.
48
49zlib.crc32([int crc32, string buffer])
50	Same as zlib.adler32.
51
52zlib.compress(string buffer [, int level] [, int method] [, int windowBits] [, int memLevel] [, int strategy])
53	Return a string containing the compressed buffer according to the given parameters.
54
55zlib.decompress(string buffer [, int windowBits])
56	Return the decompressed stream after processing the given buffer.
57
58
59zlib.deflate(
60	sink: function | { write: function [, close: function, flush: function ] },
61	compression level, [Z_DEFAILT_COMPRESSION]
62	method, [Z_DEFLATED]
63	windowBits, [15]
64	memLevel, [8]
65	strategy, [Z_DEFAULT_STRATEGY]
66	dictionary, [""]
67)
68	Return a deflate stream.
69
70	stream:read((number | '*l' | '*a')*)
71		Return a value for each given parameter. Returns a line when
72		no format is specified.
73
74	stream:lines()
75		Return iterator that returns a line each time it is called, or nil
76		on end of file.
77
78	stream:close()
79		Close the stream.
80
81zlib.inflate(
82	source: string | function | { read: function, close: function },
83	windowBits: number, [15]
84	dictionary, [""]
85)
86	Return an inflate stream.
87
88
89deflate and inflate streams can be used almost like a normal file:
90
91	stream:write(...)
92		Write each parameter into the sream.
93
94	stream:read([option [, ...]])
95		Read from the stream, each parameter corresponds to
96			a return value.
97
98		With no arguments, it reads a line.
99		Parameters are interpreted as follows:
100		  number - reads the specified number of bytes
101		  'a' - reads the remaining bytes
102		  'l' - reads a line
103
104	stream:lines(...)
105		Returns an iterator that returns a new line each time
106			it is called.
107
108	stream:flush(['sync' | 'full' | 'finish'])
109		Flush output for deflate streams.
110
111	stream:close()
112		Close the stream.
113

README.lgzip

1*************************************************************************
2* Author    : Tiago Dionizio <tiago.dionizio@gmail.com>                 *
3* Library   : lgzip - a gzip file access binding for Lua 5              *
4*             based on liolib.c from Lua 5.0 library                    *
5*                                                                       *
6* Permission is hereby granted, free of charge, to any person obtaining *
7* a copy of this software and associated documentation files (the       *
8* "Software"), to deal in the Software without restriction, including   *
9* without limitation the rights to use, copy, modify, merge, publish,   *
10* distribute, sublicense, and/or sell copies of the Software, and to    *
11* permit persons to whom the Software is furnished to do so, subject to *
12* the following conditions:                                             *
13*                                                                       *
14* The above copyright notice and this permission notice shall be        *
15* included in all copies or substantial portions of the Software.       *
16*                                                                       *
17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
18* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
20* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  *
21* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  *
22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     *
23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                *
24*************************************************************************
25
26To use this library you need zlib library.
27You can get it from http://www.gzip.org/zlib/
28
29
30GZIP file handling on top of the zlib interface.
31
32TODO:
33	- detect plain text files
34	- proper testing
35	- improve implementation?
36	- check gzopen flags for consistency (ex: strategy flag)
37
38Loading the library:
39
40    [local] gzip = require 'gzip'
41
42gzip.open(filename [, mode])
43
44    Opens a file name using "gzopen". Behaviour is identical to the description
45    given in the zlib library. If mode is not given a default mode "r" will be
46    used. Mode is the same as interpreted by gzopen function, ie, it can
47    include special modes such as characters 1 to 9 that will be treated as the
48    compression level when opening a file for writing.
49
50    It returns a new file handle, or, in case of errors, nil plus an error
51    message
52
53gzip.lines(filename)
54
55    Same behaviour as io.lines in the io standard library provided by lua
56    with the aditional feature of working with gzip files. If a normal text
57    file is read it will read it normaly.
58
59gzip.close(file)
60
61    Same as file:close, use file:close instead.
62
63file:flush()
64
65    This function takes no parameters and flushes all output to working file.
66    The same as calling 'gzflush(file, Z_FINISH)' so writing to the file will
67    most likely not work as expected. This is subject to change in the future
68    if there is a strong reason for it to happen.
69
70file:read(format1, ...)
71    Reads the file file, according to the given formats, which specify what
72    to read. For each format, the function returns a string with the characters
73    read, or nil if it cannot read data with the specified format. When called
74    without formats, it uses a default format that reads the entire next line
75    (see below).
76
77    The available formats are
78
79        "*a"   reads the whole file, starting at the current position. On end of
80               file, it returns the empty string.
81        "*l"   reads the next line (skipping the end of line), returning nil on
82               end of file. This is the default format.
83        number reads a string with up to that number of characters, returning
84               nil on end of file. If number is zero, it reads nothing and
85               returns an empty string, or nil on end of file.
86
87    Unlike io.read, the "*n" format will not be available.
88
89
90file:lines()
91
92    Returns an iterator function that, each time it is called, returns a new
93    line from the file. Therefore, the construction
94
95       for line in file:lines() do ... end
96
97    will iterate over all lines of the file.
98
99file:write(value1, ...)
100
101    Writes the value of each of its arguments to the filehandle file. The
102    arguments must be strings or numbers. To write other values, use tostring
103    or string.format before write
104
105file:close()
106
107    Closes the file.
108
109