scriptreader.h

changeset 48
976c57f153b3
parent 44
6bbaebc472b5
child 50
2e333a3ca49a
equal deleted inserted replaced
47:d84d82213137 48:976c57f153b3
46 #include "objwriter.h" 46 #include "objwriter.h"
47 #include "commands.h" 47 #include "commands.h"
48 48
49 #define MAX_FILESTACK 8 49 #define MAX_FILESTACK 8
50 #define MAX_STRUCTSTACK 32 50 #define MAX_STRUCTSTACK 32
51 #define MAX_CASE 64
51 52
52 class ScriptVar; 53 class ScriptVar;
53 54
54 // ============================================================================ 55 // ============================================================================
55 // Meta-data about blocks 56 // Meta-data about blocks
56 struct BlockInformation { 57 struct BlockInformation {
57 unsigned int mark1; 58 unsigned int mark1;
58 unsigned int mark2; 59 unsigned int mark2;
59 unsigned int type; 60 unsigned int type;
60 DataBuffer* buffer1; 61 DataBuffer* buffer1;
62
63 // switch-related stuff
64 // Which case are we at?
65 short casecursor;
66
67 // Marks to case-blocks
68 int casemarks[MAX_CASE];
69
70 // actual case blocks
71 DataBuffer* casebuffers[MAX_CASE];
72
73 // What is the current buffer of the block?
74 DataBuffer* recordbuffer;
61 }; 75 };
62 76
63 // ============================================================================ 77 // ============================================================================
64 // The script reader reads the script, parses it and tells the object writer 78 // The script reader reads the script, parses it and tells the object writer
65 // the bytecode it needs to write to file. 79 // the bytecode it needs to write to file.
168 enum { 182 enum {
169 BLOCKTYPE_IF, 183 BLOCKTYPE_IF,
170 BLOCKTYPE_WHILE, 184 BLOCKTYPE_WHILE,
171 BLOCKTYPE_FOR, 185 BLOCKTYPE_FOR,
172 BLOCKTYPE_DO, 186 BLOCKTYPE_DO,
187 BLOCKTYPE_SWITCH,
173 }; 188 };
174 189
175 #endif // __SCRIPTREADER_H__ 190 #endif // __SCRIPTREADER_H__

mercurial