summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-01 08:45:49 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-01 08:45:49 +0000
commit7dfd0c065139b145590c4317ed74f2ce34deb596 (patch)
treee967c740b8c778d963864a5725ec15ce234769cc /lib
parent7da040bf22e936c19a495bfe10b746be77a76d21 (diff)
downloadrockbox-7dfd0c065139b145590c4317ed74f2ce34deb596.tar.gz
rockbox-7dfd0c065139b145590c4317ed74f2ce34deb596.tar.bz2
rockbox-7dfd0c065139b145590c4317ed74f2ce34deb596.zip
Theme Editor: Implemented JdGordon's tag newline-eating mechanism
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27210 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib')
-rw-r--r--lib/skin_parser/skin_parser.c20
-rw-r--r--lib/skin_parser/tag_table.c20
-rw-r--r--lib/skin_parser/tag_table.h2
3 files changed, 29 insertions, 13 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index b9485208ab..dbb5cbe93e 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -456,8 +456,18 @@ static int skin_parse_tag(struct skin_element* element, char** document)
return 1;
}
+ /* Eating a newline if necessary */
+ if(tag_args[0] == '\n')
+ {
+ if(*cursor == '\n')
+ cursor++;
+ *document = cursor;
+ return 1;
+ }
+
/* Checking the number of arguments and allocating args */
- if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|')
+ if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|'
+ && tag_args[0] != '\n')
{
skin_error(ARGLIST_EXPECTED);
return 0;
@@ -505,7 +515,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
for(i = 0; i < num_args; i++)
{
/* Making sure we haven't run out of arguments */
- if(*tag_args == '\0')
+ if(*tag_args == '\0' || *tag_args == '\n')
{
skin_error(TOO_MANY_ARGS);
return 0;
@@ -604,12 +614,16 @@ static int skin_parse_tag(struct skin_element* element, char** document)
}
/* Checking for a premature end */
- if(*tag_args != '\0' && !optional)
+ if(*tag_args != '\0' && *tag_args != '\n' && !optional)
{
skin_error(INSUFFICIENT_ARGS);
return 0;
}
+ if(*tag_args == '\n')
+ if(*cursor == '\n')
+ cursor++;
+
*document = cursor;
return 1;
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
index 945e8cfab2..125b9a6492 100644
--- a/lib/skin_parser/tag_table.c
+++ b/lib/skin_parser/tag_table.c
@@ -163,23 +163,23 @@ struct tag_info legal_tags[] =
{ SKIN_TOKEN_SUBLINE_SCROLL, "s", "" },
{ SKIN_TOKEN_SUBLINE_TIMEOUT, "t" , "S" },
- { SKIN_TOKEN_ENABLE_THEME, "we", "" },
- { SKIN_TOKEN_DISABLE_THEME, "wd", "" },
- { SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "" },
+ { SKIN_TOKEN_ENABLE_THEME, "we", "\n" },
+ { SKIN_TOKEN_DISABLE_THEME, "wd", "\n" },
+ { SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "\n" },
- { SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I" },
+ { SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I\n" },
{ SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" },
- { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" },
+ { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII\n" },
- { SKIN_TOKEN_LOAD_FONT, "Fl" , "IF"},
- { SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss"},
+ { SKIN_TOKEN_LOAD_FONT, "Fl" , "IF\n"},
+ { SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss\n"},
{ SKIN_TOKEN_ALBUMART_DISPLAY, "Cd" , ""},
{ SKIN_TOKEN_ALBUMART_FOUND, "C" , ""},
{ SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"},
{ SKIN_TOKEN_UIVIEWPORT_ENABLE, "VI" , "S"},
- { SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC"},
+ { SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC\n"},
{ SKIN_TOKEN_LIST_TITLE_TEXT, "Lt" , ""},
{ SKIN_TOKEN_LIST_TITLE_ICON, "Li" , ""},
@@ -190,7 +190,7 @@ struct tag_info legal_tags[] =
{ SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "sIIiii"},
{ SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii"},
- { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f"},
+ { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f\n"},
{ SKIN_TOKEN_SETTING, "St" , "S"},
{ SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S"},
@@ -198,7 +198,7 @@ struct tag_info legal_tags[] =
{ SKIN_TOKEN_LASTTOUCH, "Tl" , "|S"},
{ SKIN_TOKEN_CURRENT_SCREEN, "cs", "" },
- { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS"},
+ { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS\n"},
{ SKIN_TOKEN_HAVE_RECORDING, "Rp" , ""},
{ SKIN_TOKEN_IS_RECORDING, "Rr" , ""},
diff --git a/lib/skin_parser/tag_table.h b/lib/skin_parser/tag_table.h
index ff399dd1f1..4035789c82 100644
--- a/lib/skin_parser/tag_table.h
+++ b/lib/skin_parser/tag_table.h
@@ -249,6 +249,8 @@ enum skin_token_type {
* f - Nullable file name
* C - Required skin code
* N - any amount of strings.. must be the last param in the list
+ * \n - causes the parser to eat everything up to and including the \n
+ * MUST be the last character of the prams string
* Any nullable parameter may be replaced in the WPS file
* with a '-'. To specify that parameters may be left off
* altogether, place a '|' in the parameter string. For