static Parrot_PMC loader_get(Parrot_PMC interp_pmc, char * path) { Parrot_String path_str; Parrot_PMC bytecode_pmc; Parrot_api_string_import_ascii(interp_pmc, path, &path_str); if(Parrot_api_load_bytecode_file(interp_pmc, path_str, &bytecode_pmc)) return bytecode_pmc; return NULL; /* crash and crash hard! */ }
PARROT_CANNOT_RETURN_NULL static PMC * get_class_pmc(Parrot_PMC interp, ARGIN(const char *name)) { Parrot_String name_s = NULL; Parrot_PMC name_pmc = NULL; Parrot_PMC class_pmc = NULL; if (!(Parrot_api_string_import_ascii(interp, name, &name_s) && Parrot_api_pmc_box_string(interp, name_s, &name_pmc) && Parrot_api_pmc_get_class(interp, name_pmc, &class_pmc))) show_last_error_and_exit(interp); return class_pmc; }
PARROT_CANNOT_RETURN_NULL static void get_imcc_compiler_pmc(Parrot_PMC interp, Parrot_PMC class_pmc, Parrot_Int is_pasm) { Parrot_PMC is_pasm_pmc = NULL; Parrot_PMC compiler_pmc = NULL; const char *name = is_pasm ? "PASM" : "PIR"; Parrot_String name_s = NULL; if (!Parrot_api_pmc_box_integer(interp, is_pasm, &is_pasm_pmc)) show_last_error_and_exit(interp); if (!Parrot_api_pmc_new_from_class(interp, class_pmc, is_pasm_pmc, &compiler_pmc)) show_last_error_and_exit(interp); if (!(Parrot_api_string_import_ascii(interp, name, &name_s) && Parrot_api_set_compiler(interp, name_s, compiler_pmc))) show_last_error_and_exit(interp); }