diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-01 16:44:52 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-01 16:44:52 +0000 |
commit | 0a054b288b4ac71f384a18f7c9f8835863fe3751 (patch) | |
tree | f842db8e178d622b0c9226616abd6a436308e5a5 /utils | |
parent | 2267bd37b275879ec43e39df5d21ce44a91c742c (diff) | |
download | rockbox-0a054b288b4ac71f384a18f7c9f8835863fe3751.tar.gz rockbox-0a054b288b4ac71f384a18f7c9f8835863fe3751.zip |
Committing FS#11345 by JdGordon. Theme editor parser now includes full tag information in the skin_element struct
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26448 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/parsetreenode.cpp | 5 | ||||
-rw-r--r-- | utils/themeeditor/skin_debug.c | 4 | ||||
-rw-r--r-- | utils/themeeditor/skin_parser.c | 12 | ||||
-rw-r--r-- | utils/themeeditor/skin_parser.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/tag_table.c | 7 | ||||
-rw-r--r-- | utils/themeeditor/tag_table.h | 2 |
6 files changed, 19 insertions, 13 deletions
diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp index 7b77b62ecc..a93295f357 100644 --- a/utils/themeeditor/parsetreenode.cpp +++ b/utils/themeeditor/parsetreenode.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | extern "C" | 22 | extern "C" |
23 | { | 23 | { |
24 | #include "symbols.h" | 24 | #include "symbols.h" |
25 | #include "tag_table.h" | ||
25 | } | 26 | } |
26 | 27 | ||
27 | #include "parsetreenode.h" | 28 | #include "parsetreenode.h" |
@@ -140,7 +141,7 @@ QString ParseTreeNode::genCode() const | |||
140 | /* When generating code, we DO NOT insert the leading TAGSYM, leave | 141 | /* When generating code, we DO NOT insert the leading TAGSYM, leave |
141 | * the calling functions to handle that | 142 | * the calling functions to handle that |
142 | */ | 143 | */ |
143 | buffer.append(element->name); | 144 | buffer.append(element->tag->name); |
144 | 145 | ||
145 | if(element->params_count > 0) | 146 | if(element->params_count > 0) |
146 | { | 147 | { |
@@ -294,7 +295,7 @@ QVariant ParseTreeNode::data(int column) const | |||
294 | return QString(element->text); | 295 | return QString(element->text); |
295 | 296 | ||
296 | case TAG: | 297 | case TAG: |
297 | return QString(element->name); | 298 | return QString(element->tag->name); |
298 | } | 299 | } |
299 | } | 300 | } |
300 | else if(param) | 301 | else if(param) |
diff --git a/utils/themeeditor/skin_debug.c b/utils/themeeditor/skin_debug.c index 06764f9053..360d7208b9 100644 --- a/utils/themeeditor/skin_debug.c +++ b/utils/themeeditor/skin_debug.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "skin_parser.h" | 26 | #include "skin_parser.h" |
27 | #include "skin_debug.h" | 27 | #include "skin_debug.h" |
28 | #include "tag_table.h" | ||
28 | 29 | ||
29 | /* Global variables for debug output */ | 30 | /* Global variables for debug output */ |
30 | int debug_indent_level = 0; | 31 | int debug_indent_level = 0; |
@@ -123,7 +124,8 @@ void skin_debug_tree(struct skin_element* root) | |||
123 | break; | 124 | break; |
124 | 125 | ||
125 | case TAG: | 126 | case TAG: |
126 | printf("[ %s tag on line %d with %d arguments\n", current->name, | 127 | printf("[ %s tag on line %d with %d arguments\n", |
128 | current->tag->name, | ||
127 | current->line, current->params_count); | 129 | current->line, current->params_count); |
128 | debug_indent_level++; | 130 | debug_indent_level++; |
129 | skin_debug_params(current->params_count, current->params); | 131 | skin_debug_params(current->params_count, current->params); |
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c index 74ba7bd71d..4f7acf90fb 100644 --- a/utils/themeeditor/skin_parser.c +++ b/utils/themeeditor/skin_parser.c | |||
@@ -347,6 +347,7 @@ int skin_parse_tag(struct skin_element* element, char** document) | |||
347 | 347 | ||
348 | char tag_name[3]; | 348 | char tag_name[3]; |
349 | char* tag_args; | 349 | char* tag_args; |
350 | struct tag_info *tag; | ||
350 | 351 | ||
351 | int num_args = 1; | 352 | int num_args = 1; |
352 | int i; | 353 | int i; |
@@ -361,12 +362,12 @@ int skin_parse_tag(struct skin_element* element, char** document) | |||
361 | tag_name[2] = '\0'; | 362 | tag_name[2] = '\0'; |
362 | 363 | ||
363 | /* First we check the two characters after the '%', then a single char */ | 364 | /* First we check the two characters after the '%', then a single char */ |
364 | tag_args = find_tag(tag_name); | 365 | tag = find_tag(tag_name); |
365 | 366 | ||
366 | if(!tag_args) | 367 | if(!tag) |
367 | { | 368 | { |
368 | tag_name[1] = '\0'; | 369 | tag_name[1] = '\0'; |
369 | tag_args = find_tag(tag_name); | 370 | tag = find_tag(tag_name); |
370 | cursor++; | 371 | cursor++; |
371 | } | 372 | } |
372 | else | 373 | else |
@@ -374,7 +375,7 @@ int skin_parse_tag(struct skin_element* element, char** document) | |||
374 | cursor += 2; | 375 | cursor += 2; |
375 | } | 376 | } |
376 | 377 | ||
377 | if(!tag_args) | 378 | if(!tag) |
378 | { | 379 | { |
379 | skin_error(ILLEGAL_TAG); | 380 | skin_error(ILLEGAL_TAG); |
380 | return 0; | 381 | return 0; |
@@ -382,7 +383,8 @@ int skin_parse_tag(struct skin_element* element, char** document) | |||
382 | 383 | ||
383 | /* Copying basic tag info */ | 384 | /* Copying basic tag info */ |
384 | element->type = TAG; | 385 | element->type = TAG; |
385 | strcpy(element->name, tag_name); | 386 | element->tag = tag; |
387 | tag_args = tag->params; | ||
386 | element->line = skin_line; | 388 | element->line = skin_line; |
387 | 389 | ||
388 | /* Checking for the * flag */ | 390 | /* Checking for the * flag */ |
diff --git a/utils/themeeditor/skin_parser.h b/utils/themeeditor/skin_parser.h index 77b4ed1158..27d39cd5cc 100644 --- a/utils/themeeditor/skin_parser.h +++ b/utils/themeeditor/skin_parser.h | |||
@@ -101,7 +101,7 @@ struct skin_element | |||
101 | char* text; | 101 | char* text; |
102 | 102 | ||
103 | /* The tag or conditional name */ | 103 | /* The tag or conditional name */ |
104 | char name[3]; | 104 | struct tag_info *tag; |
105 | 105 | ||
106 | /* Pointer to and size of an array of parameters */ | 106 | /* Pointer to and size of an array of parameters */ |
107 | int params_count; | 107 | int params_count; |
diff --git a/utils/themeeditor/tag_table.c b/utils/themeeditor/tag_table.c index 69e85adda3..74eb6cbe26 100644 --- a/utils/themeeditor/tag_table.c +++ b/utils/themeeditor/tag_table.c | |||
@@ -206,7 +206,8 @@ struct tag_info legal_tags[] = | |||
206 | { SKIN_TOKEN_REC_MINUTES, "Rn" , ""}, | 206 | { SKIN_TOKEN_REC_MINUTES, "Rn" , ""}, |
207 | { SKIN_TOKEN_REC_HOURS, "Rh" , ""}, | 207 | { SKIN_TOKEN_REC_HOURS, "Rh" , ""}, |
208 | 208 | ||
209 | { SKIN_TOKEN_UNKNOWN, "" , ""} /* Keep this here to mark the end of the table */ | 209 | { SKIN_TOKEN_UNKNOWN, "" , ""} |
210 | /* Keep this here to mark the end of the table */ | ||
210 | }; | 211 | }; |
211 | 212 | ||
212 | /* A table of legal escapable characters */ | 213 | /* A table of legal escapable characters */ |
@@ -216,7 +217,7 @@ char legal_escape_characters[] = "%(,);#<|>"; | |||
216 | * Just does a straight search through the tag table to find one by | 217 | * Just does a straight search through the tag table to find one by |
217 | * the given name | 218 | * the given name |
218 | */ | 219 | */ |
219 | char* find_tag(char* name) | 220 | struct tag_info* find_tag(char* name) |
220 | { | 221 | { |
221 | 222 | ||
222 | struct tag_info* current = legal_tags; | 223 | struct tag_info* current = legal_tags; |
@@ -233,7 +234,7 @@ char* find_tag(char* name) | |||
233 | if(current->name[0] == '\0') | 234 | if(current->name[0] == '\0') |
234 | return NULL; | 235 | return NULL; |
235 | else | 236 | else |
236 | return current->params; | 237 | return current; |
237 | 238 | ||
238 | } | 239 | } |
239 | 240 | ||
diff --git a/utils/themeeditor/tag_table.h b/utils/themeeditor/tag_table.h index 81d07a2a34..7f8d3a88ec 100644 --- a/utils/themeeditor/tag_table.h +++ b/utils/themeeditor/tag_table.h | |||
@@ -287,7 +287,7 @@ struct tag_info | |||
287 | * Finds a tag by name and returns its parameter list, or an empty | 287 | * Finds a tag by name and returns its parameter list, or an empty |
288 | * string if the tag is not found in the table | 288 | * string if the tag is not found in the table |
289 | */ | 289 | */ |
290 | char* find_tag(char* name); | 290 | struct tag_info* find_tag(char* name); |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * Determines whether a character is legal to escape or not. If | 293 | * Determines whether a character is legal to escape or not. If |