plist windows_list_create(plist ests_factorizations) { my_assert(ests_factorizations!=NULL); DEBUG("Creazione della lista delle finestre di genomica da considerare come fattori unici"); pEST p; plistit plist_it_id, plist_it_f; pfactorization pfact; pfactor pf; plistit plist_it_factor; plist list_of_factors=list_create(); plist_it_id=list_first(ests_factorizations); while(listit_has_next(plist_it_id)) { p= listit_next(plist_it_id); plist_it_f=list_first(p->factorizations); while(listit_has_next(plist_it_f)) { pfact=listit_next(plist_it_f); plist_it_factor=list_first(pfact); //fprintf(stdout, "EST %s\n", p->info->EST_id); while(listit_has_next(plist_it_factor)) { pf=listit_next(plist_it_factor); list_of_factors=update_windows(list_of_factors,pf); /*fprintf(stdout, "add %d-%d\n", pf->GEN_start, pf->GEN_end); fprintf(stdout, "Windows: "); plistit t_it=list_first(list_of_factors); while(listit_has_next(t_it)){ pfactor win=(pfactor)listit_next(t_it); fprintf(stdout, "%d-%d ", win->GEN_start, win->GEN_end); } fprintf(stdout, "\n"); listit_destroy(t_it);*/ } listit_destroy(plist_it_factor); } listit_destroy(plist_it_f); } listit_destroy(plist_it_id); return list_of_factors; }
int main(int argc, char **argv) { std::string header = "*** BRONCO v0.1 ***"; /* Read arguments */ if (argc != 2) { printf("Announce: %s --announce <path-to-file> bronco://<host>[:<port>]\n", argv[0]); printf(" Join: %s bronco://<host>[:<port>]/<content_id>\n", argv[0]); cleanup_and_exit(EXIT_FAILURE); } /* Set signal handlers */ signal(SIGINT, signal_close); signal(SIGTERM, signal_close); signal(SIGHUP, signal_close); /* Initialize ncurses */ initscr(); /* Get screen dimensions */ uint32_t maxy = 0; uint32_t maxx = 0; getmaxyx(stdscr, maxy, maxx); /* Create windows */ header_win = newwin(HEADER_HEIGHT, maxx, 0, 0); file_win = newwin(FILE_HEIGHT, maxx, HEADER_HEIGHT, 0); info_win = newwin(maxy-HEADER_HEIGHT-FILE_HEIGHT, maxx, HEADER_HEIGHT+FILE_HEIGHT, 0); /* Set ncurses options */ noecho(); curs_set(0); halfdelay(5); keypad(stdscr, TRUE); scrollok(info_win, TRUE); /* Create peer manager */ struct bronco::peermanager::peer_config c = {10, 10, 5, "localhost", bronco::peermanager::select_port()}; struct bronco::peermanager::nc_parameters p = {"bin/bronco-nc", 512, 400}; manager_ptr = new bronco::peermanager(argv[1], &c, &p, &info_printf); /* Screen update loop */ while (1) { /* Write content */ wclear(header_win); wclear(file_win); mvwprintw(header_win, 0, (maxx - header.size())/2, header.c_str()); mvwprintw(file_win, 0, 0, " Anders_Bech_-_Store_patter_betyder_undskyld.mp3\n [##### ]"); /* Resize and refresh windows */ update_windows(&maxy, &maxx); /* Wait for keypress or timeout */ int key = wgetch(info_win); if (key != ERR) info_printf("Key pressed!\n"); } /* Finalize */ cleanup_and_exit(EXIT_SUCCESS); return 0; }