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,
73 // This special selector returns 1 if the cache control
74 // opcodes 'git_setcacheram' and 'git_prunecache' are available.
76 GESTALT_GIT_CACHE_CONTROL = 0x7940
79 extern git_uint32 gestalt (enum GestaltSelector sel, git_uint32 param);
83 extern void parseInstruction (git_uint32 * pc, int * done);
87 typedef enum { reg_L1, reg_L2, reg_L3, reg_L4, reg_L5, reg_L6, reg_L7 } LoadReg;
88 typedef enum { reg_S1, reg_S2 } StoreReg;
89 typedef enum { size32, size16, size8 } TransferSize;
91 extern git_uint32 parseLoad (git_uint32 * pc, LoadReg reg, int mode, TransferSize, git_sint32 * constVal);
92 extern void parseStore (git_uint32 * pc, StoreReg reg, int mode, TransferSize);
94 extern void parseCallStub (git_uint32 * pc, int mode);
95 extern void parseCatchStub (git_uint32 * pc, int mode);
96 extern void parseSaveStub (git_uint32 * pc, int mode);
97 extern void parseUndoStub (git_uint32 * pc, int mode);
101 #include "compiler.h"
105 extern void resetPeepholeOptimiser();
106 extern void emitCode (Label);
110 #ifdef USE_DIRECT_THREADING
111 extern Opcode* gOpcodeTable;
112 # define labelToOpcode(label) (gOpcodeTable[label])
114 # define labelToOpcode(label) label
117 extern git_sint32* gStackPointer;
119 extern void startProgram (size_t cacheSize, enum IOMode ioMode);
123 extern int git_init_dispatch();
124 extern glui32 git_perform_glk(glui32 funcnum, glui32 numargs, glui32 *arglist);
125 extern strid_t git_find_stream_by_id(glui32 id);
129 extern glui32 git_binary_search(glui32 key, glui32 keysize,
130 glui32 start, glui32 structsize, glui32 numstructs,
131 glui32 keyoffset, glui32 options);
133 extern glui32 git_linked_search(glui32 key, glui32 keysize,
134 glui32 start, glui32 keyoffset, glui32 nextoffset, glui32 options);
136 extern glui32 git_linear_search(glui32 key, glui32 keysize,
137 glui32 start, glui32 structsize, glui32 numstructs,
138 glui32 keyoffset, glui32 options);
142 extern git_sint32 saveToFile (git_sint32* base, git_sint32 * sp, git_sint32 file);
143 extern git_sint32 restoreFromFile (git_sint32* base, git_sint32 file,
144 git_uint32 protectPos, git_uint32 protectSize);
148 extern void initUndo (git_uint32 size);
149 extern void resetUndo ();
150 extern void shutdownUndo ();
152 extern int saveUndo (git_sint32* base, git_sint32* sp);
153 extern int restoreUndo (git_sint32* base,
154 git_uint32 protectPos, git_uint32 protectSize);
158 extern glui32 heap_get_start ();
159 extern glui32 heap_alloc (glui32 len);
160 extern void heap_free (glui32 addr);
161 extern int heap_is_active ();
162 extern void heap_clear ();
163 extern int heap_get_summary (glui32 *valcount, glui32 **summary);
164 extern int heap_apply_summary (glui32 valcount, glui32 *summary);
168 typedef glui32 (*acceleration_func)(glui32 argc, glui32 *argv);
169 extern void init_accel ();
170 extern acceleration_func accel_find_func (glui32 index);
171 extern acceleration_func accel_get_func (glui32 addr);
172 extern void accel_set_func (glui32 index, glui32 addr);
173 extern void accel_set_param (glui32 index, glui32 val);