-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathNewtonPackage.h
49 lines (38 loc) · 1.09 KB
/
NewtonPackage.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
/*
File: NewtonPackage.h
Abstract: An object that loads a Newton package file containing 32-bit big-endian Refs
and presents part entries as 64-bit platform-endian Refs.
Written by: Newton Research Group, 2015.
*/
#if !defined(__NEWTONPACKAGE_H)
#define __NEWTONPACKAGE_H 1
#include <stdio.h>
#include "PackageParts.h"
/* -----------------------------------------------------------------------------
N e w t o n P a c k a g e
----------------------------------------------------------------------------- */
struct MemAllocation
{
char * data;
size_t size;
};
class NewtonPackage
{
public:
NewtonPackage(const char * inPkgPath);
NewtonPackage(void * inPkgData);
~NewtonPackage();
PackageDirectory * directory(void);
const PartEntry * partEntry(ArrayIndex inPartNo);
Ref partRef(ArrayIndex inPartNo);
MemAllocation * partPkgData(ArrayIndex inPartNo);
private:
FILE * pkgFile;
void * pkgMem;
PackageDirectory * pkgDir;
RelocationHeader pkgRelo;
char * relocationData;
MemAllocation * pkgPartData;
MemAllocation part0Data;
};
#endif /* __NEWTONPACKAGE_H */