allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / scripts / squashfs / lzma / C / 7zip / Compress / LZMA_C / LzmaStateDecode.h
blob4e6aad89cad7235c30ca6b2f99ef07971ad0ad8f
1 /*
2 LzmaStateDecode.h
3 LZMA Decoder interface (State version)
5 LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
6 http://www.7-zip.org/
8 LZMA SDK is licensed under two licenses:
9 1) GNU Lesser General Public License (GNU LGPL)
10 2) Common Public License (CPL)
11 It means that you can select one of these two licenses and
12 follow rules of that license.
14 SPECIAL EXCEPTION:
15 Igor Pavlov, as the author of this code, expressly permits you to
16 statically or dynamically link your code (or bind by name) to the
17 interfaces of this file without subjecting your linked code to the
18 terms of the CPL or GNU LGPL. Any modifications or additions
19 to this file, however, are subject to the LGPL or CPL terms.
22 #ifndef __LZMASTATEDECODE_H
23 #define __LZMASTATEDECODE_H
25 /* #define _LZMA_PROB32 */
26 /* It can increase speed on some 32-bit CPUs,
27 but memory usage will be doubled in that case */
29 /* #define _LZMA_SYSTEM_SIZE_T */
30 /* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
33 #ifndef UInt32
34 #ifdef _LZMA_UINT32_IS_ULONG
35 #define UInt32 unsigned long
36 #else
37 #define UInt32 unsigned int
38 #endif
39 #endif
41 #ifndef SizeT
42 #ifdef _LZMA_SYSTEM_SIZE_T
43 #include <stddef.h>
44 #define SizeT size_t
45 #else
46 #define SizeT UInt32
47 #endif
48 #endif
50 #ifdef _LZMA_PROB32
51 #define CProb UInt32
52 #else
53 #define CProb unsigned short
54 #endif
56 #define LZMA_RESULT_OK 0
57 #define LZMA_RESULT_DATA_ERROR 1
59 #define LZMA_BASE_SIZE 1846
60 #define LZMA_LIT_SIZE 768
62 #define LZMA_PROPERTIES_SIZE 5
64 typedef struct _CLzmaProperties
66 int lc;
67 int lp;
68 int pb;
69 UInt32 DictionarySize;
70 }CLzmaProperties;
72 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
74 #define LzmaGetNumProbs(lzmaProps) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((lzmaProps)->lc + (lzmaProps)->lp)))
76 #define kLzmaInBufferSize 64 /* don't change it. it must be larger than kRequiredInBufferSize */
78 #define kLzmaNeedInitId (-2)
80 typedef struct _CLzmaDecoderState
82 CLzmaProperties Properties;
83 CProb *Probs;
84 unsigned char *Dictionary;
86 unsigned char Buffer[kLzmaInBufferSize];
87 int BufferSize;
89 UInt32 Range;
90 UInt32 Code;
91 UInt32 DictionaryPos;
92 UInt32 GlobalPos;
93 UInt32 DistanceLimit;
94 UInt32 Reps[4];
95 int State;
96 int RemainLen; /* -2: decoder needs internal initialization
97 -1: stream was finished,
98 0: ok
99 > 0: need to write RemainLen bytes as match Reps[0],
101 unsigned char TempDictionary[4]; /* it's required when DictionarySize = 0 */
102 } CLzmaDecoderState;
104 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; (vs)->BufferSize = 0; }
106 /* LzmaDecode: decoding from input stream to output stream.
107 If finishDecoding != 0, then there are no more bytes in input stream
108 after inStream[inSize - 1]. */
110 int LzmaDecode(CLzmaDecoderState *vs,
111 const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
112 unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed,
113 int finishDecoding);
115 #endif