JAMPAK.H 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* Catacomb Armageddon Source Code
  2. * Copyright (C) 1993-2014 Flat Rock Software
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. //
  19. //
  20. //
  21. //
  22. //
  23. #define LZW_N 4096
  24. #define LZW_F 18
  25. // LZW_THRESHOLD :encode string into position and length if match_length is
  26. // greater than this
  27. #define LZW_THRESHOLD 2
  28. // index for root of binary search trees
  29. //
  30. #define LZW_NIL LZW_N
  31. //
  32. // FILE CHUNK IDs
  33. //
  34. // NOTE: The only reason for changing from COMP to CMP2 and having multi
  35. // comp header structs is for downward compatablity.
  36. //
  37. #define COMP ("COMP") // Comp type is ct_LZW ALWAYS!
  38. #define CMP2 ("CMP2") // Comp type is determined in header.
  39. //
  40. // COMPRESSION TYPES
  41. //
  42. #if 0
  43. //
  44. // FILE CHUNK HEADER FORMATS
  45. //
  46. struct COMPStruct
  47. {
  48. unsigned long DecompLen;
  49. };
  50. struct CMP2Header
  51. {
  52. unsigned CompType;
  53. unsigned long DecompLen;
  54. };
  55. #endif
  56. memptr segptr;
  57. extern BufferedIO lzwBIO;
  58. //
  59. // PARAMETER PASSING TYPES (POINTER TYPES)
  60. //
  61. #define SRC_FILE (0x0001) // C's non-buffered file i/o
  62. #define SRC_FFILE (0x0002) // C's buffered ffile i/o
  63. #define SRC_MEM (0x0004) // FAR memory Ptrs
  64. #define SRC_BFILE (0x0008) // Buffered File I/O
  65. #define SRC_TYPES (SRC_FILE | SRC_FFILE | SRC_MEM | SRC_BFILE)
  66. #define DEST_FILE (0x0100) // C's non-buffered file i/o
  67. #define DEST_FFILE (0x0200) // C's buffered ffile i/o
  68. #define DEST_MEM (0x0400) // FAR memory Ptrs
  69. #define DEST_TYPES (DEST_FILE | DEST_FFILE | DEST_MEM)
  70. //---------------------------------------------------------------------------
  71. // FUNCTION PROTOTYPEING
  72. //---------------------------------------------------------------------------
  73. //void DecompressFILEtoFILE(FILE *infile, FILE *outfile);
  74. //unsigned long CompressFILEtoFILE(FILE *infile, FILE *outfile,unsigned long DataLength);
  75. unsigned long lzwCompress(void far *infile, void far *outfile,unsigned long DataLength,unsigned PtrTypes);
  76. void lzwDecompress(void far *infile, void far *outfile,unsigned long DataLength,unsigned PtrTypes);
  77. int WritePtr(long outfile, unsigned char data, unsigned PtrType);
  78. int ReadPtr(long infile, unsigned PtrType);
  79. //memptr InitBufferedIO(int handle, BufferedIO *bio);
  80. //void FreeBufferedIO(BufferedIO *bio);
  81. //byte bio_readch(BufferedIO *bio);
  82. unsigned long BLoad(char *SourceFile, memptr *DstPtr);
  83. memptr LoadLIBFile(char *LibName,char *FileName,memptr *MemPtr);
  84. int LoadLIBShape(char *SLIB_Filename, char *Filename,struct Shape *SHP);