int main(int argc, char** argv) { int n_players = 2; if (argc > 1) n_players = atoi(argv[1]); read_setup(n_players, 128, 128); gfp::init_field(gfp::pr(), false); check_triples<gf2n>(n_players); check_triples<gfp>(n_players); }
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info) { xcb_connection_t* c; #ifndef _WIN32 #ifndef USE_POLL if(fd >= FD_SETSIZE) /* would overflow in FD_SET */ { close(fd); return _xcb_conn_ret_error(XCB_CONN_ERROR); } #endif #endif /* !_WIN32*/ c = calloc(1, sizeof(xcb_connection_t)); if(!c) { close(fd); return _xcb_conn_ret_error(XCB_CONN_CLOSED_MEM_INSUFFICIENT) ; } c->fd = fd; if(!( set_fd_flags(fd) && pthread_mutex_init(&c->iolock, 0) == 0 && _xcb_in_init(&c->in) && _xcb_out_init(&c->out) && write_setup(c, auth_info) && read_setup(c) && _xcb_ext_init(c) && _xcb_xid_init(c) )) { xcb_disconnect(c); return _xcb_conn_ret_error(XCB_CONN_ERROR); } return c; }
int main(int argc,char *argv[]) { General general; Stopping sto; Concentration conc; Event *event; Measurement meas; int i; event=(Event *) malloc(MAXEVENTS*sizeof(Event)); read_command_line(argc,argv,&general); read_setup(&general,&meas,&conc); allocate_general_sto_conc(&general, &meas, &sto, &conc); switch(general.cs) { default: case CS_RUTHERFORD: fprintf(stderr, "erd_depth is using Rutherford cross sections\n"); break; case CS_LECUYER: fprintf(stderr, "erd_depth is using L'Ecuyer corrected Rutherford cross sections\n"); break; case CS_ANDERSEN: fprintf(stderr, "erd_depth is using Andersen corrected Rutherford cross sections\n"); break; } clear_conc(&general, &conc); read_events(&general,&meas,event,&conc); calculate_stoppings(&general, &meas, &sto); create_conc_profile(&general,&meas,&sto,&conc); for(i=0;i<general.niter;i++){ calculate_primary_energy(&general,&meas,&sto,&conc); clear_conc(&general, &conc); calculate_recoil_depths(&general,&meas,event,&sto,&conc); create_conc_profile(&general,&meas,&sto,&conc); } output(&general,&conc,event); exit(0); }
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info) { xcb_connection_t* c; #ifndef USE_POLL if(fd >= FD_SETSIZE) /* would overflow in FD_SET */ { close(fd); return (xcb_connection_t *) &error_connection; } #endif c = calloc(1, sizeof(xcb_connection_t)); if(!c) { close(fd); return (xcb_connection_t *) &error_connection; } c->fd = fd; if(!( set_fd_flags(fd) && pthread_mutex_init(&c->iolock, 0) == 0 && _xcb_in_init(&c->in) && _xcb_out_init(&c->out) && write_setup(c, auth_info) && read_setup(c) && _xcb_ext_init(c) && _xcb_xid_init(c) )) { xcb_disconnect(c); return (xcb_connection_t *) &error_connection; } return c; }
void read_setup(int nparties, int lg2p, int gf2ndegree) { string dir = get_prep_dir(nparties, lg2p, gf2ndegree); read_setup(dir); }
static void readsetup(scope v){ init_dictionary(v); read_setup(); }