summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-07-22 17:17:53 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-07-22 17:17:53 +0000
commit3213d4a0f5d3aea725bb9ddf34ae0ec38ca4b097 (patch)
treea7e386aef4624f453201aca9b5bf5ca8b38c3fd2 /apps
parentc897c241d9f085c8a8288183b62b3ea1d9e1796f (diff)
downloadrockbox-3213d4a0f5d3aea725bb9ddf34ae0ec38ca4b097.zip
rockbox-3213d4a0f5d3aea725bb9ddf34ae0ec38ca4b097.tar.gz
rockbox-3213d4a0f5d3aea725bb9ddf34ae0ec38ca4b097.tar.bz2
rockbox-3213d4a0f5d3aea725bb9ddf34ae0ec38ca4b097.tar.xz
Add a verbosity level command line option to the chackwps tool. This should make life easier for the themes.rockbox.org people.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13958 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps_debug.c112
1 files changed, 65 insertions, 47 deletions
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 935384f..317e73c 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -34,6 +34,7 @@
#if defined(SIMULATOR) || defined(__PCTOOL__)
extern bool debug_wps;
+extern int wps_verbose_level;
#endif
static char *next_str(bool next) {
@@ -49,11 +50,6 @@ static void dump_wps_tokens(struct wps_data *data)
bool next;
int num_string_tokens = 0;
- if (data->num_tokens > WPS_MAX_TOKENS) {
- DEBUGF("Number of tokens is too high (%d)!!!\n", data->num_tokens);
- return;
- }
-
/* Dump parsed WPS */
for (i = 0, token = data->tokens; i < data->num_tokens; i++, token++) {
next = token->next;
@@ -383,16 +379,22 @@ static void dump_wps_tokens(struct wps_data *data)
break;
}
- for(j = 0; j < indent; j++) {
- DEBUGF("\t");
- }
+ if (wps_verbose_level > 2)
+ {
+ for(j = 0; j < indent; j++) {
+ DEBUGF("\t");
+ }
- DEBUGF("[%3d] = (%2d) %s\n", i, token->type, buf);
+ DEBUGF("[%3d] = (%2d) %s\n", i, token->type, buf);
+ }
}
- DEBUGF("\n");
- DEBUGF("Number of string tokens: %d\n", num_string_tokens);
- DEBUGF("\n");
+ if (wps_verbose_level > 0)
+ {
+ DEBUGF("\n");
+ DEBUGF("Number of string tokens: %d\n", num_string_tokens);
+ DEBUGF("\n");
+ }
}
static void print_line_info(struct wps_data *data)
@@ -401,56 +403,67 @@ static void print_line_info(struct wps_data *data)
struct wps_line *line;
struct wps_subline *subline;
- DEBUGF("Number of lines : %d\n", data->num_lines);
- DEBUGF("Number of sublines: %d\n", data->num_sublines);
- DEBUGF("Number of tokens : %d\n", data->num_tokens);
- DEBUGF("\n");
-
- for (i = 0, line = data->lines; i < data->num_lines; i++,line++)
+ if (wps_verbose_level > 0)
{
- DEBUGF("Line %2d (num_sublines=%d, first_subline=%d)\n",
- i, line->num_sublines, line->first_subline_idx);
+ DEBUGF("Number of lines : %d\n", data->num_lines);
+ DEBUGF("Number of sublines: %d\n", data->num_sublines);
+ DEBUGF("Number of tokens : %d\n", data->num_tokens);
+ DEBUGF("\n");
+ }
- for (j = 0, subline = data->sublines + line->first_subline_idx;
- j < line->num_sublines; j++, subline++)
+ if (wps_verbose_level > 1)
+ {
+ for (i = 0, line = data->lines; i < data->num_lines; i++,line++)
{
- DEBUGF(" Subline %d: first_token=%3d, last_token=%3d",
- j, subline->first_token_idx,
- wps_last_token_index(data, i, j));
-
- if (subline->line_type & WPS_REFRESH_SCROLL)
- DEBUGF(", scrolled");
- else if (subline->line_type & WPS_REFRESH_PLAYER_PROGRESS)
- DEBUGF(", progressbar");
- else if (subline->line_type & WPS_REFRESH_PEAK_METER)
- DEBUGF(", peakmeter");
-
- DEBUGF("\n");
+ DEBUGF("Line %2d (num_sublines=%d, first_subline=%d)\n",
+ i, line->num_sublines, line->first_subline_idx);
+
+ for (j = 0, subline = data->sublines + line->first_subline_idx;
+ j < line->num_sublines; j++, subline++)
+ {
+ DEBUGF(" Subline %d: first_token=%3d, last_token=%3d",
+ j, subline->first_token_idx,
+ wps_last_token_index(data, i, j));
+
+ if (subline->line_type & WPS_REFRESH_SCROLL)
+ DEBUGF(", scrolled");
+ else if (subline->line_type & WPS_REFRESH_PLAYER_PROGRESS)
+ DEBUGF(", progressbar");
+ else if (subline->line_type & WPS_REFRESH_PEAK_METER)
+ DEBUGF(", peakmeter");
+
+ DEBUGF("\n");
+ }
}
- }
- DEBUGF("\n");
+ DEBUGF("\n");
+ }
}
static void print_wps_strings(struct wps_data *data)
{
int i, len, total_len = 0, buf_used = 0;
- DEBUGF("Strings:\n");
+ if (wps_verbose_level > 1) DEBUGF("Strings:\n");
for (i = 0; i < data->num_strings; i++)
{
len = strlen(data->strings[i]);
total_len += len;
buf_used += len + 1;
- DEBUGF("%2d: (%2d) '%s'\n", i, len, data->strings[i]);
+ if (wps_verbose_level > 1)
+ DEBUGF("%2d: (%2d) '%s'\n", i, len, data->strings[i]);
+ }
+ if (wps_verbose_level > 1) DEBUGF("\n");
+
+ if (wps_verbose_level > 0)
+ {
+ DEBUGF("Number of unique strings: %d (max: %d)\n",
+ data->num_strings, WPS_MAX_STRINGS);
+ DEBUGF("Total string length: %d\n", total_len);
+ DEBUGF("String buffer used: %d out of %d bytes\n",
+ buf_used, STRING_BUFFER_SIZE);
+ DEBUGF("\n");
}
- DEBUGF("\n");
- DEBUGF("Number of strings: %d out of an allowed %d\n",
- data->num_strings, WPS_MAX_STRINGS);
- DEBUGF("Total string length: %d\n", total_len);
- DEBUGF("String buffer used: %d out of %d bytes\n",
- buf_used, STRING_BUFFER_SIZE);
- DEBUGF("\n");
}
#ifdef HAVE_LCD_BITMAP
@@ -470,17 +483,22 @@ static void print_img_cond_indexes(struct wps_data *data)
void print_debug_info(struct wps_data *data, int fail, int line)
{
#if defined(SIMULATOR) || defined(__PCTOOL__)
- if (debug_wps)
+ if (debug_wps && wps_verbose_level)
{
dump_wps_tokens(data);
print_wps_strings(data);
print_line_info(data);
#ifdef HAVE_LCD_BITMAP
- print_img_cond_indexes(data);
+ if (wps_verbose_level > 2) print_img_cond_indexes(data);
#endif
}
#endif /* SIMULATOR */
+ if (data->num_tokens >= WPS_MAX_TOKENS - 1) {
+ DEBUGF("Warning: Max number of tokens was reached (%d)\n",
+ WPS_MAX_TOKENS - 1);
+ }
+
if (fail)
{
DEBUGF("Failed parsing on line %d : ", line);