equal
deleted
inserted
replaced
1 #ifndef SAVELOAD_H |
1 #ifndef SAVELOAD_H |
2 #define SAVELOAD_H |
2 #define SAVELOAD_H |
|
3 |
|
4 #include <setjmp.h> |
3 |
5 |
4 typedef void ChunkSaveLoadProc(); |
6 typedef void ChunkSaveLoadProc(); |
5 typedef void AutolengthProc(void *arg); |
7 typedef void AutolengthProc(void *arg); |
6 |
8 |
7 typedef struct SaveLoadGlobVarList { |
9 typedef struct SaveLoadGlobVarList { |
20 } ChunkHandler; |
22 } ChunkHandler; |
21 |
23 |
22 typedef struct { |
24 typedef struct { |
23 byte null; |
25 byte null; |
24 } NullStruct; |
26 } NullStruct; |
|
27 |
|
28 typedef void WriterProc(uint len); |
|
29 typedef uint ReaderProc(); |
|
30 |
|
31 typedef uint ReferenceToIntProc(void *v, uint t); |
|
32 typedef void *IntToReferenceProc(uint r, uint t); |
|
33 |
|
34 typedef struct { |
|
35 bool save; |
|
36 byte need_length; |
|
37 byte block_mode; |
|
38 bool error; |
|
39 byte version; |
|
40 |
|
41 int obj_len; |
|
42 int array_index, last_array_index; |
|
43 |
|
44 uint32 offs_base; |
|
45 |
|
46 WriterProc *write_bytes; |
|
47 ReaderProc *read_bytes; |
|
48 |
|
49 ReferenceToIntProc *ref_to_int_proc; |
|
50 IntToReferenceProc *int_to_ref_proc; |
|
51 |
|
52 const ChunkHandler * const * chs; |
|
53 const byte * const *includes; |
|
54 |
|
55 byte *bufp, *bufe; |
|
56 |
|
57 int tmp; |
|
58 |
|
59 // these 3 may be used by compressor/decompressors. |
|
60 byte *buf; // pointer and size to read/write, initialized by init |
|
61 uint bufsize; |
|
62 FILE *fh; |
|
63 |
|
64 void (*excpt_uninit)(); |
|
65 const char *excpt_msg; |
|
66 jmp_buf excpt; // used to jump to "exception handler" |
|
67 } SaverLoader; |
|
68 |
|
69 extern SaverLoader _sl; |
25 |
70 |
26 enum { |
71 enum { |
27 REF_SCHEDULE = 0, |
72 REF_SCHEDULE = 0, |
28 REF_VEHICLE = 1, |
73 REF_VEHICLE = 1, |
29 REF_STATION = 2, |
74 REF_STATION = 2, |