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