home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
ARCHIVERS
/
lha205.lzh
/
slidehuf.h
< prev
next >
Wrap
Text File
|
1992-05-11
|
4KB
|
157 lines
/*
* slidehuf.h -- part of LHa for UNIX
*
* modified: Dec. 5, 1991, Masaru Oki.
*/
#ifndef NULL
#include <stdio.h>
#endif
#ifndef _ERRNO
#include <errno.h>
#endif
#if defined(__STDC__) || defined(OSK)
#include <limits.h>
#else
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef UCHAR_MAX
#define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1)
#endif
#ifndef USHRT_MAX
#define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1)
#endif
#ifndef SHRT_MAX
#define SHRT_MAX ((1<<(sizeof(short)*8-1))-1)
#endif
#ifndef SHRT_MIN
#define SHRT_MIN (SHRT_MAX-USHRT_MAX)
#endif
#endif /* not __STDC__ */
/* #include "errmes.h" */
/* Your C-Compiler has no 'void' (from lharc.h) */
#ifdef NO_VOID
#define void
#endif
struct encode_option {
#ifndef NO_VOID
void (*output)();
void (*encode_start)();
void (*encode_end)();
#else
int (*output)();
int (*encode_start)();
int (*encode_end)();
#endif
};
struct decode_option {
unsigned short (*decode_c)();
unsigned short (*decode_p)();
#ifndef NO_VOID
void (*decode_start)();
#else
int (*decode_start)();
#endif
};
/* from slide.c */
#define MAX_DICBIT 13
#define MAX_DICSIZ (1 << MAX_DICBIT)
#define MATCHBIT 8 /* bits for MAXMATCH - THRESHOLD */
#define MAXMATCH 256 /* formerly F (not more than UCHAR_MAX + 1) */
#define THRESHOLD 3 /* choose optimal value */
extern int errno;
extern int unpackable;
extern unsigned long origsize, compsize;
extern unsigned short dicbit;
extern unsigned short maxmatch;
extern unsigned long count;
extern unsigned short loc;
extern unsigned char *text;
/* from huf.c */
#define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
/* alphabet = {0, 1, 2, ..., NC - 1} */
#define CBIT 9 /* $\lfloor \log_2 NC \rfloor + 1$ */
#define USHRT_BIT 16 /* (CHAR_BIT * sizeof(ushort)) */
extern unsigned short left[], right[];
extern unsigned char c_len[], pt_len[];
extern unsigned short c_freq[], c_table[], c_code[],
p_freq[], pt_table[], pt_code[],
t_freq[];
void output_st1();
unsigned char *alloc_buf();
void encode_start_st1();
void encode_end_st1();
unsigned short decode_c_st1();
unsigned short decode_p_st1();
void decode_start_st1();
/* from shuf.c */
void decode_start_st0();
void encode_p_st0(/*unsigned short j*/);
void encode_start_fix();
void decode_start_fix();
unsigned short decode_c_st0();
unsigned short decode_p_st0();
/* from dhuf.c */
extern unsigned int n_max;
void start_c_dyn();
void decode_start_dyn();
unsigned short decode_c_dyn();
unsigned short decode_p_dyn();
void output_dyn(/*int code, unsigned int pos*/);
void encode_end_dyn();
/* from larc.c */
unsigned short decode_c_lzs();
unsigned short decode_p_lzs();
unsigned short decode_c_lz5();
unsigned short decode_p_lz5();
void decode_start_lzs();
void decode_start_lz5();
/* from maketbl.c */
/* void make_table(short nchar, uchar bitlen[],
short tablebits, ushort table[]); */
void make_table(/*int nchar, uchar bitlen[],int tablebits, ushort table[]*/);
/* from maketree.c */
/* void make_code(short n, uchar len[], ushort code[]);
short make_tree(short nparm, ushort freqparm[],
uchar lenparm[], ushort codeparam[]); */
void make_code(/*int n, uchar len[], ushort code[]*/);
short make_tree(/*int nparm, ushort freqparm[],
uchar lenparm[], ushort codeparam[]*/);
/* from crcio.c */
extern FILE *infile, *outfile;
extern unsigned short crc, bitbuf;
extern int dispflg;
void make_crctable();
unsigned short calccrc(/*uchar *p, uint n*/);
void fillbuf(/*uchar n*/);
unsigned short getbits(/*uchar n*/);
void putcode(/*uchar n, ushort x*/);
void putbits(/*uchar n, ushort x*/);
int fread_crc(/*uchar *p, int n, FILE *f*/);
void fwrite_crc(/*uchar *p, int n, FILE *f*/);
void init_getbits();
void init_putbits();