summaryrefslogtreecommitdiff
path: root/apps/gui/wps_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps_debug.c')
-rw-r--r--apps/gui/wps_debug.c53
1 files changed, 48 insertions, 5 deletions
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index ad9395b05d..335c994881 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -24,11 +24,19 @@
24#include "gwps.h" 24#include "gwps.h"
25#include "debug.h" 25#include "debug.h"
26 26
27#define PARSE_FAIL_UNCLOSED_COND 1
28#define PARSE_FAIL_INVALID_CHAR 2
29#define PARSE_FAIL_COND_SYNTAX_ERROR 3
30
31#ifdef SIMULATOR
32extern bool debug_wps;
33#endif
34
27static char *next_str(bool next) { 35static char *next_str(bool next) {
28 return next ? "next" : ""; 36 return next ? "next " : "";
29} 37}
30 38
31void dump_wps_tokens(struct wps_data *data) 39static void dump_wps_tokens(struct wps_data *data)
32{ 40{
33 struct wps_token *token; 41 struct wps_token *token;
34 int i, j; 42 int i, j;
@@ -358,7 +366,7 @@ void dump_wps_tokens(struct wps_data *data)
358 DEBUGF("\n"); 366 DEBUGF("\n");
359} 367}
360 368
361void print_line_info(struct wps_data *data) 369static void print_line_info(struct wps_data *data)
362{ 370{
363 int i, j; 371 int i, j;
364 struct wps_line *line; 372 struct wps_line *line;
@@ -395,7 +403,7 @@ void print_line_info(struct wps_data *data)
395 DEBUGF("\n"); 403 DEBUGF("\n");
396} 404}
397 405
398void print_wps_strings(struct wps_data *data) 406static void print_wps_strings(struct wps_data *data)
399{ 407{
400 int i, len, total_len = 0, buf_used = 0; 408 int i, len, total_len = 0, buf_used = 0;
401 409
@@ -414,7 +422,7 @@ void print_wps_strings(struct wps_data *data)
414} 422}
415 423
416#ifdef HAVE_LCD_BITMAP 424#ifdef HAVE_LCD_BITMAP
417void print_img_cond_indexes(struct wps_data *data) 425static void print_img_cond_indexes(struct wps_data *data)
418{ 426{
419 DEBUGF("Image conditional indexes:\n"); 427 DEBUGF("Image conditional indexes:\n");
420 int i; 428 int i;
@@ -427,4 +435,39 @@ void print_img_cond_indexes(struct wps_data *data)
427} 435}
428#endif /*HAVE_LCD_BITMAP */ 436#endif /*HAVE_LCD_BITMAP */
429 437
438void print_debug_info(struct wps_data *data, int fail, int line)
439{
440#ifdef SIMULATOR
441 if (debug_wps)
442 {
443 dump_wps_tokens(data);
444 print_line_info(data);
445 print_wps_strings(data);
446#ifdef HAVE_LCD_BITMAP
447 print_img_cond_indexes(data);
448#endif
449 }
450#endif /* SIMULATOR */
451
452 if (fail)
453 {
454 DEBUGF("Failed parsing on line %d : ", line);
455 switch (fail)
456 {
457 case PARSE_FAIL_UNCLOSED_COND:
458 DEBUGF("Unclosed conditional");
459 break;
460
461 case PARSE_FAIL_INVALID_CHAR:
462 DEBUGF("Invalid conditional char (not in an open conditional)");
463 break;
464
465 case PARSE_FAIL_COND_SYNTAX_ERROR:
466 DEBUGF("Conditional syntax error");
467 break;
468 }
469 DEBUGF("\n");
470 }
471}
472
430#endif /* DEBUG */ 473#endif /* DEBUG */