home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / lib / cfmain.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  3KB  |  84 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /* CFMAIN.H */
  14. /*=========================================================================
  15.    Compression File Library                                Version 1.6
  16. ===========================================================================
  17. The following files contain the source for the compression programs.
  18. ARITH-N.C yields the best compression ratios, but is far too slow.
  19. It looks like LZW is what we will be using.  It uncompressed PROCOMM.EXE
  20. (~160K) in about 3-4 seconds.  If we need to compress sound or graphics
  21. files, there are also algorithms available.  We could name the functions
  22. gfread and sfread or something like that.
  23.  
  24. Version 1.6 fixes a bug in lzw.c (cfread).
  25.  
  26. Main Code
  27. ---------
  28. CFMAIN.H        The header file which give prototypes and definitions for
  29.                 the routines and data structures which CFWRITE.C and
  30.                 CFREAD.C expect to find in compression routines.
  31.  
  32. CFTEST.C        Test program for CFREAD.
  33.  
  34. BITIO.C         The C file containing the bit oriented I/O routines used.
  35.  
  36. LZW.C           A fully featured LZW compression module.  This version
  37.                 includes variable length codes up to 15 bits, and tree
  38.                 flushing.
  39.  
  40. COMPRESS.C      Contains a driver for CFWRITE that takes an input
  41.                 file and writes it to a compressed output.
  42.  
  43. MAKEFILE        Makes CF.LIB, COMPRESS.EXE, and CFTEST.EXE.
  44. ===========================================================================
  45.  
  46. COMPRESS is used to compress the original datafile.
  47.  
  48.         Usage:  COMPRESS in-file out-file.
  49.  
  50. CFTEST checks the decompression using the cfread procedure and outputs
  51.         some benchmarks.
  52.  
  53. =========================================================================*/
  54.                   
  55. #include <stdio.h>
  56.  
  57. typedef struct bit_file {
  58.     unsigned char *buf;
  59.     char *name;
  60.     int current_byte;
  61.     unsigned char mask;
  62.     int rack;
  63.     int pacifier_counter;
  64.     int length;
  65. } BIT_FILE;
  66.  
  67. BIT_FILE     *OpenInputBitFile( char *name );
  68. BIT_FILE     *OpenOutputBitFile( char *name );
  69. void          OutputBit( BIT_FILE *bit_file, int bit );
  70. void          OutputBits( BIT_FILE *bit_file,
  71.                           unsigned int code, int count );
  72. int           InputBit( BIT_FILE *bit_file );
  73. unsigned int  InputBits( BIT_FILE *bit_file, int bit_count );
  74. void          CloseInputBitFile( BIT_FILE *bit_file );
  75. void          CloseOutputBitFile( BIT_FILE *bit_file );
  76. void          FilePrintBinary( FILE *file, unsigned int code, int bits );
  77.  
  78. unsigned char *cfread( char *filename, int *length );
  79. void cfwrite( char *filename, unsigned char *input, int length );
  80.  
  81. extern char *Usage;
  82. extern char *CompressionName;
  83.  
  84.