summaryrefslogtreecommitdiff
path: root/lib/skin_parser/skin_parser.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-10-28 11:00:36 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-10-28 11:00:36 +0000
commit943de3ce49e3ff4bbdefa7459dbc3b885fe145ad (patch)
tree4d0791456aa944700570e7207f6f8717e8c1a667 /lib/skin_parser/skin_parser.c
parentdb2a8ffd30f3c1b5a17f318d4acbbeab54bab4c3 (diff)
downloadrockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.tar.gz
rockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.zip
skin_parser: Change the way hardware conditionals are done (i.e %?cc)
They now only parse the correct branch (so only the true branch, or only the false branch). This shuold allow you to load different images/backdrops with the same id's depending on the targets hardware. Add a new %Tp - "touchscreen present?" tag to check if the target has a touchscreen git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28370 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
-rw-r--r--lib/skin_parser/skin_parser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 64ac462c2c..f574d3f7a2 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -877,6 +877,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
877#ifdef ROCKBOX 877#ifdef ROCKBOX
878 bool feature_available = true; 878 bool feature_available = true;
879 const char *false_branch = NULL; 879 const char *false_branch = NULL;
880 const char *conditional_end = NULL;
880#endif 881#endif
881 882
882 /* Some conditional tags allow for target feature checking, 883 /* Some conditional tags allow for target feature checking,
@@ -955,6 +956,12 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
955 false_branch = cursor+1; 956 false_branch = cursor+1;
956 children--; 957 children--;
957 } 958 }
959 if (element->tag->flags&FEATURE_TAG)
960 {
961 if (feature_available)
962 children--;
963 }
964 conditional_end = cursor;
958 /* if we are skipping the true branch fix that up */ 965 /* if we are skipping the true branch fix that up */
959 cursor = false_branch ? false_branch : bookmark; 966 cursor = false_branch ? false_branch : bookmark;
960#else 967#else
@@ -969,7 +976,13 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
969 for(i = 0; i < children; i++) 976 for(i = 0; i < children; i++)
970 { 977 {
971 element->children[i] = skin_parse_code_as_arg(&cursor); 978 element->children[i] = skin_parse_code_as_arg(&cursor);
979 if (element->children[i] == NULL)
980 return 0;
972 skip_whitespace(&cursor); 981 skip_whitespace(&cursor);
982#ifdef ROCKBOX
983 if ((element->tag->flags&FEATURE_TAG) && feature_available)
984 cursor = conditional_end;
985#endif
973 986
974 if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM) 987 if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM)
975 { 988 {
@@ -986,7 +999,6 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
986 cursor++; 999 cursor++;
987 } 1000 }
988 } 1001 }
989
990 *document = cursor; 1002 *document = cursor;
991 1003
992 return 1; 1004 return 1;