unarj  2.65
About: unarj is a simple program to extract, test and view RAR archives created with the ARJ archiver.
  Fossies Dox: unarj-2.65.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

decode.c File Reference
#include "unarj.h"
Include dependency graph for decode.c:

Go to the source code of this file.

Macros

#define THRESHOLD   3
 
#define DDICSIZ   26624
 
#define MAXDICBIT   16
 
#define MATCHBIT   8
 
#define MAXMATCH   256
 
#define NC   (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
 
#define NP   (MAXDICBIT + 1)
 
#define CBIT   9
 
#define NT   (CODE_BIT + 3)
 
#define PBIT   5
 
#define TBIT   5
 
#define NPT   NT
 
#define CTABLESIZE   4096
 
#define PTABLESIZE   256
 
#define STRTP   9
 
#define STOPP   13
 
#define STRTL   0
 
#define STOPL   7
 
#define BFIL   {getbuf|=bitbuf>>getlen;fillbuf(CODE_BIT-getlen);getlen=CODE_BIT;}
 
#define GETBIT(c)   {if(getlen<=0)BFIL c=(getbuf&0x8000)!=0;getbuf<<=1;getlen--;}
 
#define BPUL(l)   {getbuf<<=l;getlen-=l;}
 
#define GETBITS(c, l)   {if(getlen<l)BFIL c=(ushort)getbuf>>(CODE_BIT-l);BPUL(l)}
 

Functions

int free ()
 
static int make_table (int nchar, uchar *bitlen, int tablebits, ushort *table, int tablesize)
 
static int read_pt_len (int nn, int nbit, int i_special)
 
static int read_c_len ()
 
static ushort decode_c ()
 
static ushort decode_p ()
 
static int decode_start ()
 
int decode ()
 
static short decode_ptr ()
 
static short decode_len ()
 
int decode_f ()
 

Variables

static uchartext = NULL
 
static short getlen
 
static short getbuf
 
static ushort left [2 *((255)+256+2 - 3) - 1]
 
static ushort right [2 *((255)+256+2 - 3) - 1]
 
static uchar c_len [((255)+256+2 - 3)]
 
static uchar pt_len [(16+3)]
 
static ushort c_table [4096]
 
static ushort pt_table [256]
 
static ushort blocksize
 

Macro Definition Documentation

◆ BFIL

Definition at line 419 of file decode.c.

◆ BPUL

#define BPUL (   l)    {getbuf<<=l;getlen-=l;}

Definition at line 421 of file decode.c.

◆ CBIT

#define CBIT   9

Definition at line 47 of file decode.c.

◆ CTABLESIZE

#define CTABLESIZE   4096

Definition at line 58 of file decode.c.

◆ DDICSIZ

#define DDICSIZ   26624

Definition at line 41 of file decode.c.

◆ GETBIT

#define GETBIT (   c)    {if(getlen<=0)BFIL c=(getbuf&0x8000)!=0;getbuf<<=1;getlen--;}

Definition at line 420 of file decode.c.

◆ GETBITS

#define GETBITS (   c,
 
)    {if(getlen<l)BFIL c=(ushort)getbuf>>(CODE_BIT-l);BPUL(l)}

Definition at line 422 of file decode.c.

◆ MATCHBIT

#define MATCHBIT   8

Definition at line 43 of file decode.c.

◆ MAXDICBIT

#define MAXDICBIT   16

Definition at line 42 of file decode.c.

◆ MAXMATCH

#define MAXMATCH   256

Definition at line 44 of file decode.c.

◆ NC

#define NC   (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)

Definition at line 45 of file decode.c.

◆ NP

#define NP   (MAXDICBIT + 1)

Definition at line 46 of file decode.c.

◆ NPT

#define NPT   NT

Definition at line 53 of file decode.c.

◆ NT

#define NT   (CODE_BIT + 3)

Definition at line 48 of file decode.c.

◆ PBIT

#define PBIT   5

Definition at line 49 of file decode.c.

◆ PTABLESIZE

#define PTABLESIZE   256

Definition at line 59 of file decode.c.

◆ STOPL

#define STOPL   7

