diff src/win32/7zip/7z/C/LzFind.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/C/LzFind.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,107 @@
     1.4 +/* LzFind.h -- Match finder for LZ algorithms
     1.5 +2008-10-04 : Igor Pavlov : Public domain */
     1.6 +
     1.7 +#ifndef __LZFIND_H
     1.8 +#define __LZFIND_H
     1.9 +
    1.10 +#include "Types.h"
    1.11 +
    1.12 +typedef UInt32 CLzRef;
    1.13 +
    1.14 +typedef struct _CMatchFinder
    1.15 +{
    1.16 +  Byte *buffer;
    1.17 +  UInt32 pos;
    1.18 +  UInt32 posLimit;
    1.19 +  UInt32 streamPos;
    1.20 +  UInt32 lenLimit;
    1.21 +
    1.22 +  UInt32 cyclicBufferPos;
    1.23 +  UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
    1.24 +
    1.25 +  UInt32 matchMaxLen;
    1.26 +  CLzRef *hash;
    1.27 +  CLzRef *son;
    1.28 +  UInt32 hashMask;
    1.29 +  UInt32 cutValue;
    1.30 +
    1.31 +  Byte *bufferBase;
    1.32 +  ISeqInStream *stream;
    1.33 +  int streamEndWasReached;
    1.34 +
    1.35 +  UInt32 blockSize;
    1.36 +  UInt32 keepSizeBefore;
    1.37 +  UInt32 keepSizeAfter;
    1.38 +
    1.39 +  UInt32 numHashBytes;
    1.40 +  int directInput;
    1.41 +  int btMode;
    1.42 +  /* int skipModeBits; */
    1.43 +  int bigHash;
    1.44 +  UInt32 historySize;
    1.45 +  UInt32 fixedHashSize;
    1.46 +  UInt32 hashSizeSum;
    1.47 +  UInt32 numSons;
    1.48 +  SRes result;
    1.49 +  UInt32 crc[256];
    1.50 +} CMatchFinder;
    1.51 +
    1.52 +#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
    1.53 +#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
    1.54 +
    1.55 +#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
    1.56 +
    1.57 +int MatchFinder_NeedMove(CMatchFinder *p);
    1.58 +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
    1.59 +void MatchFinder_MoveBlock(CMatchFinder *p);
    1.60 +void MatchFinder_ReadIfRequired(CMatchFinder *p);
    1.61 +
    1.62 +void MatchFinder_Construct(CMatchFinder *p);
    1.63 +
    1.64 +/* Conditions:
    1.65 +     historySize <= 3 GB
    1.66 +     keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
    1.67 +*/
    1.68 +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
    1.69 +    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
    1.70 +    ISzAlloc *alloc);
    1.71 +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
    1.72 +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
    1.73 +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
    1.74 +
    1.75 +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
    1.76 +    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
    1.77 +    UInt32 *distances, UInt32 maxLen);
    1.78 +
    1.79 +/*
    1.80 +Conditions:
    1.81 +  Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
    1.82 +  Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
    1.83 +*/
    1.84 +
    1.85 +typedef void (*Mf_Init_Func)(void *object);
    1.86 +typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
    1.87 +typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
    1.88 +typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
    1.89 +typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
    1.90 +typedef void (*Mf_Skip_Func)(void *object, UInt32);
    1.91 +
    1.92 +typedef struct _IMatchFinder
    1.93 +{
    1.94 +  Mf_Init_Func Init;
    1.95 +  Mf_GetIndexByte_Func GetIndexByte;
    1.96 +  Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
    1.97 +  Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
    1.98 +  Mf_GetMatches_Func GetMatches;
    1.99 +  Mf_Skip_Func Skip;
   1.100 +} IMatchFinder;
   1.101 +
   1.102 +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
   1.103 +
   1.104 +void MatchFinder_Init(CMatchFinder *p);
   1.105 +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
   1.106 +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
   1.107 +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
   1.108 +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
   1.109 +
   1.110 +#endif