CFMAIN.H 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. Version 1.6 fixes a bug in lzw.c (cfread).
  24. Main Code
  25. ---------
  26. CFMAIN.H The header file which give prototypes and definitions for
  27. the routines and data structures which CFWRITE.C and
  28. CFREAD.C expect to find in compression routines.
  29. CFTEST.C Test program for CFREAD.
  30. BITIO.C The C file containing the bit oriented I/O routines used.
  31. LZW.C A fully featured LZW compression module. This version
  32. includes variable length codes up to 15 bits, and tree
  33. flushing.
  34. COMPRESS.C Contains a driver for CFWRITE that takes an input
  35. file and writes it to a compressed output.
  36. MAKEFILE Makes CF.LIB, COMPRESS.EXE, and CFTEST.EXE.
  37. ===========================================================================
  38. COMPRESS is used to compress the original datafile.
  39. Usage: COMPRESS in-file out-file.
  40. CFTEST checks the decompression using the cfread procedure and outputs
  41. some benchmarks.
  42. =========================================================================*/
  43. #include <stdio.h>
  44. typedef struct bit_file {
  45. unsigned char *buf;
  46. char *name;
  47. int current_byte;
  48. unsigned char mask;
  49. int rack;
  50. int pacifier_counter;
  51. int length;
  52. } BIT_FILE;
  53. BIT_FILE *OpenInputBitFile( char *name );
  54. BIT_FILE *OpenOutputBitFile( char *name );
  55. void OutputBit( BIT_FILE *bit_file, int bit );
  56. void OutputBits( BIT_FILE *bit_file,
  57. unsigned int code, int count );
  58. int InputBit( BIT_FILE *bit_file );
  59. unsigned int InputBits( BIT_FILE *bit_file, int bit_count );
  60. void CloseInputBitFile( BIT_FILE *bit_file );
  61. void CloseOutputBitFile( BIT_FILE *bit_file );
  62. void FilePrintBinary( FILE *file, unsigned int code, int bits );
  63. unsigned char *cfread( char *filename, int *length );
  64. void cfwrite( char *filename, unsigned char *input, int length );
  65. extern char *Usage;
  66. extern char *CompressionName;