allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / scripts / squashfs / lzma / 7zC.txt
blob1c81eacf7c8905b30207e1f31c37b892577047c0
1 7z ANSI-C Decoder 4.23\r
2 ----------------------\r
3 \r
4 7z ANSI-C Decoder 4.23 Copyright (C) 1999-2005 Igor Pavlov\r
5 \r
6 7z ANSI-C provides 7z/LZMA decoding.\r
7 7z ANSI-C version is simplified version ported from C++ code.\r
8 \r
9 LZMA is default and general compression method of 7z format\r
10 in 7-Zip compression program (www.7-zip.org). LZMA provides high \r
11 compression ratio and very fast decompression.\r
14 LICENSE\r
15 -------\r
17 Read lzma.txt for information about license.\r
20 Files\r
21 ---------------------\r
23 7zAlloc.*    - Allocate and Free\r
24 7zBuffer.*   - Buffer structure\r
25 7zCrc.*      - CRC32 code\r
26 7zDecode.*   - Low level memory->memory decoding\r
27 7zExtract.*  - High level stream->memory decoding\r
28 7zHeader.*   - .7z format constants\r
29 7zIn.*       - .7z archive opening\r
30 7zItem.*     - .7z structures\r
31 7zMain.c     - Test application\r
32 7zMethodID.* - MethodID structure\r
33 7zTypes.h    - Base types and constants\r
36 How To Use\r
37 ----------\r
39 You must download 7-Zip program from www.7-zip.org.\r
41 You can create .7z archive with 7z.exe or 7za.exe:\r
43   7za.exe a archive.7z *.htm -r -mx -m0fb=255\r
45 If you have big number of files in archive, and you need fast extracting, \r
46 you can use partly-solid archives:\r
47   \r
48   7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K\r
50 In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only \r
51 512KB for extracting one file from such archive.\r
54 Limitations of current version of 7z ANSI-C Decoder\r
55 ---------------------------------------------------\r
57  - It reads only "FileName", "Size", and "CRC" information for each file in archive.\r
58  - It supports only LZMA and Copy (no compression) methods.\r
59  - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.\r
60  \r
61 These limitations will be fixed in future versions.\r
64 Using 7z ANSI-C Decoder Test application:\r
65 -----------------------------------------\r
67 Usage: 7zDec <command> <archive_name>\r
69 <Command>:\r
70   e: Extract files from archive\r
71   l: List contents of archive\r
72   t: Test integrity of archive\r
74 Example: \r
76   7zDec l archive.7z\r
78 lists contents of archive.7z\r
80   7zDec e archive.7z\r
82 extracts files from archive.7z to current folder.\r
85 How to use .7z Decoder\r
86 ----------------------\r
88 .7z Decoder can be compiled in one of two modes:\r
90 1) Default mode. In that mode 7z Decoder will read full compressed \r
91    block to RAM before decompressing.\r
92   \r
93 2) Mode with defined _LZMA_IN_CB. In that mode 7z Decoder can read\r
94    compressed block by parts. And you can specify desired buffer size. \r
95    So memory requirements can be reduced. But decompressing speed will \r
96    be 5-10% lower and code size is slightly larger.\r
98    \r
99 Memory allocation\r
100 ~~~~~~~~~~~~~~~~~\r
102 7z Decoder uses two memory pools:\r
103 1) Temporary pool\r
104 2) Main pool\r
105 Such scheme can allow you to avoid fragmentation of allocated blocks.\r
107 Steps for using 7z decoder\r
108 --------------------------\r
110 Use code at 7zMain.c as example.\r
112 1) Declare variables:\r
113   inStream                     /* implements ISzInStream interface */\r
114   CArchiveDatabaseEx db;       /* 7z archive database structure */\r
115   ISzAlloc allocImp;           /* memory functions for main pool */\r
116   ISzAlloc allocTempImp;       /* memory functions for temporary pool */\r
118 2) call InitCrcTable(); function to initialize CRC structures.\r
120 3) call SzArDbExInit(&db); function to initialize db structures.\r
122 4) call SzArchiveOpen(inStream, &db, &allocMain, &allocTemp) to open archive\r
124 This function opens archive "inStream" and reads headers to "db".\r
125 All items in "db" will be allocated with "allocMain" functions.\r
126 SzArchiveOpen function allocates and frees temporary structures by "allocTemp" functions.\r
128 5) List items or Extract items\r
130   Listing code:\r
131   ~~~~~~~~~~~~~\r
132     {\r
133       UInt32 i;\r
134       for (i = 0; i < db.Database.NumFiles; i++)\r
135       {\r
136         CFileItem *f = db.Database.Files + i;\r
137         printf("%10d  %s\n", (int)f->Size, f->Name);\r
138       }\r
139     }\r
141   Extracting code:\r
142   ~~~~~~~~~~~~~~~~\r
144   SZ_RESULT SzExtract(\r
145     ISzInStream *inStream, \r
146     CArchiveDatabaseEx *db,\r
147     UInt32 fileIndex,         /* index of file */\r
148     UInt32 *blockIndex,       /* index of solid block */\r
149     Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */\r
150     size_t *outBufferSize,    /* buffer size for output buffer */\r
151     size_t *offset,           /* offset of stream for required file in *outBuffer */\r
152     size_t *outSizeProcessed, /* size of file in *outBuffer */\r
153     ISzAlloc *allocMain,\r
154     ISzAlloc *allocTemp);\r
156   If you need to decompress more than one file, you can send these values from previous call:\r
157     blockIndex, \r
158     outBuffer, \r
159     outBufferSize,\r
160   You can consider "outBuffer" as cache of solid block. If your archive is solid, \r
161   it will increase decompression speed.\r
163   After decompressing you must free "outBuffer":\r
164   allocImp.Free(outBuffer);\r
166 6) call SzArDbExFree(&db, allocImp.Free) to free allocated items in "db".\r
171 Memory requirements for .7z decoding \r
172 ------------------------------------\r
174 Memory usage for Archive opening:\r
175   - Temporary pool:\r
176      - Memory for compressed .7z headers (if _LZMA_IN_CB is not defined)\r
177      - Memory for uncompressed .7z headers\r
178      - some other temporary blocks\r
179   - Main pool:\r
180      - Memory for database: \r
181        Estimated size of one file structures in solid archive:\r
182          - Size (4 or 8 Bytes)\r
183          - CRC32 (4 bytes)\r
184          - Some file information (4 bytes)\r
185          - File Name (variable length) + pointer + allocation structures\r
187 Memory usage for archive Decompressing:\r
188   - Temporary pool:\r
189      - Memory for compressed solid block (if _LZMA_IN_CB is not defined)\r
190      - Memory for LZMA decompressing structures\r
191   - Main pool:\r
192      - Memory for decompressed solid block\r
193   \r
195 If _LZMA_IN_CB is defined, 7z Decoder will not allocate memory for \r
196 compressed blocks. Instead of this, you must allocate buffer with desired \r
197 size before calling 7z Decoder. Use 7zMain.c as example.\r
201 EXIT codes\r
202 -----------\r
204 7z Decoder functions can return one of the following codes:\r
206 #define SZ_OK (0)\r
207 #define SZE_DATA_ERROR (1)\r
208 #define SZE_OUTOFMEMORY (2)\r
209 #define SZE_CRC_ERROR (3)\r
211 #define SZE_NOTIMPL (4)\r
212 #define SZE_FAIL (5)\r
214 #define SZE_ARCHIVE_ERROR (6)\r
218 LZMA Defines\r
219 ------------\r
221 _LZMA_IN_CB       - Use special callback mode for input stream to reduce memory requirements\r
223 _SZ_FILE_SIZE_64  - define it if you need support for files larger than 4 GB\r
224 _SZ_NO_INT_64     - define it if your compiler doesn't support long long int\r
226 _LZMA_PROB32      - it can increase LZMA decompressing speed on some 32-bit CPUs.\r
228 _SZ_ONE_DIRECTORY - define it if you want to locate all source files to one directory\r
229 _SZ_ALLOC_DEBUG   - define it if you want to debug alloc/free operations to stderr.\r
232 ---\r
234 http://www.7-zip.org\r
235 http://www.7-zip.org/support.html\r