]> 4ch.mooo.com Git - 16.git/blob - 16/cawat/JAM_IO.H
77db01dccc420df01b0bef66919f443acd30f2cb
[16.git] / 16 / cawat / JAM_IO.H
1 /* Catacomb Armageddon Source Code\r
2  * Copyright (C) 1993-2014 Flat Rock Software\r
3  *\r
4  * This program is free software; you can redistribute it and/or modify\r
5  * it under the terms of the GNU General Public License as published by\r
6  * the Free Software Foundation; either version 2 of the License, or\r
7  * (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along\r
15  * with this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
17  */\r
18 \r
19 //\r
20 // UNIT : JAM_IO.h\r
21 //\r
22 // FUNCTION : General defines, prototypes, typedefs used in all the\r
23 //                                supported compression techniques used in JAMPAK Ver x.x\r
24 //\r
25 //\r
26 \r
27 \r
28 \r
29 \r
30 //==========================================================================\r
31 //\r
32 //                                                              PARAMETER PASSING TYPES\r
33 //\r
34 //\r
35         // SOURCE PARAMS (LO BYTE)\r
36 \r
37 #define SRC_FILE                                (0x0001)                        // GE Buffered IO\r
38 #define SRC_FFILE                               (0x0002)                        // Stdio File IO (fwrite etc.)\r
39 #define SRC_MEM                         (0x0004)                        // Std void ptr (alloc etc)\r
40 #define SRC_BFILE                               (0x0008)                                // Buffered File I/O\r
41 \r
42 #define SRC_TYPES                       (SRC_FILE | SRC_FFILE | SRC_MEM | SRC_BFILE)\r
43 \r
44         // DESTINATION PARAMS (HI BYTE)\r
45 \r
46 #define DEST_FILE                               (0x0100)                        // GE Buffered IO\r
47 #define DEST_FFILE                      (0x0200)                        // Stdio File IO (fwrite etc.)\r
48 #define DEST_MEM                                (0x0400)                        // Std void ptr (alloc etc)\r
49 #define DEST_IMEM                               (0x0800)                        // ID Memory alloc\r
50 \r
51 #define DEST_TYPES                      (DEST_FILE | DEST_FFILE | DEST_MEM | DEST_IMEM)\r
52 \r
53 \r
54 \r
55 //=========================================================================\r
56 //\r
57 //                                                              FILE CHUNK IDs\r
58 //\r
59 // NOTE: The only reason for changing from COMP to CMP1 and having multi\r
60 //                      comp header structs is for downward compatablity.\r
61 //\r
62 \r
63 #define COMP                                    ("COMP")                // Comp type is ct_LZW ALWAYS!\r
64 #define CMP1                                    ("CMP1")                // Comp type is determined in header.\r
65 \r
66 \r
67 //\r
68 //      COMPRESSION TYPES\r
69 //\r
70 typedef enum ct_TYPES\r
71 {\r
72                 ct_NONE = 0,                                            // No compression - Just data..Rarely used!\r
73                 ct_LZW,                                                         // LZW data compression\r
74                 ct_LZH,\r
75 \r
76 } ct_TYPES;\r
77 \r
78 //\r
79 //      FILE CHUNK HEADER FORMATS\r
80 //\r
81 \r
82 struct COMPStruct\r
83 {\r
84         unsigned long DecompLen;\r
85 \r
86 };\r
87 \r
88 \r
89 struct CMP1Header\r
90 {\r
91         unsigned CompType;                                      // SEE: ct_TYPES above for list of pos.\r
92         unsigned long OrginalLen;                       // Orginal FileLength of compressed Data.\r
93         unsigned long CompressLen;                      // Length of data after compression (A MUST for LZHUFF!)\r
94 };\r
95 \r
96 \r
97 \r
98 //---------------------------------------------------------------------------\r
99 //\r
100 //                                                              FUNCTION PROTOTYPEING\r
101 //\r
102 //---------------------------------------------------------------------------\r
103 \r
104 char WritePtr(long outfile, unsigned char data, unsigned PtrType);\r
105 int ReadPtr(long infile, unsigned PtrType);\r
106 \r
107 \r