summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_parser.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-11 01:50:06 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-11 01:50:06 +0000
commit3b9ffd28da4d2af023e6a77ab1d6ee683f90ef6b (patch)
treed779dd815acee6218e59e96329916114dcdf9ecd /apps/gui/skin_engine/skin_parser.c
parent86c543216f13c1171eefd6dd8116855a7fa9c4bd (diff)
downloadrockbox-3b9ffd28da4d2af023e6a77ab1d6ee683f90ef6b.tar.gz
rockbox-3b9ffd28da4d2af023e6a77ab1d6ee683f90ef6b.zip
New tag %ss() which lets you get a substring of another tag.
%ss(start, length, tag) - i.e %ss(0,1,%TL) will get the first letter of the current lines text. use - for the length to get the rest of the tag (e.g %ss(1,-,%TL) will get everything after the first letter). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30500 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r--apps/gui/skin_engine/skin_parser.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index a866101c1c..0db19645bc 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -720,6 +720,24 @@ static int parse_timeout_tag(struct skin_element *element,
return 0;
}
+static int parse_substring_tag(struct skin_element* element,
+ struct wps_token *token,
+ struct wps_data *wps_data)
+{
+ (void)wps_data;
+ struct substring *ss = (struct substring*)skin_buffer_alloc(sizeof(struct substring));
+ if (!ss)
+ return 1;
+ ss->start = element->params[0].data.number;
+ if (element->params[1].type == DEFAULT)
+ ss->length = -1;
+ else
+ ss->length = element->params[1].data.number;
+ ss->token = element->params[2].data.code->data;
+ token->value.data = ss;
+ return 0;
+}
+
static int parse_progressbar_tag(struct skin_element* element,
struct wps_token *token,
struct wps_data *wps_data)
@@ -1788,6 +1806,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
case SKIN_TOKEN_LOGICAL_IF:
function = parse_logical_if;
break;
+ case SKIN_TOKEN_SUBSTRING:
+ function = parse_substring_tag;
+ break;
case SKIN_TOKEN_PROGRESSBAR:
case SKIN_TOKEN_VOLUME:
case SKIN_TOKEN_BATTERY_PERCENT: