Logo Search packages:      
Sourcecode: bible-kjv version File versions

squish.h

/* $Id: squish.h,v 2.2 2005/01/22 17:15:57 matthew Exp $*/
#ifndef __SQUISH_H__
#define __SQUISH_H__

#include <stdio.h>

/*
 * machine variants which require cc -Dmachine:  pdp11, z8000, pcxt
 */

/*
 * Set USERMEM to the maximum amount of physical user memory available
 * in bytes.  USERMEM is used to determine the maximum BITS that can be used
 * for compression.
 *
 * SACREDMEM is the amount of physical memory saved for others; compress
 * will hog the rest.
 */
#ifndef SACREDMEM
#define SACREDMEM 0
#endif

#ifndef USERMEM
# define USERMEM  450000      /* default user memory */
#endif

#ifdef interdata        /* (Perkin-Elmer) */
#define SIGNED_COMPARE_SLOW   /* signed compare is slower than unsigned */
#endif

#ifdef pdp11
# define BITS     12    /* max bits/code for 16-bit machine */
# define NO_UCHAR /* also if "unsigned char" functions as signed char */
# undef USERMEM 
#endif /* pdp11 */      /* don't forget to compile with -i */

#ifdef z8000
# define BITS     12
# undef vax       /* weird preprocessor */
# undef USERMEM 
#endif /* z8000 */

#ifdef pcxt
# define BITS   12
# undef USERMEM
#endif /* pcxt */

#ifdef USERMEM
# if USERMEM >= (433484+SACREDMEM)
#  define PBITS   16
# else
#  if USERMEM >= (229600+SACREDMEM)
#   define PBITS  15
#  else
#   if USERMEM >= (127536+SACREDMEM)
#    define PBITS 14
#   else
#    if USERMEM >= (73464+SACREDMEM)
#     define PBITS      13
#    else
#     define PBITS      12
#    endif
#   endif
#  endif
# endif
# undef USERMEM
#endif /* USERMEM */

#ifdef PBITS            /* Preferred BITS for this memory size */
# ifndef BITS
#  define BITS PBITS
# endif /* BITS */
#endif /* PBITS */

#if BITS == 16
# define HSIZE    69001       /* 95% occupancy */
#endif
#if BITS == 15
# define HSIZE    35023       /* 94% occupancy */
#endif
#if BITS == 14
# define HSIZE    18013       /* 91% occupancy */
#endif
#if BITS == 13
# define HSIZE    9001        /* 91% occupancy */
#endif
#if BITS <= 12
# define HSIZE    5003        /* 80% occupancy */
#endif

#ifdef M_XENIX                /* Stupid compiler can't handle arrays with */
# if BITS == 16               /* more than 65535 bytes - so we fake it */
#  define XENIX_16
# else
#  if BITS > 13               /* Code only handles BITS = 12, 13, or 16 */
#   define BITS   13
#  endif
# endif
#endif

/*
 * a code_int must be able to hold 2**BITS values of type int, and also -1
 */
#if BITS > 15
typedef long int  code_int;
#else
typedef int       code_int;
#endif

#ifdef SIGNED_COMPARE_SLOW
typedef unsigned long int count_int;
typedef unsigned short int count_short;
#else
typedef long int    count_int;
#endif

#ifdef NO_UCHAR
 typedef char     char_type;
#else
 typedef    unsigned char     char_type;
#endif /* UCHAR */
char_type magic_header[] = { "\037\235" };      /* 1F 9D */

/* Defines for third byte of header */
#define BIT_MASK  0x1f
#define BLOCK_MASK      0x80
/* Masks 0x40 and 0x20 are free.  I think 0x20 should mean that there is
   a fourth header byte (for expansion).
*/
#define INIT_BITS 9                 /* initial number of bits/code */


void Usage(void);
void compress(void);
void output(code_int code);
void decompress(void);
code_int getcode(void);
void writeerr(void);
int foreground(void);
void onintr (void);
void oops (void);
void cl_block (void);
void do_clearblock(void);
void cl_hash(count_int lhsize);
void prratio(FILE *stream,long int num,long int den);
void version(void);

#endif /*__SQUISH_H__*/

Generated by  Doxygen 1.6.0   Back to index