void expr_mutate_str( expr *e, char *s, size_t len, int wide, where *w, symtable *stab) { expr_mutate_wrapper(e, str); e->bits.strlit.lit_at.lit = strings_lookup( &symtab_global(stab)->literals, s, len, wide); memcpy_safe(&e->bits.strlit.lit_at.where, w); memcpy_safe(&e->where, w); }
void vm_run_function(vm_t *vm, const char *function_name) { uint8_t function_id = strings_lookup(vm->function_names, function_name); if (function_id != 0) { uint8_t call_code[6] = { OP_CALL, 0, function_id, 0, OP_EXIT, 0 }; memcpy(&vm->code[vm->code_size], &call_code, 6); vm->ip = vm->code_size; vm->code_size += 6; vm_run(vm); } else { printf("Function %s not found\n", function_name); exit(1); } }