summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-01 16:44:52 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-01 16:44:52 +0000
commit0a054b288b4ac71f384a18f7c9f8835863fe3751 (patch)
treef842db8e178d622b0c9226616abd6a436308e5a5 /utils
parent2267bd37b275879ec43e39df5d21ce44a91c742c (diff)
downloadrockbox-0a054b288b4ac71f384a18f7c9f8835863fe3751.tar.gz
rockbox-0a054b288b4ac71f384a18f7c9f8835863fe3751.tar.bz2
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.cpp5
-rw-r--r--utils/themeeditor/skin_debug.c4
-rw-r--r--utils/themeeditor/skin_parser.c12
-rw-r--r--utils/themeeditor/skin_parser.h2
-rw-r--r--utils/themeeditor/tag_table.c7
-rw-r--r--utils/themeeditor/tag_table.h2
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 @@
extern "C"
{
#include "symbols.h"
+#include "tag_table.h"
}
#include "parsetreenode.h"
@@ -140,7 +141,7 @@ QString ParseTreeNode::genCode() const
/* When generating code, we DO NOT insert the leading TAGSYM, leave
* the calling functions to handle that
*/
- buffer.append(element->name);
+ buffer.append(element->tag->name);
if(element->params_count > 0)
{
@@ -294,7 +295,7 @@ QVariant ParseTreeNode::data(int column) const
return QString(element->text);
case TAG:
- return QString(element->name);
+ return QString(element->tag->name);
}
}
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 @@
#include "skin_parser.h"
#include "skin_debug.h"
+#include "tag_table.h"
/* Global variables for debug output */
int debug_indent_level = 0;
@@ -123,7 +124,8 @@ void skin_debug_tree(struct skin_element* root)
break;
case TAG:
- printf("[ %s tag on line %d with %d arguments\n", current->name,
+ printf("[ %s tag on line %d with %d arguments\n",
+ current->tag->name,
current->line, current->params_count);
debug_indent_level++;
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)
char tag_name[3];
char* tag_args;
+ struct tag_info *tag;
int num_args = 1;
int i;
@@ -361,12 +362,12 @@ int skin_parse_tag(struct skin_element* element, char** document)
tag_name[2] = '\0';
/* First we check the two characters after the '%', then a single char */
- tag_args = find_tag(tag_name);
+ tag = find_tag(tag_name);
- if(!tag_args)
+ if(!tag)
{
tag_name[1] = '\0';
- tag_args = find_tag(tag_name);
+ tag = find_tag(tag_name);
cursor++;
}
else
@@ -374,7 +375,7 @@ int skin_parse_tag(struct skin_element* element, char** document)
cursor += 2;
}
- if(!tag_args)
+ if(!tag)
{
skin_error(ILLEGAL_TAG);
return 0;
@@ -382,7 +383,8 @@ int skin_parse_tag(struct skin_element* element, char** document)
/* Copying basic tag info */
element->type = TAG;
- strcpy(element->name, tag_name);
+ element->tag = tag;
+ tag_args = tag->params;
element->line = skin_line;
/* 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
char* text;
/* The tag or conditional name */
- char name[3];
+ struct tag_info *tag;
/* Pointer to and size of an array of parameters */
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[] =
{ SKIN_TOKEN_REC_MINUTES, "Rn" , ""},
{ SKIN_TOKEN_REC_HOURS, "Rh" , ""},
- { SKIN_TOKEN_UNKNOWN, "" , ""} /* Keep this here to mark the end of the table */
+ { SKIN_TOKEN_UNKNOWN, "" , ""}
+ /* Keep this here to mark the end of the table */
};
/* A table of legal escapable characters */
@@ -216,7 +217,7 @@ char legal_escape_characters[] = "%(,);#<|>";
* Just does a straight search through the tag table to find one by
* the given name
*/
-char* find_tag(char* name)
+struct tag_info* find_tag(char* name)
{
struct tag_info* current = legal_tags;
@@ -233,7 +234,7 @@ char* find_tag(char* name)
if(current->name[0] == '\0')
return NULL;
else
- return current->params;
+ return current;
}
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
* Finds a tag by name and returns its parameter list, or an empty
* string if the tag is not found in the table
*/
-char* find_tag(char* name);
+struct tag_info* find_tag(char* name);
/*
* Determines whether a character is legal to escape or not. If