/* Nucleotide Sequence Generator - seq-gen, version 1.2.5 */ /* (c) Copyright 1996-2001, Andrew Rambaut & Nick Grassly */ /* Department of Zoology, University of Oxford */ #include #include #include "progress.h" static int barLength, dotGap, dots, bar; /*********************/ void InitProgressBar(int total) { barLength=total; dotGap=1; if (barLength>MAX_BAR_LENGTH) { dotGap=barLength/MAX_BAR_LENGTH; if (barLength%dotGap) barLength=(barLength/dotGap)+1; else barLength/=dotGap; } } /*********************/ void DrawProgressBar() { int i; if (barLength<2) return; fprintf(stderr, "0%%|"); for (i=0; i<(barLength); i++) fputc('_', stderr); fprintf(stderr, "|100%%\n ["); fflush(stderr); dots=0; bar=0; } /*********************/ void ProgressBar() { if (barLength<2) return; if (bar%dotGap==0) { fputc('.', stderr); fflush(stderr); dots++; if (dots==barLength) { fputc(']', stderr); fputc('\n', stderr); } fflush(stderr); } bar++; }