summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index be0ef4e271..d363d6d8cb 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -24,6 +24,7 @@
24#include <string.h> 24#include <string.h>
25#include "atoi.h" 25#include "atoi.h"
26#include "gwps.h" 26#include "gwps.h"
27#ifndef __PCTOOL__
27#include "settings.h" 28#include "settings.h"
28#include "debug.h" 29#include "debug.h"
29#include "plugin.h" 30#include "plugin.h"
@@ -36,6 +37,8 @@
36#include "backdrop.h" 37#include "backdrop.h"
37#endif 38#endif
38 39
40#endif
41
39#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 42#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
40#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps" 43#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
41 44
@@ -1008,6 +1011,7 @@ bool wps_data_load(struct wps_data *wps_data,
1008 * wants to be a virtual file. Feel free to modify dirbrowse() 1011 * wants to be a virtual file. Feel free to modify dirbrowse()
1009 * if you're feeling brave. 1012 * if you're feeling brave.
1010 */ 1013 */
1014#ifndef __PCTOOL__
1011 if (! strcmp(buf, WPS_DEFAULTCFG) ) 1015 if (! strcmp(buf, WPS_DEFAULTCFG) )
1012 { 1016 {
1013 global_settings.wps_file[0] = 0; 1017 global_settings.wps_file[0] = 0;
@@ -1021,6 +1025,7 @@ bool wps_data_load(struct wps_data *wps_data,
1021 return false; 1025 return false;
1022 } 1026 }
1023#endif 1027#endif
1028#endif /* __PCTOOL__ */
1024 1029
1025 int fd = open(buf, O_RDONLY); 1030 int fd = open(buf, O_RDONLY);
1026 1031
@@ -1080,3 +1085,30 @@ bool wps_data_load(struct wps_data *wps_data,
1080 return true; 1085 return true;
1081 } 1086 }
1082} 1087}
1088
1089int wps_subline_index(struct wps_data *data, int line, int subline)
1090{
1091 return data->lines[line].first_subline_idx + subline;
1092}
1093
1094int wps_first_token_index(struct wps_data *data, int line, int subline)
1095{
1096 int first_subline_idx = data->lines[line].first_subline_idx;
1097 return data->sublines[first_subline_idx + subline].first_token_idx;
1098}
1099
1100int wps_last_token_index(struct wps_data *data, int line, int subline)
1101{
1102 int first_subline_idx = data->lines[line].first_subline_idx;
1103 int idx = first_subline_idx + subline;
1104 if (idx < data->num_sublines - 1)
1105 {
1106 /* This subline ends where the next begins */
1107 return data->sublines[idx+1].first_token_idx - 1;
1108 }
1109 else
1110 {
1111 /* The last subline goes to the end */
1112 return data->num_tokens - 1;
1113 }
1114}