2 // $Id: git.h,v 1.32 2004/12/22 12:40:07 iain Exp $
15 // Version number formatting
17 #define GIT_VERSION_NUM (GIT_MAJOR << 16) \
22 #define _str(s) _str2(s)
25 #define GIT_VERSION_STR \
26 _str(GIT_MAJOR) "." _str(GIT_MINOR)
28 #define GIT_VERSION_STR \
29 _str(GIT_MAJOR) "." _str(GIT_MINOR) "." _str(GIT_PATCH)
34 extern void gitWithStream (strid_t stream,
38 extern void git (const git_uint8 * game,
43 extern void fatalError (const char *);
61 GESTALT_SPEC_VERSION = 0,
62 GESTALT_TERP_VERSION = 1,
63 GESTALT_RESIZEMEM = 2,
65 GESTALT_IO_SYSTEM = 4,
69 GESTALT_MALLOC_HEAP = 8,
70 GESTALT_ACCELERATION = 9,
71 GESTALT_ACCELFUNC = 10,
74 // This special selector returns 1 if the cache control
75 // opcodes 'git_setcacheram' and 'git_prunecache' are available.
77 GESTALT_GIT_CACHE_CONTROL = 0x7940
80 extern git_uint32 gestalt (enum GestaltSelector sel, git_uint32 param);
84 extern void parseInstruction (git_uint32 * pc, int * done);
88 typedef enum { reg_L1, reg_L2, reg_L3, reg_L4, reg_L5, reg_L6, reg_L7 } LoadReg;
89 typedef enum { reg_S1, reg_S2 } StoreReg;
90 typedef enum { size32, size16, size8 } TransferSize;
92 extern git_uint32 parseLoad (git_uint32 * pc, LoadReg reg, int mode, TransferSize, git_sint32 * constVal);
93 extern void parseStore (git_uint32 * pc, StoreReg reg, int mode, TransferSize);
95 extern void parseCallStub (git_uint32 * pc, int mode);
96 extern void parseSaveStub (git_uint32 * pc, int mode);
97 extern void parseUndoStub (git_uint32 * pc, int mode);
98 extern void parseCatchStub (git_uint32 * pc, int * modes);
102 #include "compiler.h"
106 extern void resetPeepholeOptimiser();
107 extern void emitCode (Label);
111 #ifdef USE_DIRECT_THREADING
112 extern Opcode* gOpcodeTable;
113 # define labelToOpcode(label) (gOpcodeTable[label])
115 # define labelToOpcode(label) label
118 extern git_sint32* gStackPointer;
120 extern void startProgram (size_t cacheSize, enum IOMode ioMode);
124 extern int git_init_dispatch();
125 extern glui32 git_perform_glk(glui32 funcnum, glui32 numargs, glui32 *arglist);
126 extern strid_t git_find_stream_by_id(glui32 id);
130 extern glui32 git_binary_search(glui32 key, glui32 keysize,
131 glui32 start, glui32 structsize, glui32 numstructs,
132 glui32 keyoffset, glui32 options);
134 extern glui32 git_linked_search(glui32 key, glui32 keysize,
135 glui32 start, glui32 keyoffset, glui32 nextoffset, glui32 options);
137 extern glui32 git_linear_search(glui32 key, glui32 keysize,
138 glui32 start, glui32 structsize, glui32 numstructs,
139 glui32 keyoffset, glui32 options);
143 extern git_sint32 saveToFile (git_sint32* base, git_sint32 * sp, git_sint32 file);
144 extern git_sint32 restoreFromFile (git_sint32* base, git_sint32 file,
145 git_uint32 protectPos, git_uint32 protectSize);
149 extern void initUndo (git_uint32 size);
150 extern void resetUndo ();
151 extern void shutdownUndo ();
153 extern int saveUndo (git_sint32* base, git_sint32* sp);
154 extern int restoreUndo (git_sint32* base,
155 git_uint32 protectPos, git_uint32 protectSize);
159 extern glui32 heap_get_start ();
160 extern glui32 heap_alloc (glui32 len);
161 extern void heap_free (glui32 addr);
162 extern int heap_is_active ();
163 extern void heap_clear ();
164 extern int heap_get_summary (glui32 *valcount, glui32 **summary);
165 extern int heap_apply_summary (glui32 valcount, glui32 *summary);
169 typedef glui32 (*acceleration_func)(glui32 argc, glui32 *argv);
170 extern void init_accel ();
171 extern acceleration_func accel_find_func (glui32 index);
172 extern acceleration_func accel_get_func (glui32 addr);
173 extern void accel_set_func (glui32 index, glui32 addr);
174 extern void accel_set_param (glui32 index, glui32 val);