summaryrefslogtreecommitdiff
path: root/lib/skin_parser
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/skin_parser
parent7da040bf22e936c19a495bfe10b746be77a76d21 (diff)
downloadrockbox-7dfd0c065139b145590c4317ed74f2ce34deb596.tar.gz
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/skin_parser')
-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)
456 return 1; 456 return 1;
457 } 457 }
458 458
459 /* Eating a newline if necessary */
460 if(tag_args[0] == '\n')
461 {
462 if(*cursor == '\n')
463 cursor++;
464 *document = cursor;
465 return 1;
466 }
467
459 /* Checking the number of arguments and allocating args */ 468 /* Checking the number of arguments and allocating args */
460 if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|') 469 if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|'
470 && tag_args[0] != '\n')
461 { 471 {
462 skin_error(ARGLIST_EXPECTED); 472 skin_error(ARGLIST_EXPECTED);
463 return 0; 473 return 0;
@@ -505,7 +515,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
505 for(i = 0; i < num_args; i++) 515 for(i = 0; i < num_args; i++)
506 { 516 {
507 /* Making sure we haven't run out of arguments */ 517 /* Making sure we haven't run out of arguments */
508 if(*tag_args == '\0') 518 if(*tag_args == '\0' || *tag_args == '\n')
509 { 519 {
510 skin_error(TOO_MANY_ARGS); 520 skin_error(TOO_MANY_ARGS);
511 return 0; 521 return 0;
@@ -604,12 +614,16 @@ static int skin_parse_tag(struct skin_element* element, char** document)
604 } 614 }
605 615
606 /* Checking for a premature end */ 616 /* Checking for a premature end */
607 if(*tag_args != '\0' && !optional) 617 if(*tag_args != '\0' && *tag_args != '\n' && !optional)
608 { 618 {
609 skin_error(INSUFFICIENT_ARGS); 619 skin_error(INSUFFICIENT_ARGS);
610 return 0; 620 return 0;
611 } 621 }
612 622
623 if(*tag_args == '\n')
624 if(*cursor == '\n')
625 cursor++;
626
613 *document = cursor; 627 *document = cursor;
614 628
615 return 1; 629 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[] =
163 { SKIN_TOKEN_SUBLINE_SCROLL, "s", "" }, 163 { SKIN_TOKEN_SUBLINE_SCROLL, "s", "" },
164 { SKIN_TOKEN_SUBLINE_TIMEOUT, "t" , "S" }, 164 { SKIN_TOKEN_SUBLINE_TIMEOUT, "t" , "S" },
165 165
166 { SKIN_TOKEN_ENABLE_THEME, "we", "" }, 166 { SKIN_TOKEN_ENABLE_THEME, "we", "\n" },
167 { SKIN_TOKEN_DISABLE_THEME, "wd", "" }, 167 { SKIN_TOKEN_DISABLE_THEME, "wd", "\n" },
168 { SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "" }, 168 { SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "\n" },
169 169
170 { SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I" }, 170 { SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I\n" },
171 { SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" }, 171 { SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" },
172 { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" }, 172 { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII\n" },
173 173
174 { SKIN_TOKEN_LOAD_FONT, "Fl" , "IF"}, 174 { SKIN_TOKEN_LOAD_FONT, "Fl" , "IF\n"},
175 { SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss"}, 175 { SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss\n"},
176 { SKIN_TOKEN_ALBUMART_DISPLAY, "Cd" , ""}, 176 { SKIN_TOKEN_ALBUMART_DISPLAY, "Cd" , ""},
177 { SKIN_TOKEN_ALBUMART_FOUND, "C" , ""}, 177 { SKIN_TOKEN_ALBUMART_FOUND, "C" , ""},
178 178
179 { SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"}, 179 { SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"},
180 { SKIN_TOKEN_UIVIEWPORT_ENABLE, "VI" , "S"}, 180 { SKIN_TOKEN_UIVIEWPORT_ENABLE, "VI" , "S"},
181 181
182 { SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC"}, 182 { SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC\n"},
183 { SKIN_TOKEN_LIST_TITLE_TEXT, "Lt" , ""}, 183 { SKIN_TOKEN_LIST_TITLE_TEXT, "Lt" , ""},
184 { SKIN_TOKEN_LIST_TITLE_ICON, "Li" , ""}, 184 { SKIN_TOKEN_LIST_TITLE_ICON, "Li" , ""},
185 185
@@ -190,7 +190,7 @@ struct tag_info legal_tags[] =
190 { SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "sIIiii"}, 190 { SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "sIIiii"},
191 { SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii"}, 191 { SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii"},
192 192
193 { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f"}, 193 { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f\n"},
194 194
195 { SKIN_TOKEN_SETTING, "St" , "S"}, 195 { SKIN_TOKEN_SETTING, "St" , "S"},
196 { SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S"}, 196 { SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S"},
@@ -198,7 +198,7 @@ struct tag_info legal_tags[] =
198 198
199 { SKIN_TOKEN_LASTTOUCH, "Tl" , "|S"}, 199 { SKIN_TOKEN_LASTTOUCH, "Tl" , "|S"},
200 { SKIN_TOKEN_CURRENT_SCREEN, "cs", "" }, 200 { SKIN_TOKEN_CURRENT_SCREEN, "cs", "" },
201 { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS"}, 201 { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS\n"},
202 202
203 { SKIN_TOKEN_HAVE_RECORDING, "Rp" , ""}, 203 { SKIN_TOKEN_HAVE_RECORDING, "Rp" , ""},
204 { SKIN_TOKEN_IS_RECORDING, "Rr" , ""}, 204 { 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 {
249 * f - Nullable file name 249 * f - Nullable file name
250 * C - Required skin code 250 * C - Required skin code
251 * N - any amount of strings.. must be the last param in the list 251 * N - any amount of strings.. must be the last param in the list
252 * \n - causes the parser to eat everything up to and including the \n
253 * MUST be the last character of the prams string
252 * Any nullable parameter may be replaced in the WPS file 254 * Any nullable parameter may be replaced in the WPS file
253 * with a '-'. To specify that parameters may be left off 255 * with a '-'. To specify that parameters may be left off
254 * altogether, place a '|' in the parameter string. For 256 * altogether, place a '|' in the parameter string. For