void sploit_loop(void) { int ret = 0; int64_t *timeout; int64_t remain = 0LL; while(ret >= 0) { /* Calculate timeout value */ timeout = timer_timeout(); /* Do I/O multiplexing and event handling */ #if (defined USE_SELECT) ret = io_select(&remain, timeout); #elif (defined USE_POLL) ret = io_poll(&remain, timeout); #endif /* Remaining time is 0msecs, we need to run a timer */ if(remain == 0LL) timer_run(); if(timeout) timer_drift(*timeout - remain); io_handle(); timer_collect(); /* ircd_collect();*/ } }
f_proc_ret preass_(f_int *handle, f_int *ngels, f_int *nconts, f_int *idbsiz, f_int *relpg, f_int *lngthg, f_int *lnbr, f_int *rnbr, f_int *idm) { char fofn[1024]; GapIO *io; f_int ierr; if (NULL == (io = io_handle(handle))) f_proc_return(); if (gtstr("File of filenames", "", fofn, 1024) != 0) { f_proc_return(); } if (-1 == load_preassembled(io, fofn)) { puts("Failed"); } update_fortran_arrays(handle, ngels, nconts, idbsiz, relpg, lngthg, lnbr, rnbr); dbchek_(handle, relpg, lngthg, lnbr, rnbr, idm, idbsiz, ngels, nconts, &ierr); if (ierr) { verror(ERR_FATAL, "enter_preassembled", "The database is now inconsistent.\n" "You may wish to revert to a copy or to disassmble the newly " "assembled contig."); } f_proc_return(); }
void update_fortran_arrays(int handle, int *ngels, int *nconts, int *idbsiz, int *relpg, int *lngthg, int *lnbr, int *rnbr) { int i; GapIO *io; if (NULL == (io = io_handle(&handle))) return; *ngels = NumReadings(io); *nconts = NumContigs(io); for (i = 1; i <= *ngels; i++) readg_(&handle, &i, &relpg[i-1], &lngthg[i-1], &lnbr[i-1], &rnbr[i-1]); for (i = *idbsiz-*nconts; i <= *idbsiz-1; i++) { int c = *idbsiz - i; readc_(&handle, &c, &relpg[i-1], &lnbr[i-1], &rnbr[i-1]); } }
/* -------------------------------------------------------------------------- * * Loop around some timer stuff and the i/o multiplexer. * * -------------------------------------------------------------------------- */ void servauth_loop(void) { int ret = 0; int64_t *timeout; int64_t remain = 0LL; while(ret >= 0) { /* Calculate timeout value */ timeout = timer_timeout(); /* Do I/O multiplexing and event handling */ #ifdef USE_POLL ret = io_poll(&remain, timeout); #else ret = io_select(&remain, timeout); #endif /* Remaining time is 0msecs, we need to run a timer */ if(remain == 0LL) timer_run(); if(timeout) timer_drift(*timeout - remain); io_handle(); } }
void highscore_show(int numb) { highscore_add("player name",numb); while(!keyboard_check(27 /*vk_escape*/)) { draw_highscore(20, 0, room_width-20, room_height); screen_refresh(); io_handle(); } }
void keyboard_wait() { io_clear(); for (;;) { io_handle(); for (int i = 0; i < 255; i++) if (enigma::keybdstatus[i]) return; usleep(10000); // Sleep 1/100 second } }
int pre_assemble(int handle, int num_readings, char **reading_array) { GapIO *io; int ngels; int nconts; int idbsiz; int *relpg; int *lngthg; int *lnbr; int *rnbr; if (NULL == (io = io_handle(&handle))) return -1; /* initialise fortran arrays */ idbsiz = io_dbsize(io); relpg = &io_relpos(io,1); lngthg = &io_length(io,1); lnbr = &io_lnbr(io,1); rnbr = &io_rnbr(io,1); if (-1 == load_preassembled(io, num_readings, reading_array)) { verror(ERR_WARN, "enter_preassembled", "failed"); } update_fortran_arrays(handle, &ngels, &nconts, &idbsiz, relpg, lngthg, lnbr, rnbr); /* dbchek_(handle, relpg, lngthg, lnbr, rnbr, idm, idbsiz, ngels, nconts, &ierr); */ if (db_check(io) != 0) { verror(ERR_FATAL, "enter_preassembled", "The database is now inconsistent.\n" "You may wish to revert to a copy or to disassemble the newly " "assembled contig."); } flush2t(io); return 0; } /* end pre_assemble */
static void jump_linenum (int linenum) { FILE *original; int finished; /* Not only does this verify whether the scanner finished, if it has finished, it additionally closes the stream. */ finished = tokenizer_finished(); /* We save this copy in case the scanner wasn't finished. */ original = io_handle(); /* Start a new scanner from the beginning of the file. */ tokenizer_init(io_file()); reset(T_ERROR); io_reset(); /* Search for linenum. */ find_linenum(linenum); /* If the search ended at EOF, linenum could not be found! */ if (tokenizer_finished()) { dprintf( "*warning: could not jump to `%d'\n", E_WARNING, linenum); /* Set back to original stream */ io_set(io_file(), original); /* Prepare scanner to continue. */ if (!finished) { reset(T_NUMBER); io_reset(); io_next(); } } }
void keyboard_wait() { io_clear(); while(!keyboard_check(1/*vk_anykey*/)) { io_handle(); } }
void prt_io(int id, void *priv) { io_handle(prt_read,prt_write,prt_pend, priv); }
/* ------------------------------------------------------------------------ * * ------------------------------------------------------------------------ */ void io_wait_blocking(void) { io_multiplex(NULL, NULL); io_handle(); }