string & DosTextEditer::edcommand(string prompt,ostream &out,LinkList<string> &tmpfile) // pre: string is == to the prompt you wont and ostream == to the stream you wont to output too tmpfile == the file you have opend { string tmpstr; unsigned __int8 changed=0; do { cout<<prompt; MSF::getline(cin,tmpstr); if(tmpstr[0]!='Q') { tmpstr=MSF::tolower(tmpstr); } if(do_range(tmpstr,tmpfile,changed,out)); else if(do_double(tmpstr,tmpfile,changed,out)); else if(do_single(tmpstr,tmpfile,changed,out)); else { cout<<"Bad command."<<endl; } }while(tmpstr[0]!='Q'); return filename; }
static bool do_eheader(int fp,int *file_version,t_enxframe *fr,bool bTest, bool *bOK) { int magic=-7777777; real r; int block,i,zero=0,dum=0; bool bRead = gmx_fio_getread(fp); int tempfix_nr=0; *bOK=TRUE; /* The original energy frame started with a real, * so we have to use a real for compatibility. */ r = -2e10; if (!do_real(r)) return FALSE; if (r > -1e10) { /* Assume we are reading an old format */ *file_version = 1; fr->t = r; if (!do_int(dum)) *bOK = FALSE; fr->step = dum; } else { if (!do_int (magic)) *bOK = FALSE; if (magic != -7777777) { gmx_fatal(FARGS,"Energy header magic number mismatch, this is not a GROMACS edr file"); } *file_version = enx_version; if (!do_int (*file_version)) *bOK = FALSE; if (*bOK && *file_version > enx_version) { gmx_fatal(FARGS,"reading tpx file (%s) version %d with version %d program",gmx_fio_getname(fp),file_version,enx_version); } if (!do_double(fr->t)) *bOK = FALSE; if (!do_gmx_step_t(fr->step)) *bOK = FALSE; if (!bRead && fr->nsum == 1) { /* Do not store sums of length 1, * since this does not add information. */ if (!do_int (zero)) *bOK = FALSE; } else { if (!do_int (fr->nsum)) *bOK = FALSE; } if (*file_version >= 3) { do_gmx_step_t(fr->nsteps); } else { fr->nsteps = max(1,fr->nsum); } } if (!do_int (fr->nre)) *bOK = FALSE; if (!do_int (fr->ndisre)) *bOK = FALSE; if (!do_int (fr->nblock)) *bOK = FALSE; if (*bOK && bRead && fr->nblock>fr->nr_alloc) { srenew(fr->nr,fr->nblock); srenew(fr->b_alloc,fr->nblock); srenew(fr->block,fr->nblock); for(i=fr->nr_alloc; i<fr->nblock; i++) { fr->block[i] = NULL; fr->b_alloc[i] = 0; } fr->nr_alloc = fr->nblock; } for(block=0; block<fr->nblock; block++) { if (!do_int (fr->nr[block])) { *bOK = FALSE; } } if (!do_int (fr->e_size)) *bOK = FALSE; if (!do_int (fr->d_size)) *bOK = FALSE; /* Do a dummy int to keep the format compatible with the old code */ if (!do_int (dum)) *bOK = FALSE; if (*bOK && *file_version == 1 && !bTest) { if (fp >= ener_old_nalloc) { gmx_incons("Problem with reading old format energy files"); } if (!ener_old[fp].bReadFirstStep) { ener_old[fp].bReadFirstStep = TRUE; ener_old[fp].first_step = fr->step; ener_old[fp].nsum_prev = 0; } fr->nsum = fr->step - ener_old[fp].first_step + 1; fr->nsteps = fr->nsum; } return *bOK; }