// compiles and runs bytecode struct variable *sys_interpret(struct context *context) { struct variable *value = (struct variable*)stack_pop(context->operand_stack); struct variable *script = (struct variable*)array_get(value->list.ordered, 1); interpret_string(context, script->str); return NULL; }
// run a script, using the same context struct context *interpret_string_with(struct context *context, struct byte_array *script) { if (NULL == context) { context = context_new(NULL, true, true); } interpret_string(context, script); return context; }
// run a file, using the same context struct context *interpret_file_with(struct context *context, struct byte_array *path) { if (NULL == context) { context = context_new(NULL, true, true); } struct byte_array *script = read_file(path, 0, 0); assert_message(NULL != script, "file not found: %s\n", byte_array_to_string(path)); interpret_string(context, script); return context; }