Definition at line 65 of file decode.c.

◆ STOPP

#define STOPP   13

Definition at line 62 of file decode.c.

◆ STRTL

#define STRTL   0

Definition at line 64 of file decode.c.

◆ STRTP

#define STRTP   9

Definition at line 61 of file decode.c.

◆ TBIT

#define TBIT   5

Definition at line 50 of file decode.c.

◆ THRESHOLD

#define THRESHOLD   3

Definition at line 40 of file decode.c.

Function Documentation

◆ decode()

int decode ( )

◆ decode_c()

static ushort decode_c ( )
static

Definition at line 283 of file decode.c.

References bitbuf, blocksize, c_len, c_table, fillbuf(), getbits(), left, NC, NP, NT, PBIT, read_c_len(), read_pt_len(), right, and TBIT.

Referenced by decode().

◆ decode_f()

int decode_f ( )

◆ decode_len()

static short decode_len ( )
static

Definition at line 449 of file decode.c.

References GETBIT, GETBITS, STOPL, and STRTL.

Referenced by decode_f().

◆ decode_p()

static ushort decode_p ( )
static

Definition at line 313 of file decode.c.

References bitbuf, fillbuf(), getbits(), left, NP, pt_len, pt_table, and right.

Referenced by decode().

◆ decode_ptr()

static short decode_ptr ( )
static

Definition at line 425 of file decode.c.

References GETBIT, GETBITS, STOPP, and STRTP.

Referenced by decode_f().

◆ decode_start()

static int decode_start ( )
static

Definition at line 340 of file decode.c.

References blocksize, and init_getbits().

Referenced by decode().

◆ free()

int free ( )

Referenced by decode(), and decode_f().

◆ make_table()

static int make_table ( int  nchar,
uchar bitlen,
int  tablebits,
ushort table,
int  tablesize 
)
static

Definition at line 99 of file decode.c.

References error(), left, M_BADTABLE, and right.

Referenced by read_c_len(), and read_pt_len().

◆ read_c_len()

static int read_c_len ( )
static

Definition at line 229 of file decode.c.

References bitbuf, c_len, c_table, CBIT, CTABLESIZE, fillbuf(), getbits(), left, make_table(), NC, NT, pt_len, pt_table, and right.

Referenced by decode_c().

◆ read_pt_len()

static int read_pt_len ( int  nn,
int  nbit,
int  i_special 
)
static

Definition at line 180 of file decode.c.

References bitbuf, fillbuf(), getbits(), make_table(), pt_len, pt_table, and PTABLESIZE.

Referenced by decode_c().

Variable Documentation

◆ blocksize

ushort blocksize
static

Definition at line 94 of file decode.c.

Referenced by decode_c(), and decode_start().

◆ c_len

uchar c_len[((255)+ 256+2 - 3)]
static

Definition at line 89 of file decode.c.

Referenced by decode_c(), and read_c_len().

◆ c_table

ushort c_table[4096]
static

Definition at line 92 of file decode.c.

Referenced by decode_c(), and read_c_len().

◆ getbuf

short getbuf
static

Definition at line 85 of file decode.c.

Referenced by decode_f().

◆ getlen

short getlen
static

Definition at line 84 of file decode.c.

Referenced by decode_f().

◆ left

ushort left[2 *((255)+ 256+2 - 3) - 1]
static

Definition at line 87 of file decode.c.

Referenced by decode_c(), decode_p(), make_table(), and read_c_len().

◆ pt_len

uchar pt_len[(16+3)]
static

Definition at line 90 of file decode.c.

Referenced by decode_p(), read_c_len(), and read_pt_len().

◆ pt_table

ushort pt_table[256]
static

Definition at line 93 of file decode.c.

Referenced by decode_p(), read_c_len(), and read_pt_len().

◆ right

ushort right[2 *((255)+ 256+2 - 3) - 1]
static

Definition at line 88 of file decode.c.

Referenced by decode_c(), decode_p(), make_table(), and read_c_len().

◆ text

uchar* text = NULL
static

Definition at line 82 of file decode.c.

Referenced by decode(), and decode_f().