code_t *code_init() { static lex_ctx_t empty_ctx = {0, 0, 0}; static prog_section_function_t empty_function = {0,0,0,0,0,0,0,{0,0,0,0,0,0,0,0}}; static prog_section_statement_t empty_statement = {0,{0},{0},{0}}; static prog_section_def_t empty_def = {0, 0, 0}; code_t *code = (code_t*)mem_a(sizeof(code_t)); int i = 0; memset(code, 0, sizeof(code_t)); code->entfields = 0; code->string_cache = util_htnew(OPTS_OPTIMIZATION(OPTIM_OVERLAP_STRINGS) ? 0x100 : 1024); /* * The way progs.dat is suppose to work is odd, there needs to be * some null (empty) statements, functions, and 28 globals */ for(; i < 28; i++) vec_push(code->globals, 0); vec_push(code->chars, '\0'); vec_push(code->functions, empty_function); code_push_statement(code, &empty_statement, empty_ctx); vec_push(code->defs, empty_def); vec_push(code->fields, empty_def); return code; }
code_t::code_t() { static lex_ctx_t empty_ctx = {0, 0, 0}; static prog_section_function_t empty_function = {0,0,0,0,0,0,0,{0,0,0,0,0,0,0,0}}; static prog_section_statement_t empty_statement = {0,{0},{0},{0}}; static prog_section_def_t empty_def = {0, 0, 0}; string_cache = util_htnew(OPTS_OPTIMIZATION(OPTIM_OVERLAP_STRINGS) ? 0x100 : 1024); // The way progs.dat is suppose to work is odd, there needs to be // some null (empty) statements, functions, and 28 globals globals.insert(globals.begin(), 28, 0); chars.push_back('\0'); functions.push_back(empty_function); code_push_statement(this, &empty_statement, empty_ctx); defs.push_back(empty_def); fields.push_back(empty_def); }