summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-05-29 19:00:36 +0000
committerDave Chapman <dave@dchapman.com>2007-05-29 19:00:36 +0000
commitf0d4fc6c6b146197c0fc51753d838252766aeda2 (patch)
tree14a80b9a30d14b63c50f3350f9c2cececdc1baef /apps/gui
parentbe0cbc940641264fe536ea1b3c1153f627367f55 (diff)
downloadrockbox-f0d4fc6c6b146197c0fc51753d838252766aeda2.zip
rockbox-f0d4fc6c6b146197c0fc51753d838252766aeda2.tar.gz
rockbox-f0d4fc6c6b146197c0fc51753d838252766aeda2.tar.bz2
rockbox-f0d4fc6c6b146197c0fc51753d838252766aeda2.tar.xz
Commit my patch from FS#7179 - a standalone command-line checkwps tool. To build, just type "make checkwps" in tools and run it with "checkwps wpsname.wps".
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13517 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/gwps-common.c26
-rw-r--r--apps/gui/wps_debug.c8
-rw-r--r--apps/gui/wps_parser.c32
3 files changed, 38 insertions, 28 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index b25168f..2cdb92d 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1969,29 +1969,3 @@ bool gui_wps_refresh(struct gui_wps *gwps,
return true;
}
-int wps_subline_index(struct wps_data *data, int line, int subline)
-{
- return data->lines[line].first_subline_idx + subline;
-}
-
-int wps_first_token_index(struct wps_data *data, int line, int subline)
-{
- int first_subline_idx = data->lines[line].first_subline_idx;
- return data->sublines[first_subline_idx + subline].first_token_idx;
-}
-
-int wps_last_token_index(struct wps_data *data, int line, int subline)
-{
- int first_subline_idx = data->lines[line].first_subline_idx;
- int idx = first_subline_idx + subline;
- if (idx < data->num_sublines - 1)
- {
- /* This subline ends where the next begins */
- return data->sublines[idx+1].first_token_idx - 1;
- }
- else
- {
- /* The last subline goes to the end */
- return data->num_tokens - 1;
- }
-}
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 8ba4b6f..ae54278 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -22,13 +22,17 @@
#include <stdio.h>
#include <string.h>
#include "gwps.h"
+#ifdef __PCTOOL__
+#define DEBUGF printf
+#else
#include "debug.h"
+#endif
#define PARSE_FAIL_UNCLOSED_COND 1
#define PARSE_FAIL_INVALID_CHAR 2
#define PARSE_FAIL_COND_SYNTAX_ERROR 3
-#ifdef SIMULATOR
+#if defined(SIMULATOR) || defined(__PCTOOL__)
extern bool debug_wps;
#endif
@@ -467,7 +471,7 @@ static void print_img_cond_indexes(struct wps_data *data)
void print_debug_info(struct wps_data *data, int fail, int line)
{
-#ifdef SIMULATOR
+#if defined(SIMULATOR) || defined(__PCTOOL__)
if (debug_wps)
{
dump_wps_tokens(data);
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index be0ef4e..d363d6d 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "atoi.h"
#include "gwps.h"
+#ifndef __PCTOOL__
#include "settings.h"
#include "debug.h"
#include "plugin.h"
@@ -36,6 +37,8 @@
#include "backdrop.h"
#endif
+#endif
+
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
@@ -1008,6 +1011,7 @@ bool wps_data_load(struct wps_data *wps_data,
* wants to be a virtual file. Feel free to modify dirbrowse()
* if you're feeling brave.
*/
+#ifndef __PCTOOL__
if (! strcmp(buf, WPS_DEFAULTCFG) )
{
global_settings.wps_file[0] = 0;
@@ -1021,6 +1025,7 @@ bool wps_data_load(struct wps_data *wps_data,
return false;
}
#endif
+#endif /* __PCTOOL__ */
int fd = open(buf, O_RDONLY);
@@ -1080,3 +1085,30 @@ bool wps_data_load(struct wps_data *wps_data,
return true;
}
}
+
+int wps_subline_index(struct wps_data *data, int line, int subline)
+{
+ return data->lines[line].first_subline_idx + subline;
+}
+
+int wps_first_token_index(struct wps_data *data, int line, int subline)
+{
+ int first_subline_idx = data->lines[line].first_subline_idx;
+ return data->sublines[first_subline_idx + subline].first_token_idx;
+}
+
+int wps_last_token_index(struct wps_data *data, int line, int subline)
+{
+ int first_subline_idx = data->lines[line].first_subline_idx;
+ int idx = first_subline_idx + subline;
+ if (idx < data->num_sublines - 1)
+ {
+ /* This subline ends where the next begins */
+ return data->sublines[idx+1].first_token_idx - 1;
+ }
+ else
+ {
+ /* The last subline goes to the end */
+ return data->num_tokens - 1;
+ }
+}