summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 14:18:07 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 14:18:07 +0000
commit3954a51311f872abcce9b96ebe436b869939767a (patch)
tree40a829c808a4297d7b3d73cb8c9bca463407b143
parent52112a05f11c2ab7e308e8bf2a64ae787e191369 (diff)
downloadrockbox-3954a51311f872abcce9b96ebe436b869939767a.tar.gz
rockbox-3954a51311f872abcce9b96ebe436b869939767a.zip
Better handling of subline timeout values : All values are set to the default before another value is found by the parser. No more
resetting to the default value at displaying time (this caused problems especially noticeable on the DancePuffDuo WPS). Changing the values with conditionals is still possible but only strictly positive tiemout values are accepted now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13045 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c5
-rw-r--r--apps/gui/wps_debug.c11
-rw-r--r--apps/gui/wps_parser.c12
3 files changed, 23 insertions, 5 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 4384284901..86003fa9ef 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1763,14 +1763,9 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1763 /* reset to first subline if refresh all flag is set */ 1763 /* reset to first subline if refresh all flag is set */
1764 if (refresh_mode == WPS_REFRESH_ALL) 1764 if (refresh_mode == WPS_REFRESH_ALL)
1765 { 1765 {
1766 int j;
1767 for (i = 0; i < data->num_lines; i++) 1766 for (i = 0; i < data->num_lines; i++)
1768 { 1767 {
1769 data->curr_subline[i] = SUBLINE_RESET; 1768 data->curr_subline[i] = SUBLINE_RESET;
1770 for (j = 0; j < data->num_sublines[i]; j++)
1771 {
1772 data->time_mult[i][j] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
1773 }
1774 } 1769 }
1775 } 1770 }
1776 1771
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index bcb05e0902..48aadc627d 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -362,6 +362,17 @@ void print_line_info(struct wps_data *data)
362 DEBUGF("\n"); 362 DEBUGF("\n");
363 } 363 }
364 364
365 DEBUGF("subline time multipliers :\n");
366 for (line = 0; line < data->num_lines; line++)
367 {
368 DEBUGF("%2d. ", line);
369 for (subline = 0; subline < data->num_sublines[line]; subline++)
370 {
371 DEBUGF("%3d ", data->time_mult[line][subline]);
372 }
373 DEBUGF("\n");
374 }
375
365 DEBUGF("\n"); 376 DEBUGF("\n");
366} 377}
367 378
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index b51a76a594..8a226e1963 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -490,7 +490,15 @@ static int parse_subline_timeout(const char *wps_bufptr, struct wps_data *wps_da
490 if (have_tenth == false) 490 if (have_tenth == false)
491 val *= 10; 491 val *= 10;
492 492
493 /* We only want to allow strictly positive timeout values */
494 if (val <= 0)
495 val = DEFAULT_SUBLINE_TIME_MULTIPLIER;
496
497 int line = wps_data->num_lines;
498 int subline = wps_data->num_sublines[line];
499 wps_data->time_mult[line][subline] = val;
493 wps_data->tokens[wps_data->num_tokens].value.i = val; 500 wps_data->tokens[wps_data->num_tokens].value.i = val;
501
494 return skip; 502 return skip;
495} 503}
496 504
@@ -616,6 +624,8 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
616 data->num_tokens = 0; 624 data->num_tokens = 0;
617 char *current_string = data->string_buffer; 625 char *current_string = data->string_buffer;
618 626
627 data->time_mult[0][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
628
619 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS 629 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS
620 && data->num_lines < WPS_MAX_LINES) 630 && data->num_lines < WPS_MAX_LINES)
621 { 631 {
@@ -634,6 +644,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
634 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR; 644 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR;
635 subline = ++(data->num_sublines[data->num_lines]); 645 subline = ++(data->num_sublines[data->num_lines]);
636 data->format_lines[data->num_lines][subline] = data->num_tokens; 646 data->format_lines[data->num_lines][subline] = data->num_tokens;
647 data->time_mult[data->num_lines][subline] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
637 } 648 }
638 else 649 else
639 wps_bufptr += skip_end_of_line(wps_bufptr); 650 wps_bufptr += skip_end_of_line(wps_bufptr);
@@ -700,6 +711,7 @@ condlistend: /* close a conditional. sometimes we want to close them even when
700 if (data->num_lines < WPS_MAX_LINES) 711 if (data->num_lines < WPS_MAX_LINES)
701 { 712 {
702 data->format_lines[data->num_lines][0] = data->num_tokens; 713 data->format_lines[data->num_lines][0] = data->num_tokens;
714 data->time_mult[data->num_lines][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
703 } 715 }
704 716
705 break; 717 break;