bool package_init(pass_opt_t* opt) { if(!codegen_init(opt)) return false; // package_add_paths for command line paths has already been done. Here, we // append the paths from an optional environment variable, and then the paths // that are relative to the compiler location on disk. package_add_paths(getenv("PONYPATH")); add_exec_dir(); // Convert all the safe packages to their full paths. strlist_t* full_safe = NULL; while(safe != NULL) { const char* path; safe = strlist_pop(safe, &path); // Lookup (and hence normalise) path. path = find_path(NULL, path, NULL); if(path == NULL) { strlist_free(full_safe); return false; } full_safe = strlist_push(full_safe, path); } safe = full_safe; return true; }
bool package_init(pass_opt_t* opt) { if(!codegen_init(opt)) return false; package_add_paths(getenv("PONYPATH")); add_exec_dir(); // Convert all the safe packages to their full paths. strlist_t* full_safe = NULL; while(safe != NULL) { const char* path; safe = strlist_pop(safe, &path); // Lookup (and hence normalise) path. path = find_path(NULL, path); if(path == NULL) { strlist_free(full_safe); return false; } full_safe = strlist_push(full_safe, path); } safe = full_safe; return true; }
void codegen_root(Ast root) { emit_comment("-> beginning of TM code"); codegen_init(); // jmp to main 改成 call main 后面跟 HALT emit_comment("skip 5: call main, waiting for addr of main()"); int call_main_loc = emit_skip(5); emit_RO("HALT", ignore, ignore, ignore, "stop program"); codegen_prelude_input(); codegen_prelude_output(); codegen_stmt(root); // backpatch add of main emit_backup(call_main_loc); pseudo_call(lookup_funinfo("main")); emit_restore(); emit_comment("<- end of TM code"); }
void initpc() { char *p; // allegro_init(); get_executable_name(pcempath,511); pclog("executable_name = %s\n", pcempath); p=get_filename(pcempath); *p=0; pclog("path = %s\n", pcempath); fdd_init(); keyboard_init(); mouse_init(); joystick_init(); midi_init(); loadconfig(NULL); pclog("Config loaded\n"); loadfont("mda.rom", 0, cga_fontdat, cga_fontdatm); loadfont("roms/pc1512/40078.ic127", 0, pc1512_fontdat, pc1512_fontdatm); loadfont("roms/pc200/40109.bin", 0, pc200_fontdat, pc200_fontdatm); codegen_init(); cpuspeed2=(AT)?2:1; // cpuspeed2=cpuspeed; atfullspeed=0; device_init(); initvideo(); mem_init(); loadbios(); mem_add_bios(); timer_reset(); sound_reset(); fdc_init(); // #ifdef USE_NETWORKING vlan_reset(); //NETWORK network_card_init(network_card_current); // #endif loaddisc(0,discfns[0]); loaddisc(1,discfns[1]); //loadfont(); loadnvr(); sound_init(); resetide(); #if __unix if (cdrom_drive == -1) cdrom_null_open(cdrom_drive); else #endif ioctl_open(cdrom_drive); pit_reset(); /* if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed(); ali1429_reset(); // CPUID=(is486 && (cpuspeed==7 || cpuspeed>=9)); // pclog("Init - CPUID %i %i\n",CPUID,cpuspeed); shadowbios=0; #if __unix if (cdrom_drive == -1) cdrom_null_reset(); else #endif ioctl_reset(); }