cs sdk v 1.14 released

Home  |  Product  |  Documents  |  Tutorials  |  FAQ |   Download  |   Forum |   Contacts  |   Link  


  Cross Suit

 Cross Suit SDK

 Documents
      classes
 Starting...
           Tutorials

 LUA tutorials

   Support

  Forum
  q&a

 Product parts

 Virtual File system

 Virtual Render
 Virtual Machine
   

  Demo Games

   

 3D Engine

  gvSystem(dx9)

 Link

 

 

unzip.h

Go to the documentation of this file.
00001 
00002 // Unzip.h: Declaraciones para la descompresi? de un paquete
00003 //                      de un fichero .ZIP
00004 //
00005 //              Code extremely based on PCDEZIP.
00007 //
00008 //  PCDEZIP.CPP þþ Copyright 1994, Bob Flanders and Michael Holmes      
00009 //  First Published in PC Magazine January 11, 1994                     
00010 //                                                                      
00011 //  PCDEZIP decompresses .ZIP files created with PKZIP through
00012 //  version 2.04g.  PCDEZIP provides syntax and switch compatibilty
00013 //  with both Michael Mefford's PCUNZP and Phil Katz's PKUNZIP.         
00014 //
00016 #if !defined (__UNZIP_HH__)
00017 #define __UNZIP_HH__
00018 
00019         #define COUNT(x) (sizeof(x) / sizeof(x[0])) // item count
00020         #define NOT         !                       // shorthand logical
00021         #define UINT        unsigned int            // unsigned integer 
00022         #define BYTE        unsigned char           // ..and unsigned character
00023         #define ULONG       unsigned long           // ..and unsigned long
00024         #define MAX_PATH_ZIPINFO    79                      // maximum path length
00025         #define LAST(s)     s[strlen(s) - 1]        // last character in string
00026         #define TRUE        1                       // true value
00027         #define FALSE       0                       // false value
00028         #define BUFFER_SIZE 32768L                  // dictionary/output buffer size
00029         #define COPY_BUFFER 16384                   // copy buffer size
00030         #define FILE_ATTR   _A_NORMAL | _A_RDONLY   // file attrib to search on
00031 
00032 
00033         /* ******************************************************************** *
00034          *
00035          *  Header Definitions
00036          *
00037          * ******************************************************************** */
00038 
00039 //##ModelId=3B9E68D80213
00040         struct lf                                   // local file header
00041                 {
00042         //##ModelId=3B9E68D80222
00043                 ULONG lf_sig;                               // signature (0x04034b50)
00044                 WORD  lf_extract,                           // vers needed to extract
00045                           lf_flag,                              // general purpose flag
00046                           lf_cm,                                // compression method
00047                           lf_time,                              // file time
00048                           lf_date;                              // ..and file date
00049                 ULONG lf_crc,                               // CRC-32 for file
00050                           lf_csize,                             // compressed size
00051                           lf_size;                              // uncompressed size
00052                 WORD  lf_fn_len,                            // file name length
00053                           lf_ef_len;                            // extra field length
00054                 };
00055 
00056 
00057 //##ModelId=3B9E68D401B5
00058         struct dd                                   // data descriptor
00059                 {
00060                 ULONG dd_crc,                               // CRC-32 for file
00061                           dd_csize,                             // compressed size
00062                           dd_size;                              // uncompressed size
00063                 };
00064 
00065 
00066 //##ModelId=3B9E68D60138
00067         struct fh                                   // file header
00068                 {
00069         //##ModelId=3B9E68D60148
00070                 ULONG  fh_sig;                               // signature (0x02014b50)
00071                 WORD  fh_made,                              // version made by
00072                           fh_extract,                           // vers needed to extract
00073                           fh_flag,                              // general purpose flag
00074                           fh_cm,                                // compression method
00075                           fh_time,                              // file time
00076                           fh_date;                              // ..and file date
00077                 ULONG  fh_crc,                               // CRC-32 for file
00078                           fh_csize,                             // compressed size
00079                           fh_size;                              // uncompressed size
00080                 WORD  fh_fn_len,                            // file name length
00081                           fh_ef_len,                            // extra field length
00082                           fh_fc_len,                            // file comment length
00083                           fh_disk,                              // disk number
00084                           fh_attr;                              // internal file attrib
00085                 ULONG  fh_eattr,                             // external file attrib
00086                           fh_offset;                            // offset of local header
00087                 };
00088 
00089 
00090 //##ModelId=3B9E68DA0138
00091         struct ed                                   // end of central dir record
00092                 {
00093         //##ModelId=3B9E68DA0149
00094                 ULONG  ed_sig;                               // signature (0x06054b50)
00095                 WORD  ed_disk,                              // this disk number
00096                           ed_cdisk,                             // disk w/central dir
00097                           ed_current,                           // current disk's dir entries
00098                           ed_total;                             // total dir entries
00099                 ULONG  ed_size,                              // size of central dir
00100                           ed_offset;                            // offset of central dir
00101         //##ModelId=3B9E68DA0148
00102                 WORD  ed_zc_len;                            // zip file comment length
00103                 };
00104 
00105 
00106         typedef struct lf LF;                       // set up
00107         typedef struct fh FH;                       // ..structure
00108         typedef struct dd DD;                       // ..shorthands
00109         typedef struct ed ED;                       //
00110 
00111 
00112         #define LF_SIG              0x0403          // local file header signature
00113         #define FH_SIG              0x0201          // file header signature
00114         #define ED_SIG              0x0605          // end of central dir signature
00115 
00116                                                                                                 // general purpose flag
00117         #define LH_FLAG_ENCRYPT     0x01                // file is encrypted
00118 
00119                                                                                                         // for Method 6 - Imploding
00120         #define LF_FLAG_8K          0x02                // use 8k dictionary vs 4k
00121         #define LF_FLAG_3SF         0x04                // use 3 S-F trees vs 2
00122 
00123                                                                                                         // for Method 8 - Deflating
00124         #define LF_FLAG_NORM        0x00                // normal compression
00125         #define LF_FLAG_MAX         0x02                // maximum compression
00126         #define LF_FLAG_FAST        0x04                // fast compression
00127         #define LF_FLAG_SUPER       0x06                // super fast compression
00128         #define LF_FLAG_DDREC       0x08                // use data descriptor record
00129 
00130                                                                                                 // compression method
00131         #define LF_CM_STORED        0x00                // stored
00132         #define LF_CM_SHRUNK        0x01                // shrunk
00133         #define LF_CM_REDUCED1      0x02                // reduced with factor 1
00134         #define LF_CM_REDUCED2      0x03                // reduced with factor 2
00135         #define LF_CM_REDUCED3      0x04                // reduced with factor 3
00136         #define LF_CM_REDUCED4      0x05                // reduced with factor 4
00137         #define LF_CM_IMPLODED      0x06                // imploded
00138         #define LF_CM_TOKENIZED     0x07                // tokenized (not used)
00139         #define LF_CM_DEFLATED      0x08                // deflated
00140 
00141 
00142 
00143         /* ******************************************************************** *
00144          *
00145          *  LZW Support Structures
00146          *
00147          * ******************************************************************** */
00148 
00149         #define TABLE_SIZE          0x2001          // dictionary table size
00150         #define FREE                0xffff          // free entry value
00151 
00152 //##ModelId=3B9E68D600CB
00153         struct  dictionary                          // dictionary entry
00154                 {
00155         //##ModelId=3B9E68D600DB
00156                 WORD parent_c;                              // parent's code
00157         //##ModelId=3B9E68D600DA
00158                 char c;                                     // replacement character
00159                 };
00160 
00161         typedef struct dictionary SD;               // structure shorthand
00162 
00163 
00164 
00165         /* ******************************************************************** *
00166          *
00167          *  Expanded Structures
00168          *
00169          * ******************************************************************** */
00170 
00171         #define EXPLODE_DLE         144             // escape character
00172         #define EXPAND_BUFF         4096            // sliding buffer size
00173 
00174 //##ModelId=3B9E68D901F4
00175         struct  follower_set                        // follower set
00176                 {
00177                 BYTE set_len,                               // set length
00178                          set[32];                               // set
00179                 };
00180 
00181         typedef struct follower_set FS;             // structure shorthand
00182 
00183 
00184 
00185         /* ******************************************************************** *
00186          *
00187          *  Shannon-Fano Tree Structure
00188          *
00189          * ******************************************************************** */
00190 
00191 //##ModelId=3B9E68D90213
00192         struct  shannon_fano_tree                   // Shannon-Fano trees
00193                 {
00194                 BYTE  blen,                                  // bit length
00195                           value;                                 // value
00196         //##ModelId=3B9E68D90222
00197                 WORD code;                                  // tree bit code
00198                 };
00199 
00200         typedef struct shannon_fano_tree SFT;       // structure shorthand
00201 
00202 
00203 
00204         /* ******************************************************************** *
00205          *
00206          *  Huffman Tree Structure
00207          *
00208          * ******************************************************************** */
00209 
00210 //##ModelId=3B9E68D80196
00211         struct  huffman_tree                        // Huffman trees
00212                 {
00213                 BYTE eb,                                    // extra bits
00214                          blen;                                  // bit length
00215                 union
00216                         {
00217                         int        code;                            // literal, len or distance
00218                         struct huffman_tree *table;             // chain pointer
00219                         } v;
00220                 };
00221 
00222         typedef struct huffman_tree HUFF;           // structure shorthand
00223 
00224         
00225 #endif

Copyright(C) gvSystem & GamePlus All Rights Reserved.