File: dd.h

package info (click to toggle)
macutils 2.0b3-17
  • links: PTS
  • area: main
  • in suites: bookworm, trixie
  • size: 1,256 kB
  • sloc: ansic: 12,737; makefile: 661
file content (125 lines) | stat: -rwxr-xr-x 3,103 bytes parent folder | download | duplicates (2)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#define	MAGIC1		"DDAR"
#define	MAGIC2		"\253\315\000\124"

/* Initial header */
#define ARCHHDRCRC	 76
#define ARCHHDRSIZE	 78

/* File headers */
#define D_MAGIC		  0
#define D_FILL1		  4
#define D_FNAME		  8
#define D_ISDIR		 72
#define D_ENDDIR	 73
#define D_DATALENGTH	 74
#define D_RSRCLENGTH	 78
#define D_CTIME		 82
#define D_MTIME		 86
#define D_FTYPE		 90
#define D_CREATOR	 94
#define D_FNDRFLAGS	 98
#define D_FILL2		100
#define D_DATACRC	118
#define D_RSRCCRC	120
#define D_HDRCRC	122
#define FILEHDRSIZE	124

/* Compressed file header */
#define	C_MAGIC		 0
#define	C_DATALENGTH	 4
#define	C_DATACLENGTH	 8
#define	C_RSRCLENGTH	12
#define	C_RSRCCLENGTH	16
#define	C_DATAMETHOD	20
#define	C_RSRCMETHOD	21
#define	C_INFO1		22
#define	C_MTIME		24
#define	C_CTIME		28
#define	C_FTYPE		32
#define	C_CREATOR	36
#define	C_FNDRFLAGS	40
#define	C_FILL1		42
#define	C_DATACRC	48
#define	C_RSRCCRC	50
#define	C_INFO2		52
#define	C_DATAINFO	54
#define	C_RSRCINFO	56
#define	C_FILL2		58
#define C_DATACRC2	78
#define C_RSRCCRC2	80
#define	C_HDRCRC	82
#define	CFILEHDRSIZE	84

typedef long OSType;

struct fileHdr {		/* 124 bytes */
	unsigned char	magic[4];	/* "DDAR" */
	unsigned char	fill1[4];	/* ??? */
	unsigned char	fName[64];	/* a STR63 */
	unsigned char	isdir;		/* starts a directory? */
	unsigned char	enddir;		/* terminates a directory? */
	unsigned long	dataLength;	/* lengths */
	unsigned long	rsrcLength;
	unsigned long	creationDate;
	unsigned long	modDate;
	OSType	fType;			/* file type */
	OSType	fCreator;		/* er... */
	unsigned short FndrFlags;	/* copy of Finder flags.  For our
						purposes, we can clear:
						busy,onDesk */
	unsigned char	fill2[18];	/* ??? */
	unsigned short	datacrc;	/* checksum */
	unsigned short	rsrccrc;
	unsigned short	hdrcrc;		/* true crc */
};

struct fileCHdr {		/* 84 bytes */
	unsigned char	magic[4];	/* "\253\315\000\124" */
	unsigned long	dataLength;	/* lengths */
	unsigned long	dataCLength;
	unsigned long	rsrcLength;
	unsigned long	rsrcCLength;
	unsigned char	datamethod;	/* compression method used */
	unsigned char	rsrcmethod;
	unsigned char	info1;		/* flags ??? */
	unsigned char	fill3;
	unsigned long	modDate;
	unsigned long	creationDate;
	OSType	fType;			/* file type */
	OSType	fCreator;		/* er... */
	unsigned short FndrFlags;	/* copy of Finder flags.  For our
						purposes, we can clear:
						busy,onDesk */
	unsigned char	fill1[6];	/* ??? */
	unsigned short	datacrc;	/* checksum */
	unsigned short	rsrccrc;
	unsigned char	info2;		/* flags ??? */
	unsigned char	fill4;
	unsigned short	datainfo;	/* ??? */
	unsigned short	rsrcinfo;	/* ??? */
	unsigned char	fill2[20];	/* ??? */
	unsigned short	datacrc2;	/* other checksum */
	unsigned short	rsrccrc2;
	unsigned short	hdrcrc;		/* true crc */
};

#define	DD_FILE	0
#define	DD_COPY	1
#define	DD_SDIR	2
#define	DD_EDIR	3
#define	DD_IVAL	4

/* Methods used */
#define	nocomp		0
#define lzc		1
#define method2		2
#define rle		3
#define huffman		4
#define method5		5
#define	method6		6
#define lzss		7
#define	cpt_compat	8
#define	method9		9

#define	ESC		(char)0x144	/* Repeat packing escape */