agssim: implement ptrstack
[rofl0r-agsutils.git] / Script_internal.h
blobe626413d91c8b7813e1e40deaa44f10fd4de5324
1 #ifndef SCRIPT_INTERNAL_H
2 #define SCRIPT_INTERNAL_H
4 #include <stddef.h>
6 struct strings {
7 size_t count;
8 char ** strings;
9 char* data;
12 struct importlist {
13 char** names;
16 #define EXPORT_FUNCTION 1
17 #define EXPORT_DATA 2
18 struct function_export {
19 char* fn;
20 unsigned instr;
21 unsigned type;
24 #define FIXUP_GLOBALDATA 1 // code[fixup] += &globaldata[0]
25 #define FIXUP_FUNCTION 2 // code[fixup] += &code[0]
26 #define FIXUP_STRING 3 // code[fixup] += &strings[0]
27 #define FIXUP_IMPORT 4 // code[fixup] = &imported_thing[code[fixup]]
28 #define FIXUP_DATADATA 5 // globaldata[fixup] += &globaldata[0]
29 #define FIXUP_STACK 6 // code[fixup] += &stack[0]
30 #define FIXUP_MAX FIXUP_STACK
31 struct fixup_data {
32 unsigned count[FIXUP_MAX+1];
33 unsigned *codeindex;
34 unsigned *codeindex_per[FIXUP_MAX+1];
35 unsigned char *types;
38 struct varinfo {size_t numrefs; unsigned varsize;};
40 #endif