summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/mspack/lzss.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/mspack/lzss.h')
-rw-r--r--utils/rbutilqt/mspack/lzss.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/utils/rbutilqt/mspack/lzss.h b/utils/rbutilqt/mspack/lzss.h
new file mode 100644
index 0000000000..aa946e52ae
--- /dev/null
+++ b/utils/rbutilqt/mspack/lzss.h
@@ -0,0 +1,66 @@
1/* This file is part of libmspack.
2 * (C) 2003-2004 Stuart Caie.
3 *
4 * libmspack is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License (LGPL) version 2.1
6 *
7 * For further details, see the file COPYING.LIB distributed with libmspack
8 */
9
10#ifndef MSPACK_LZSS_H
11#define MSPACK_LZSS_H 1
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/* LZSS compression / decompression definitions */
18
19#define LZSS_WINDOW_SIZE (4096)
20#define LZSS_WINDOW_FILL (0x20)
21
22#define LZSS_MODE_EXPAND (0)
23#define LZSS_MODE_MSHELP (1)
24#define LZSS_MODE_QBASIC (2)
25
26/**
27 * Decompresses an LZSS stream.
28 *
29 * Input bytes will be read in as necessary using the system->read()
30 * function with the input file handle given. This will continue until
31 * system->read() returns 0 bytes, or an error. Errors will be passed
32 * out of the function as MSPACK_ERR_READ errors. Input streams should
33 * convey an "end of input stream" by refusing to supply all the bytes
34 * that LZSS asks for when they reach the end of the stream, rather
35 * than return an error code.
36 *
37 * Output bytes will be passed to the system->write() function, using
38 * the output file handle given. More than one call may be made to
39 * system->write().
40 *
41 * As EXPAND.EXE (SZDD/KWAJ), Microsoft Help and QBasic have slightly
42 * different encodings for the control byte and matches, a "mode"
43 * parameter is allowed, to choose the encoding.
44 *
45 * @param system an mspack_system structure used to read from
46 * the input stream and write to the output
47 * stream, also to allocate and free memory.
48 * @param input an input stream with the LZSS data.
49 * @param output an output stream to write the decoded data to.
50 * @param input_buffer_size the number of bytes to use as an input
51 * bitstream buffer.
52 * @param mode one of #LZSS_MODE_EXPAND, #LZSS_MODE_MSHELP or
53 * #LZSS_MODE_QBASIC
54 * @return an error code, or MSPACK_ERR_OK if successful
55 */
56extern int lzss_decompress(struct mspack_system *system,
57 struct mspack_file *input,
58 struct mspack_file *output,
59 int input_buffer_size,
60 int mode);
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif