[ 2638083 ] SVF progress indicator not visible for some .svf files

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1442 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 16 years ago
parent e25191fa0b
commit 1b226da533

@ -1,6 +1,13 @@
2009-02-26 Arnim Laeuger <arniml@users.sourceforge.net>
* src/svf/svf_flex.l:
[ 2638083 ] SVF progress indicator not visible for some .svf files
(William)
2009-02-25 Arnim Laeuger <arniml@users.sourceforge.net>
* src/svf/svf_flex.l: [ 2635979 ] Replace index() to strchr()
(MURANAKA Masaki)
2009-02-23 Arnim Laeuger <arniml@users.sourceforge.net>

@ -50,6 +50,7 @@ static void align_string(char *);
static void fix_yylloc(YYLTYPE *, char *);
static void fix_yylloc_nl(YYLTYPE *, char *, YY_EXTRA_TYPE);
static void progress_nl(YYLTYPE *, YY_EXTRA_TYPE);
int yywrap(yyscan_t scanner)
{
@ -177,6 +178,7 @@ COMMENT (!.*)|("//".*)[^\n]
yylloc->first_column = yylloc->last_column;
++yylloc->last_line;
yylloc->last_column = 0;
progress_nl(yylloc, yyget_extra(yyscanner));
} /* end of new line */
@ -328,12 +330,7 @@ fix_yylloc_nl(YYLTYPE * mylloc, char *str, YY_EXTRA_TYPE extra)
if (*p == '\n') {
mylloc->last_column = 0;
++mylloc->last_line;
if (extra->print_progress) {
printf( "\r" );
printf( _("Parsing %6d/%d (%3.0d%%)"),
mylloc->last_line, extra->num_lines,
((mylloc->last_line * 100) + 1) / extra->num_lines );
}
progress_nl(mylloc, extra);
} else {
++mylloc->last_column;
}
@ -341,6 +338,21 @@ fix_yylloc_nl(YYLTYPE * mylloc, char *str, YY_EXTRA_TYPE extra)
}
static void
progress_nl(YYLTYPE * mylloc, YY_EXTRA_TYPE extra)
{
int percent;
if ((extra->print_progress) && (mylloc->last_line % 10==0)) {
percent = ((mylloc->last_line * 100) + 1) / extra->num_lines;
if (percent <= 1) return; // dont bother printing < 1 %
printf( "\r" );
printf( _("Parsing %6d/%d (%3.0d%%)"),
mylloc->last_line, extra->num_lines, percent);
}
}
void *svf_flex_init(FILE *f, int num_lines, int print_progress)
{
YY_EXTRA_TYPE extra;

Loading…
Cancel
Save