JAM_IO.H 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // UNIT : JAM_IO.h
  20. //
  21. // FUNCTION : General defines, prototypes, typedefs used in all the
  22. // supported compression techniques used in JAMPAK Ver x.x
  23. //
  24. //
  25. //==========================================================================
  26. //
  27. // PARAMETER PASSING TYPES
  28. //
  29. //
  30. // SOURCE PARAMS (LO BYTE)
  31. #define SRC_FILE (0x0001) // GE Buffered IO
  32. #define SRC_FFILE (0x0002) // Stdio File IO (fwrite etc.)
  33. #define SRC_MEM (0x0004) // Std void ptr (alloc etc)
  34. #define SRC_BFILE (0x0008) // Buffered File I/O
  35. #define SRC_TYPES (SRC_FILE | SRC_FFILE | SRC_MEM | SRC_BFILE)
  36. // DESTINATION PARAMS (HI BYTE)
  37. #define DEST_FILE (0x0100) // GE Buffered IO
  38. #define DEST_FFILE (0x0200) // Stdio File IO (fwrite etc.)
  39. #define DEST_MEM (0x0400) // Std void ptr (alloc etc)
  40. #define DEST_IMEM (0x0800) // ID Memory alloc
  41. #define DEST_TYPES (DEST_FILE | DEST_FFILE | DEST_MEM | DEST_IMEM)
  42. //=========================================================================
  43. //
  44. // FILE CHUNK IDs
  45. //
  46. // NOTE: The only reason for changing from COMP to CMP1 and having multi
  47. // comp header structs is for downward compatablity.
  48. //
  49. #define COMP ("COMP") // Comp type is ct_LZW ALWAYS!
  50. #define CMP1 ("CMP1") // Comp type is determined in header.
  51. //
  52. // COMPRESSION TYPES
  53. //
  54. typedef enum ct_TYPES
  55. {
  56. ct_NONE = 0, // No compression - Just data..Rarely used!
  57. ct_LZW, // LZW data compression
  58. ct_LZH,
  59. } ct_TYPES;
  60. //
  61. // FILE CHUNK HEADER FORMATS
  62. //
  63. struct COMPStruct
  64. {
  65. unsigned long DecompLen;
  66. };
  67. struct CMP1Header
  68. {
  69. unsigned CompType; // SEE: ct_TYPES above for list of pos.
  70. unsigned long OrginalLen; // Orginal FileLength of compressed Data.
  71. unsigned long CompressLen; // Length of data after compression (A MUST for LZHUFF!)
  72. };
  73. //---------------------------------------------------------------------------
  74. //
  75. // FUNCTION PROTOTYPEING
  76. //
  77. //---------------------------------------------------------------------------
  78. char WritePtr(long outfile, unsigned char data, unsigned PtrType);
  79. int ReadPtr(long infile, unsigned PtrType);