void output() { if (strcmp(outname, "-") == 0) { outfile = stdout; } else { outfile = fopen(outname, "w"); if (!outfile) error(EX_FATAL, errno, _("cannot open file `%s'"), outname); } set_level_mark(0, 0); if (print_option & PRINT_XREF) { xref_output(); } if (print_option & PRINT_TREE) { tree_output(); } fclose(outfile); }
/* Produce reverse call tree output */ static void inverted_tree(int lev, int last, Symbol *sym) { struct linked_list_entry *p; int rc; if (sym->type == SymUndefined || (max_depth && lev >= max_depth) || !include_symbol(sym)) return; rc = print_symbol(0, lev, last, sym); newline(); if (rc || sym->active) return; set_active(sym); for (p = linked_list_head(sym->caller); p; p = p->next) { set_level_mark(lev+1, !is_last(p)); inverted_tree(lev+1, is_last(p), (Symbol*)p->data); } clear_active(sym); }
/* Produce reverse call tree output */ static void inverted_tree(int lev, int last, Symbol *sym) { Consptr cons; int rc; if (sym->type == SymUndefined || (max_depth && lev >= max_depth) || !include_symbol(sym)) return; rc = print_symbol(0, lev, last, sym); newline(); if (rc || sym->active) return; set_active(sym); for (cons = sym->caller; cons; cons = CDR(cons)) { set_level_mark(lev+1, is_printable(CDR(cons))); inverted_tree(lev+1, is_last(cons), (Symbol*)CAR(cons)); } clear_active(sym); }