int glkunix_startup_code(glkunix_startup_t *data) { myargc = data->argc; myargv = data->argv; os_init_setup (); os_process_arguments (myargc, myargv); init_buffer (); init_err (); init_memory (); init_proc (); init_sound (); init_text (); os_init_screen (); init_undo (); z_restart (); return TRUE; }
HRESULT init_global(script_ctx_t *ctx) { HRESULT hres; ctx->global_desc.ctx = ctx; ctx->global_desc.builtin_prop_cnt = sizeof(global_props)/sizeof(*global_props); ctx->global_desc.builtin_props = global_props; hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo); if(FAILED(hres)) return hres; hres = create_vbdisp(&ctx->global_desc, &ctx->global_obj); if(FAILED(hres)) return hres; ctx->script_desc.ctx = ctx; hres = create_vbdisp(&ctx->script_desc, &ctx->script_obj); if(FAILED(hres)) return hres; return init_err(ctx); }
int cdecl frotz_main (void) { os_init_setup (); init_buffer (); init_err (); init_memory (); init_process (); init_sound (); os_init_screen (); init_undo (); z_restart (); interpret (); script_close (); record_close (); replay_close (); reset_memory (); os_reset_screen (); return 0; }/* main */
void psvc_psr_plugin_init(void) { char *funcname = "psvc_plugin_psr_init"; int32_t i; int err; boolean_t present; /* * So the volatile read/write routines can retrieve data from * psvc or picl */ err = psvc_init(&hdlp); if (err != 0) { init_err(PSVC_INIT_ERR, funcname, strerror(errno)); } /* * Remove nodes whose devices aren't present from the picl tree. */ for (i = 0; i < psvc_hdl.obj_count; ++i) { picl_psvc_t *objp; uint64_t features; objp = &psvc_hdl.objects[i]; err = psvc_get_attr(hdlp, objp->name, PSVC_PRESENCE_ATTR, &present); if (err != PSVC_SUCCESS) continue; err = psvc_get_attr(hdlp, objp->name, PSVC_FEATURES_ATTR, &features); if (err != PSVC_SUCCESS) continue; if ((features & (PSVC_DEV_HOTPLUG | PSVC_DEV_OPTION)) && (present == PSVC_ABSENT)) { err = ptree_delete_node(objp->node); if (err != 0) { init_err(PTREE_DELETE_NODE_ERR, funcname, picl_strerror(err)); return; } } } /* * Remove PICL device nodes if their /devices file isn't present or * if the device file is present but the open returns ENXIO * which indicates that the node file doesn't represent a device * tree node and is probably a relic from some previous boot config */ for (i = 0; i < DEV_PR_COUNT; ++i) { picl_nodehdl_t dev_pr_node; int fd; fd = open(dev_pr_info[i].file, O_RDONLY); if (fd != -1) { close(fd); continue; } if ((errno != ENOENT) && (errno != ENXIO)) continue; err = ptree_get_node_by_path(dev_pr_info[i].path, &dev_pr_node); if (err != 0) { syslog(LOG_ERR, "Bad path: %s", dev_pr_info[i].path); init_err(PTREE_GET_NODE_ERR, funcname, picl_strerror(err)); return; } err = ptree_delete_node(dev_pr_node); if (err != 0) { init_err(PTREE_DELETE_NODE_ERR, funcname, picl_strerror(err)); return; } } free(psvc_hdl.objects); }