summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-08-29 21:08:38 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-08-29 21:08:38 +0000
commit5d22e3cbdd251819a4d2d07b9a12994d5aef778d (patch)
tree4c6a81187ccf065a5f296a903b9f7da88503e403 /apps
parentcc31b1fbdae455f975b69dd6bffc23d8bd021566 (diff)
downloadrockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.zip
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.gz
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.bz2
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.xz
Add wpseditor, the Google Summer of Code 2008 project of Rostislav Chekan. Closes FS#9327
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18362 a1c6a512-1295-4272-9138-f99709370657
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 4e6af38..f843b98 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -25,7 +25,11 @@
#include <string.h>
#include "gwps.h"
#ifdef __PCTOOL__
+#ifdef WPSEDITOR
+#include "proxy.h"
+#else
#define DEBUGF printf
+#endif
#else
#include "debug.h"
#endif
@@ -589,18 +593,18 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
{
char buf[64];
- DEBUGF("Failed parsing on line %d : ", line);
+ DEBUGF("ERR: Failed parsing on line %d : ", line);
switch (fail)
{
case PARSE_OK:
break;
case PARSE_FAIL_UNCLOSED_COND:
- DEBUGF("Unclosed conditional");
+ DEBUGF("ERR: Unclosed conditional");
break;
case PARSE_FAIL_INVALID_CHAR:
- DEBUGF("unexpected conditional char after token %d: \"%s\"",
+ DEBUGF("ERR: Unexpected conditional char after token %d: \"%s\"",
data->num_tokens-1,
get_token_desc(&data->tokens[data->num_tokens-1], data,
buf, sizeof(buf))
@@ -608,7 +612,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
break;
case PARSE_FAIL_COND_SYNTAX_ERROR:
- DEBUGF("Conditional syntax error after token %d: \"%s\"",
+ DEBUGF("ERR: Conditional syntax error after token %d: \"%s\"",
data->num_tokens-1,
get_token_desc(&data->tokens[data->num_tokens-1], data,
buf, sizeof(buf))
@@ -616,7 +620,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
break;
case PARSE_FAIL_COND_INVALID_PARAM:
- DEBUGF("Invalid parameter list for token %d: \"%s\"",
+ DEBUGF("ERR: Invalid parameter list for token %d: \"%s\"",
data->num_tokens,
get_token_desc(&data->tokens[data->num_tokens], data,
buf, sizeof(buf))
@@ -624,7 +628,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
break;
case PARSE_FAIL_LIMITS_EXCEEDED:
- DEBUGF("Limits exceeded");
+ DEBUGF("ERR: Limits exceeded");
break;
}
DEBUGF("\n");
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 714c419..b2baddd 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -28,14 +28,25 @@
#include "plugin.h"
#ifdef __PCTOOL__
+#ifdef WPSEDITOR
+#include "proxy.h"
+#include "settings.h"
+#include "sysfont.h"
+#include "gwps.h"
+#include "font.h"
+#include "bmp.h"
+#include "backdrop.h"
+#include "ctype.h"
+#else
+#include "checkwps.h"
+#define SYSFONT_HEIGHT 8
#define DEBUGF printf
+#endif /*WPSEDITOR*/
#define FONT_SYSFIXED 0
#define FONT_UI 1
-#define SYSFONT_HEIGHT 8
-#include "checkwps.h"
#else
#include "debug.h"
-#endif
+#endif /*__PCTOOL__*/
#ifndef __PCTOOL__
#include <ctype.h>
diff --git a/apps/misc.c b/apps/misc.c
index f3a937f..cd59dbc 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -27,7 +27,10 @@
#ifdef __PCTOOL__
#include <stdint.h>
#include <stdarg.h>
-#include <unistd.h>
+#include <stdio.h>
+#ifdef WPSEDITOR
+#include "string.h"
+#endif
#else
#include "sprintf.h"
#include "lang.h"
@@ -196,26 +199,6 @@ char *create_numbered_filename(char *buffer, const char *path,
return buffer;
}
-/* Format time into buf.
- *
- * buf - buffer to format to.
- * buf_size - size of buffer.
- * t - time to format, in milliseconds.
- */
-void format_time(char* buf, int buf_size, long t)
-{
- if ( t < 3600000 )
- {
- snprintf(buf, buf_size, "%d:%02d",
- (int) (t / 60000), (int) (t % 60000 / 1000));
- }
- else
- {
- snprintf(buf, buf_size, "%d:%02d:%02d",
- (int) (t / 3600000), (int) (t % 3600000 / 60000),
- (int) (t % 60000 / 1000));
- }
-}
#if CONFIG_RTC
/* Create a filename with a date+time part.
@@ -1179,6 +1162,28 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename)
}
#endif /* !defined(__PCTOOL__) */
+/* Format time into buf.
+ *
+ * buf - buffer to format to.
+ * buf_size - size of buffer.
+ * t - time to format, in milliseconds.
+ */
+void format_time(char* buf, int buf_size, long t)
+{
+ if ( t < 3600000 )
+ {
+ snprintf(buf, buf_size, "%d:%02d",
+ (int) (t / 60000), (int) (t % 60000 / 1000));
+ }
+ else
+ {
+ snprintf(buf, buf_size, "%d:%02d:%02d",
+ (int) (t / 3600000), (int) (t % 3600000 / 60000),
+ (int) (t % 60000 / 1000));
+ }
+}
+
+
/** Open a UTF-8 file and set file descriptor to first byte after BOM.
* If no BOM is present this behaves like open().
* 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 e90b1a8..9ef8323 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -51,6 +51,9 @@ struct opt_items {
/* name of directory where configuration, fonts and other data
* files are stored */
#ifdef __PCTOOL__
+#undef ROCKBOX_DIR
+#undef ROCKBOX_DIR_LEN
+#undef WPS_DIR
#define ROCKBOX_DIR "."
#define ROCKBOX_DIR_LEN 1
#else