void queue_package(pkgstate* state, stringptr* packagename, jobtype jt, int force) { if(!packagename->size) return; sblist* queue = (jt == JT_DOWNLOAD) ? state->dl_queue : state->build_queue; if(is_in_queue(packagename, queue)) return; if(!force && is_installed(state->installed_packages, packagename)) { ulz_fprintf(1, "package %s is already installed, skipping %s\n", packagename->ptr, jt == JT_DOWNLOAD ? "download" : "build"); return; } uint32_t hash = stringptr_hash(packagename); pkgdata* pkg = packagelist_get(state->package_list, packagename, hash); unsigned i; if(!pkg) { pkg = packagelist_add(state->package_list, packagename, hash); get_package_contents(&state->cfg, packagename, pkg); } for(i = 0; i < stringptrlist_getsize(pkg->deps); i++) queue_package(state, stringptrlist_get(pkg->deps, i), jt, 0); // omg recursion if( // if sizeof mirrors is 0, it is a meta package (jt == JT_DOWNLOAD && stringptrlist_getsize(pkg->mirrors) && !has_tarball(&state->cfg, pkg)) || (jt == JT_BUILD && stringptrlist_getsize(pkg->buildscript)) ) { add_queue(packagename, queue); } }
void message_handler_t::install_implementation(HWND window, const char* proc_name, WNDPROC win_proc) { if (is_installed()) throw std::runtime_error("Message handler already bound to a target."); if (NULL != get_handler_property(window, proc_name)) throw std::runtime_error(std::string("Handler already installed with name ") + proc_name); property_m = new property_t; property_m->handler_m = this; #if defined(_WIN64) typedef LONG_PTR windows_long_t; #else typedef LONG windows_long_t; #endif #if ADOBE_PLATFORM_WIN // because it might be cygwin (eberdahl) #pragma warning(push) #pragma warning(disable: 4311) // suppress warning for casting WNDPROC to LONG #pragma warning(disable: 4312) // suppress warning for casting LONG to WNDPROC #endif property_m->next_proc_m = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(window, GWLP_WNDPROC, reinterpret_cast<windows_long_t>(win_proc))); #if ADOBE_PLATFORM_WIN // because it might be cygwin (eberdahl) #pragma warning(pop) #endif set_handler_property(window, proc_name, property_m); }
void message_handler_t::uninstall() { if (!is_installed()) return; property_m->handler_m = NULL; property_m = NULL; }
// checks if all dependencies are installed // then checks if the tarball is downloaded // then checks if its either a metapackage or doesnt require a tarball. int has_all_deps(pkgstate* state, pkgdata* item) { size_t i; pkg_exec* dlitem; for(i = 0; i < stringptrlist_getsize(item->deps); i++) if(!is_installed(state->installed_packages, stringptrlist_get(item->deps, i))) return 0; for(i = 0; i < sblist_getsize(state->dl_queue); i++) { dlitem = sblist_get(state->dl_queue, i); if(EQ(dlitem->name, item->name)) { return (dlitem->pid == 0); //download finished? } } return (!stringptrlist_getsize(item->mirrors) || has_tarball(&state->cfg, item)); }
pwr_tStatus Lng::set( lng_eLanguage language) { if ( lang == language) return 1; if ( language == lng_eLanguage_en_US) { lang = language; unload(); } else { if ( !is_installed( language)) return 0; lang = language; read(); } setlocale( LC_ALL, lang_to_locale( lang)); setlocale( LC_NUMERIC, "POSIX"); setlocale( LC_TIME, "en_US"); return 1; }
/* ins_app */ WORD ins_app(BYTE *pfname, ANODE *pa) { LONG tree; ANODE *newpa; BYTE pname[12]; BYTE ntypes[6*8]; WORD oicon, nicon; WORD oflag, nflag; WORD change, field; WORD uninstalled, h; #if MULTIAPP BYTE memszstr[4]; WORD omemsz, nmemsz; #endif tree = G.a_trees[ADINSAPP]; #if MULTIAPP LWSET(OB_NEXT(APMEMBOX),APMEMSZ); #endif h = LWGET(OB_HEIGHT(APSCRLBA)); LWSET(OB_HEIGHT(APFUPARO), gl_hbox + 2); LWSET(OB_Y(APFSVSLI), gl_hbox + 2); LWSET(OB_HEIGHT(APFSVSLI), h - (2 * (gl_hbox + 2))); LWSET(OB_Y(APFDNARO), h - (gl_hbox + 2)); LWSET(OB_HEIGHT(APFDNARO), gl_hbox + 2); uninstalled = !is_installed(pa); LWSET(OB_STATE(APREMV), (uninstalled) ? DISABLED : NORMAL ); /* stuff in appl name */ fmt_str(pfname, &pname[0]); inf_sset(tree, APNAME, &pname[0]); /* stuff in docu types */ insa_stypes(tree, pa->a_pdata); LWSET(OB_STATE(APYMEM), NORMAL); oflag = pa->a_flags; if (pa->a_flags & AF_ISCRYS) { field = APGEM; LWSET(OB_STATE(APYMEM), DISABLED); } else field = (pa->a_flags & AF_ISPARM) ? APPARMS : APDOS; LWSET(OB_STATE(field), SELECTED); field = (pa->a_flags & AF_ISFMEM) ? APYMEM : APNMEM; LWSET(OB_STATE(field), SELECTED); oicon = pa->a_aicon - IA_GENERIC; #if MULTIAPP omemsz = pa->a_memreq; merge_str(&memszstr[0], "%W", &omemsz); inf_sset(tree, APMEMSZ, &memszstr[0]); #endif insa_elev(tree, oicon, gl_numics); nicon = insa_dial(tree, oicon, gl_numics); change = FALSE; #if MULTIAPP nmemsz = ins_latoi(LLGET(LLGET(OB_SPEC(APMEMSZ)))); #endif /* set memory flag */ field = inf_gindex(tree, APYMEM, 2); nflag = (field == 0) ? AF_ISFMEM : 0; LWSET(OB_STATE(APYMEM + field), NORMAL); /* set type flags */ field = inf_gindex(tree, APGEM, 3); if (field == 0) nflag = AF_ISCRYS | AF_ISGRAF; if (field == 2) nflag |= AF_ISPARM; LWSET(OB_STATE(APGEM + field), NORMAL); /* get button selection */ field = inf_gindex(tree, APINST, 3); LWSET(OB_STATE(APINST + field), NORMAL); if ( field == 0 ) { /* install the appl. if its uninstalled or has new types */ insa_gtypes(tree, &ntypes[0]); if ( (uninstalled) || (!strcmp(&ntypes[0], pa->a_pdata)) ) { newpa = (uninstalled) ? app_alloc(TRUE) : pa; if (newpa) { if ( (uninstalled) || (!strcmp(&ntypes[0], pa->a_pdata)) ) { change = TRUE; ntypes[ strlen(&ntypes[0]) ] = '@'; scan_str(&ntypes[0], &newpa->a_pdata); } if (newpa != pa) { uninstalled = change = TRUE; strcpy(&ntypes[0], pfname); ntypes[ strlen(&ntypes[0]) ] = '@'; scan_str(&ntypes[0], &newpa->a_pappl); newpa->a_flags = nflag; newpa->a_type = AT_ISFILE; newpa->a_obid = NIL; newpa->a_letter = '\0'; newpa->a_xspot = 0x0; newpa->a_yspot = 0x0; } pa = newpa; } else fun_alert(1, STAPGONE, NULL); } /* see if icon changed or flags changed */ if ( (uninstalled) || #if MULTIAPP (omemsz != nmemsz) || #endif (oicon != nicon) || (oflag != nflag) ) { change = TRUE; pa->a_aicon = nicon + IA_GENERIC; pa->a_dicon = nicon + ID_GENERIC; pa->a_flags = nflag; #if MULTIAPP pa->a_memreq = nmemsz; #endif } } else if ( field == 1 ) { /* remove installed app */ if ( !uninstalled ) { app_free(pa); change = TRUE; } } return(change); } /* ins_app */
/* * Based on current selected icons, figure out which menu items * should be selected (deselected) */ static void men_update(OBJECT *tree) { WORD item, nsel, isapp; const BYTE *pvalue; ANODE *appl; pvalue = 0; /* enable all items */ for (item = OPENITEM; item <= PREFITEM; item++) menu_ienable(tree, item, 1); can_iapp = TRUE; can_show = TRUE; can_del = TRUE; /* disable some items */ men_list(tree, ILL_ITEM, FALSE); nsel = 0; for (item = 0; (item=win_isel(G.g_screen, G.g_croot, item)) != 0; nsel++) { appl = i_find(G.g_cwin, item, NULL, &isapp); if (!appl) continue; switch(appl->a_type) { case AT_ISFILE: if (isapp || is_installed(appl)) pvalue = ILL_FILE; else { pvalue = ILL_DOCU; can_iapp = FALSE; } break; case AT_ISFOLD: pvalue = ILL_FOLD; can_iapp = FALSE; break; case AT_ISDISK: pvalue = (appl->a_aicon == IG_FLOPPY) ? ILL_FDSK : ILL_HDSK; can_iapp = FALSE; break; case AT_ISTRSH: /* Trash */ pvalue = ILL_TRASH; can_del = FALSE; break; } men_list(tree, pvalue, FALSE); /* disable certain items */ } if (win_ontop()) pvalue = ILL_DESKTOP; else pvalue = ILL_NOTOP; if (pvalue == ILL_DESKTOP) men_list(tree, pvalue, TRUE); else men_list(tree, pvalue, FALSE); if (nsel != 1) { if (nsel) { pvalue = ILL_YSEL; can_show = FALSE; } else { pvalue = ILL_NOSEL; can_show = FALSE; can_del = FALSE; can_iapp = FALSE; } men_list(tree, pvalue, FALSE); } #if CONF_WITH_SHUTDOWN menu_ienable(tree, QUITITEM, can_shutdown()); #else menu_ienable(tree, QUITITEM, 0); #endif #if WITH_CLI == 0 menu_ienable(tree, CLIITEM, 0); #endif }