#ifndef AS_DCPU16_H_PTFNJB09 #define AS_DCPU16_H_PTFNJB09 #include "dcpu16.h" struct instruction_ { char *label; /* set if a label points here */ char *opcode; /* tokenized instruction text */ struct operand_ *operands; /* list of operands */ unsigned int ready : 1; /* bytecode computed? */ unsigned int length; /* number of words of bytecode */ DCPU16_WORD instr_words[]; }; struct operand_ { struct operand_ *next; char *operand; /* tokenized operand text */ }; #define IL_SIZE(entries) (((entries) * sizeof(struct instruction_ *)) + sizeof(struct instruction_list_)) struct instruction_list_ { size_t allocated; size_t entries; struct instruction_ *instr[]; }; /* note label table holds its own structs, not pointers like instruction list */ struct label_ { char *label; /* name of label */ struct instruction_ **instr; /* pointer into instruction list table */ unsigned int ready : 1; /* do we know where this label is yet? */ DCPU16_WORD addr; }; #define LL_SIZE(entries) (((entries) * sizeof(struct label_ *)) + sizeof(struct label_list_)) struct label_list_ { size_t allocated; size_t entries; struct label_ label[]; }; #endif /* AS_DCPU16_H_PTFNJB09 */