summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps_debug.c16
-rw-r--r--apps/gui/wps_parser.c17
-rw-r--r--apps/misc.c47
-rw-r--r--apps/settings.h3
4 files changed, 53 insertions, 30 deletions
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 4e6af388ac..f843b989a2 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -25,7 +25,11 @@
25#include <string.h> 25#include <string.h>
26#include "gwps.h" 26#include "gwps.h"
27#ifdef __PCTOOL__ 27#ifdef __PCTOOL__
28#ifdef WPSEDITOR
29#include "proxy.h"
30#else
28#define DEBUGF printf 31#define DEBUGF printf
32#endif
29#else 33#else
30#include "debug.h" 34#include "debug.h"
31#endif 35#endif
@@ -589,18 +593,18 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
589 { 593 {
590 char buf[64]; 594 char buf[64];
591 595
592 DEBUGF("Failed parsing on line %d : ", line); 596 DEBUGF("ERR: Failed parsing on line %d : ", line);
593 switch (fail) 597 switch (fail)
594 { 598 {
595 case PARSE_OK: 599 case PARSE_OK:
596 break; 600 break;
597 601
598 case PARSE_FAIL_UNCLOSED_COND: 602 case PARSE_FAIL_UNCLOSED_COND:
599 DEBUGF("Unclosed conditional"); 603 DEBUGF("ERR: Unclosed conditional");
600 break; 604 break;
601 605
602 case PARSE_FAIL_INVALID_CHAR: 606 case PARSE_FAIL_INVALID_CHAR:
603 DEBUGF("unexpected conditional char after token %d: \"%s\"", 607 DEBUGF("ERR: Unexpected conditional char after token %d: \"%s\"",
604 data->num_tokens-1, 608 data->num_tokens-1,
605 get_token_desc(&data->tokens[data->num_tokens-1], data, 609 get_token_desc(&data->tokens[data->num_tokens-1], data,
606 buf, sizeof(buf)) 610 buf, sizeof(buf))
@@ -608,7 +612,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
608 break; 612 break;
609 613
610 case PARSE_FAIL_COND_SYNTAX_ERROR: 614 case PARSE_FAIL_COND_SYNTAX_ERROR:
611 DEBUGF("Conditional syntax error after token %d: \"%s\"", 615 DEBUGF("ERR: Conditional syntax error after token %d: \"%s\"",
612 data->num_tokens-1, 616 data->num_tokens-1,
613 get_token_desc(&data->tokens[data->num_tokens-1], data, 617 get_token_desc(&data->tokens[data->num_tokens-1], data,
614 buf, sizeof(buf)) 618 buf, sizeof(buf))
@@ -616,7 +620,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
616 break; 620 break;
617 621
618 case PARSE_FAIL_COND_INVALID_PARAM: 622 case PARSE_FAIL_COND_INVALID_PARAM:
619 DEBUGF("Invalid parameter list for token %d: \"%s\"", 623 DEBUGF("ERR: Invalid parameter list for token %d: \"%s\"",
620 data->num_tokens, 624 data->num_tokens,
621 get_token_desc(&data->tokens[data->num_tokens], data, 625 get_token_desc(&data->tokens[data->num_tokens], data,
622 buf, sizeof(buf)) 626 buf, sizeof(buf))
@@ -624,7 +628,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
624 break; 628 break;
625 629
626 case PARSE_FAIL_LIMITS_EXCEEDED: 630 case PARSE_FAIL_LIMITS_EXCEEDED:
627 DEBUGF("Limits exceeded"); 631 DEBUGF("ERR: Limits exceeded");
628 break; 632 break;
629 } 633 }
630 DEBUGF("\n"); 634 DEBUGF("\n");
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 714c419af1..b2baddd747 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -28,14 +28,25 @@
28#include "plugin.h" 28#include "plugin.h"
29 29
30#ifdef __PCTOOL__ 30#ifdef __PCTOOL__
31#ifdef WPSEDITOR
32#include "proxy.h"
33#include "settings.h"
34#include "sysfont.h"
35#include "gwps.h"
36#include "font.h"
37#include "bmp.h"
38#include "backdrop.h"
39#include "ctype.h"
40#else
41#include "checkwps.h"
42#define SYSFONT_HEIGHT 8
31#define DEBUGF printf 43#define DEBUGF printf
44#endif /*WPSEDITOR*/
32#define FONT_SYSFIXED 0 45#define FONT_SYSFIXED 0
33#define FONT_UI 1 46#define FONT_UI 1
34#define SYSFONT_HEIGHT 8
35#include "checkwps.h"
36#else 47#else
37#include "debug.h" 48#include "debug.h"
38#endif 49#endif /*__PCTOOL__*/
39 50
40#ifndef __PCTOOL__ 51#ifndef __PCTOOL__
41#include <ctype.h> 52#include <ctype.h>
diff --git a/apps/misc.c b/apps/misc.c
index f3a937f76b..cd59dbc40f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -27,7 +27,10 @@
27#ifdef __PCTOOL__ 27#ifdef __PCTOOL__
28#include <stdint.h> 28#include <stdint.h>
29#include <stdarg.h> 29#include <stdarg.h>
30#include <unistd.h> 30#include <stdio.h>
31#ifdef WPSEDITOR
32#include "string.h"
33#endif
31#else 34#else
32#include "sprintf.h" 35#include "sprintf.h"
33#include "lang.h" 36#include "lang.h"
@@ -196,26 +199,6 @@ char *create_numbered_filename(char *buffer, const char *path,
196 return buffer; 199 return buffer;
197} 200}
198 201
199/* Format time into buf.
200 *
201 * buf - buffer to format to.
202 * buf_size - size of buffer.
203 * t - time to format, in milliseconds.
204 */
205void format_time(char* buf, int buf_size, long t)
206{
207 if ( t < 3600000 )
208 {
209 snprintf(buf, buf_size, "%d:%02d",
210 (int) (t / 60000), (int) (t % 60000 / 1000));
211 }
212 else
213 {
214 snprintf(buf, buf_size, "%d:%02d:%02d",
215 (int) (t / 3600000), (int) (t % 3600000 / 60000),
216 (int) (t % 60000 / 1000));
217 }
218}
219 202
220#if CONFIG_RTC 203#if CONFIG_RTC
221/* Create a filename with a date+time part. 204/* Create a filename with a date+time part.
@@ -1179,6 +1162,28 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename)
1179} 1162}
1180#endif /* !defined(__PCTOOL__) */ 1163#endif /* !defined(__PCTOOL__) */
1181 1164
1165/* Format time into buf.
1166 *
1167 * buf - buffer to format to.
1168 * buf_size - size of buffer.
1169 * t - time to format, in milliseconds.
1170 */
1171void format_time(char* buf, int buf_size, long t)
1172{
1173 if ( t < 3600000 )
1174 {
1175 snprintf(buf, buf_size, "%d:%02d",
1176 (int) (t / 60000), (int) (t % 60000 / 1000));
1177 }
1178 else
1179 {
1180 snprintf(buf, buf_size, "%d:%02d:%02d",
1181 (int) (t / 3600000), (int) (t % 3600000 / 60000),
1182 (int) (t % 60000 / 1000));
1183 }
1184}
1185
1186
1182/** Open a UTF-8 file and set file descriptor to first byte after BOM. 1187/** Open a UTF-8 file and set file descriptor to first byte after BOM.
1183 * If no BOM is present this behaves like open(). 1188 * If no BOM is present this behaves like open().
1184 * If the file is opened for writing and O_TRUNC is set, write a BOM to 1189 * If the file is opened for writing and O_TRUNC is set, write a BOM to
diff --git a/apps/settings.h b/apps/settings.h
index e90b1a83bf..9ef8323276 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -51,6 +51,9 @@ struct opt_items {
51/* name of directory where configuration, fonts and other data 51/* name of directory where configuration, fonts and other data
52 * files are stored */ 52 * files are stored */
53#ifdef __PCTOOL__ 53#ifdef __PCTOOL__
54#undef ROCKBOX_DIR
55#undef ROCKBOX_DIR_LEN
56#undef WPS_DIR
54#define ROCKBOX_DIR "." 57#define ROCKBOX_DIR "."
55#define ROCKBOX_DIR_LEN 1 58#define ROCKBOX_DIR_LEN 1
56#else 59#else