/** * Create a dependency_graph representing a command_stream STREAM which finds any dependencies * between different commands so that they can be run in parallel without any side effects. **/ dependency_graph_t create_graph(command_stream_t stream) { depend_head = NULL; dependency_graph_t graph = (dependency_graph *)checked_malloc(sizeof(dependency_graph)); graph->no_dependencies = graph->dependencies = NULL; stream->cursor = stream->head; // process commands while (stream->cursor) { graph_node *new_node = process_command(stream->cursor->command); if (new_node->before == NULL) { // no dependencies if (graph->no_dependencies) { graph_node *old_node = graph->no_dependencies; while (old_node->next) { old_node = old_node->next; } new_node->prev = old_node; old_node->next = new_node; } else { graph->no_dependencies = new_node; } } else { // dependencies if (graph->dependencies) { graph_node *old_node = graph->dependencies; while (old_node->next) { old_node = old_node->next; } new_node->prev = old_node; old_node->next = new_node; } else { graph->dependencies = new_node; } } stream->cursor = stream->cursor->next; } if (DEBUG) { printf("created dependency graph\n\n"); printf("\nno dependencies\n\n"); print_dependencies(graph->no_dependencies); printf("\ndependencies\n\n"); print_dependencies(graph->dependencies); } return graph; }
void print_dependencies(struct LKM_Module *lkm_mod) { int i=0; for(i=0; i<MAX_LKM; i++){ if(lkm_mod->depd_mod[i] == 1){ print_dependencies(&modules_lkm[i]); cprintf("Dependent on: %s \n", modules_lkm[i].name); } } }
void print_mod_dep(char *file) { int ret=0; ret = check_module(file); if(ret == -1){ cprintf("\n\t***** Module:%s is Not loaded *****\t\n",file); return; } if(modules_lkm[ret].depd_count > 0){ cprintf("\n***Module: %s is dependent on Following modules*** \n",file, modules_lkm[ret].depd_count); print_dependencies(&modules_lkm[ret]); }else{ cprintf("\n\t ****** Module : %s has NO DEPENDENCIES ****** \n",file); } cprintf("\n"); }
SubdivUpdater::SubdivUpdater(LMESHptr m, CBvert_list& verts) : _parent(nullptr) { // Screened in SubdivUpdater::create(): assert(m && m == verts.mesh()); _mesh = m; _verts = verts; // Get bbases, add to inputs _inputs = Bbase::find_owners(verts).bnodes(); if (debug) { err_msg("SubdivUpdater::SubdivUpdater:"); cerr << " "; print_dependencies(); err_msg(" level %d, %d verts, %d boss memes", m->subdiv_level(), verts.size(), Bbase::find_boss_vmemes(verts).size()); } // If not covered, create parent if (!Bbase::is_covered(verts)) { // Get parent verts list Bvert_list parents = LMESH::get_subdiv_inputs(verts); // If non-empty create parent SubdivUpdater if (!parents.empty()) { // Create parent subdiv updater on parent verts // and add to _inputs _parent = create(parents); _inputs += _parent; } } hookup(); }
int print_neededby(struct hash *hash, char *name) { struct node *n; struct tree_node *t; struct tree *all; if ((n = hash_search(hash, name)) == NULL) { fprintf(stderr, "bee-dep: print_needs: cannot find \"%s\"\n", name); return 1; } if (IS_PKG(n)) return print_dependencies(hash, n); all = tree_new(); t = tree_first(n->neededby->root); while (t) { get_all_providers(t->n, all); t = tree_next(t); } t = tree_first(all->root); while (t) { puts(t->n->name); t = tree_next(t); } tree_free_all_nodes(all); tree_free(all); return 0; }
// --- decode ---------------------------------------------------------------- void CodeBlob::decode() const { print_dependencies(tty); Disassembler::decode(this,tty); }
int main(int argc, char **argv) { struct arguments arguments; arguments.action = 0; arguments.no_favorite_repo = 0; arguments.no_favorite_version = 0; arguments.no_deps = 1; arguments.all = 0; arguments.args = NULL; if (argc < 2) { char *fake_arg[2]; fake_arg[0] = "ilenia"; fake_arg[1] = "--help"; argp_parse(&argp, 2, fake_arg, 0, 0, &arguments); } argp_parse(&argp, argc, argv, 0, 0, &arguments); if (parse_ileniarc() != 0) return (EXIT_FAILURE); ilenia_repos = build_repolist(); if (arguments.action == ACT_CACHE) { FILE *file; if ((file = fopen(CACHE, "w"))) fclose(file); } ilenia_favoriterepo = get_favorite(FAVORITE_REPO); ilenia_favoriteversion = get_favorite(FAVORITE_VERSION); ilenia_aliases = aliaseslist_build(); ilenia_ports = lsports(); ilenia_pkgs = lspkgs(); ilenia_favoritepkgmk = pkgmklist_build(); if (arguments.action > 21 || arguments.action == 0) error("%s", "please perform an action at a time!"); int confront_options = arguments.no_favorite_repo + arguments.no_favorite_version; int update_options = arguments.no_deps; if (confront_options) update_options = confront_options * update_options; int status = EXIT_SUCCESS; if (arguments.action == ACT_UPDATE) { if (arguments.args == NULL) { status = update_all_repos(); return (EXIT_SUCCESS); } while (arguments.args) { status = update_repo(arguments.args->data); arguments.args = arguments.args->next; } } if (arguments.action == ACT_LIST) { if (arguments.args == NULL) { pkglist_print(ilenia_ports); return (EXIT_SUCCESS); } while (arguments.args) { if (repolist_exists(arguments.args->data, ilenia_repos)) { warning("repository %s not found!\n", arguments.args->data); arguments.args = arguments.args->next; continue; } pkglist_print(pkglist_select_from_repo (arguments.args->data, ilenia_ports)); arguments.args = arguments.args->next; } } if (arguments.action == ACT_SEARCH) { if (arguments.args == NULL) error("action search requires an argument!"); while (arguments.args) { pkglist_print(pkglist_find_like (arguments.args->data, ilenia_ports)); arguments.args = arguments.args->next; } } if (arguments.action == ACT_INFO) { if (arguments.args == NULL) error("action info requires an argument!"); while (arguments.args) { info(arguments.args->data, confront_options); arguments.args = arguments.args->next; } } if (arguments.action == ACT_DIFF) pkglist_confront(DIFF, confront_options, 1); if (arguments.action == ACT_UPDATED) pkglist_confront(UPDATED, confront_options, 1); if (arguments.action == ACT_DEPENDENCIES) { if (arguments.args == NULL) error("action dependencies requires an argument!"); while (arguments.args) { print_dependencies(arguments.args->data); arguments.args = arguments.args->next; } } if (arguments.action == ACT_UPDATE_PKG) { if (arguments.args == NULL) { status = update_system(update_options); return status; } while (arguments.args) { status = update_pkg(update_options, arguments.args->data); arguments.args = arguments.args->next; } } if (arguments.action == ACT_DEPENDENTS) { if (arguments.args == NULL) error("action dependents requires an argument!"); while (arguments.args) { print_dependents(arguments.args->data, arguments.all); arguments.args = arguments.args->next; } } if (arguments.action == ACT_REMOVE) { if (arguments.args == NULL) error("action remove requires an argument!"); while (arguments.args) { status = remove_pkg(arguments.args->data, arguments.no_deps, arguments.all); arguments.args = arguments.args->next; } } if (arguments.action == ACT_REPOSITORY_LIST) { while (ilenia_repos != NULL) { printf("name %s path %s\n", ilenia_repos->name, ilenia_repos->path); ilenia_repos = ilenia_repos->next; } } return status; }
int main(int argc, char* argv[]) { if (argc < 2) { std::cerr << "Error: no file given\n"; print_usage(argv[0]); return EXIT_FAILURE; } // include paths std::vector<std::string> paths; std::string file_name, target_name, output_file; bool ignore_non_existing = true; // -MG bool add_empty_phony_targets = false; // -MP for (int i = 1; i < argc; i++) { const std::string arg(argv[i]); if (starts_with(arg, "-I") && arg.length() > 2) { paths.push_back(arg.substr(2)); continue; } if (arg == "-MG") { ignore_non_existing = false; continue; } if (arg == "-MM") { // ignore headers from system directories (default) continue; } if (arg == "-M") { std::cerr << "Warning: ignoring unsupported option " << arg << '\n'; continue; } if (arg == "-MD" || arg == "-MQ") { std::cerr << "Warning: ignoring unsupported option " << arg << '\n'; i++; continue; } if (arg == "-MP") { add_empty_phony_targets = true; continue; } if (arg == "-MT" && i + 1 < argc) { target_name = argv[++i]; continue; } if ((arg == "-MF" || arg == "-MMD" || arg == "-o") && i + 1 < argc) { output_file = argv[++i]; continue; } if (arg == "--help" || arg == "-h") { print_usage(argv[0]); return EXIT_SUCCESS; } // interpret last argument as file name if (i + 1 == argc) { file_name = arg; if (!file_exists(file_name)) { std::cerr << "Error: file does not exist: " << file_name << '\n'; return EXIT_FAILURE; } continue; } std::cerr << "Error: unknown option: " << arg << '\n'; print_usage(argv[0]); return EXIT_FAILURE; } // select output stream std::ofstream fstr(output_file); std::ostream* ostr = &std::cout; if (!output_file.empty()) { if (!fstr.good()) { std::cerr << "Error: cannot write to file " << output_file << '\n'; return EXIT_FAILURE; } ostr = &fstr; } // include paths paths.insert(paths.begin(), directory(file_name)); paths.push_back("."); paths = delete_duplicates(paths); // search for header inclusions in file const std::vector<std::string> dependencies = delete_duplicates( search_includes(file_name, paths, ignore_non_existing), Is_not_duplicate_ignore_path()); // prepend file itself to dependency list std::vector<std::string> dependencies_and_main(dependencies); dependencies_and_main.insert(dependencies_and_main.begin(), file_name); if (target_name.empty()) target_name = replace_extension(filename(file_name), "o"); // output print_dependencies(target_name, dependencies_and_main, *ostr); if (add_empty_phony_targets) print_empty_phony_targets(dependencies, *ostr); return EXIT_SUCCESS; }