summaryrefslogtreecommitdiff
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-10 21:02:44 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-10 21:02:44 +0000
commit64321adf4331a97201321f5a37d17aa90fa5d5db (patch)
tree4ab86b70f8b4059432e713a1ef7c03613fa9ad0e /utils/themeeditor
parent6c522624b364b3d85ac7f95d55061d4677246dad (diff)
downloadrockbox-64321adf4331a97201321f5a37d17aa90fa5d5db.tar.gz
rockbox-64321adf4331a97201321f5a37d17aa90fa5d5db.zip
Theme Editor: Applied FS#11389, switched conditional elements to use tag fields along with children, instead of holding the tag as the first child
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26751 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/parsetreemodel.cpp4
-rw-r--r--utils/themeeditor/parsetreenode.cpp25
-rw-r--r--utils/themeeditor/skin_debug.c12
-rw-r--r--utils/themeeditor/skin_parser.c184
-rw-r--r--utils/themeeditor/skin_parser.h18
5 files changed, 112 insertions, 131 deletions
diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp
index 787122d02d..a709ea762f 100644
--- a/utils/themeeditor/parsetreemodel.cpp
+++ b/utils/themeeditor/parsetreemodel.cpp
@@ -257,8 +257,8 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value,
257 if(element->type != COMMENT && element->type != TEXT) 257 if(element->type != COMMENT && element->type != TEXT)
258 return false; 258 return false;
259 259
260 free(element->text); 260 free(element->data);
261 element->text = strdup(value.toString().trimmed().toAscii()); 261 element->data = strdup(value.toString().trimmed().toAscii());
262 } 262 }
263 263
264 emit dataChanged(index, index); 264 emit dataChanged(index, index);
diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp
index 3a20b1e003..10f15dfd73 100644
--- a/utils/themeeditor/parsetreenode.cpp
+++ b/utils/themeeditor/parsetreenode.cpp
@@ -56,8 +56,13 @@ ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent)
56 } 56 }
57 break; 57 break;
58 58
59 /* CONDITIONAL and SUBLINES fall through to the same code */
60 case CONDITIONAL: 59 case CONDITIONAL:
60 for(int i = 0; i < element->params_count; i++)
61 children.append(new ParseTreeNode(&data->params[i], this));
62 for(int i = 0; i < element->children_count; i++)
63 children.append(new ParseTreeNode(data->children[i], this));
64 break;
65
61 case SUBLINES: 66 case SUBLINES:
62 for(int i = 0; i < element->children_count; i++) 67 for(int i = 0; i < element->children_count; i++)
63 { 68 {
@@ -173,7 +178,7 @@ QString ParseTreeNode::genCode() const
173 break; 178 break;
174 179
175 case TEXT: 180 case TEXT:
176 for(char* cursor = element->text; *cursor; cursor++) 181 for(char* cursor = (char*)element->data; *cursor; cursor++)
177 { 182 {
178 if(find_escape_character(*cursor)) 183 if(find_escape_character(*cursor))
179 buffer.append(TAGSYM); 184 buffer.append(TAGSYM);
@@ -183,7 +188,7 @@ QString ParseTreeNode::genCode() const
183 188
184 case COMMENT: 189 case COMMENT:
185 buffer.append(COMMENTSYM); 190 buffer.append(COMMENTSYM);
186 buffer.append(element->text); 191 buffer.append((char*)element->data);
187 buffer.append('\n'); 192 buffer.append('\n');
188 break; 193 break;
189 } 194 }
@@ -228,6 +233,7 @@ QString ParseTreeNode::genCode() const
228int ParseTreeNode::genHash() const 233int ParseTreeNode::genHash() const
229{ 234{
230 int hash = 0; 235 int hash = 0;
236 char *text;
231 237
232 if(element) 238 if(element)
233 { 239 {
@@ -248,12 +254,13 @@ int ParseTreeNode::genHash() const
248 254
249 case COMMENT: 255 case COMMENT:
250 case TEXT: 256 case TEXT:
251 for(unsigned int i = 0; i < strlen(element->text); i++) 257 text = (char*)element->data;
258 for(unsigned int i = 0; i < strlen(text); i++)
252 { 259 {
253 if(i % 2) 260 if(i % 2)
254 hash += element->text[i] % element->type; 261 hash += text[i] % element->type;
255 else 262 else
256 hash += element->text[i] % element->type * 2; 263 hash += text[i] % element->type * 2;
257 } 264 }
258 break; 265 break;
259 } 266 }
@@ -370,12 +377,14 @@ QVariant ParseTreeNode::data(int column) const
370 case VIEWPORT: 377 case VIEWPORT:
371 case LINE: 378 case LINE:
372 case SUBLINES: 379 case SUBLINES:
373 case CONDITIONAL:
374 return QString(); 380 return QString();
375 381
382 case CONDITIONAL:
383 return QString(element->tag->name);
384
376 case TEXT: 385 case TEXT:
377 case COMMENT: 386 case COMMENT:
378 return QString(element->text); 387 return QString((char*)element->data);
379 388
380 case TAG: 389 case TAG:
381 return QString(element->tag->name); 390 return QString(element->tag->name);
diff --git a/utils/themeeditor/skin_debug.c b/utils/themeeditor/skin_debug.c
index eb132a3320..9a463c91e6 100644
--- a/utils/themeeditor/skin_debug.c
+++ b/utils/themeeditor/skin_debug.c
@@ -102,6 +102,7 @@ void skin_clear_errors()
102void skin_debug_tree(struct skin_element* root) 102void skin_debug_tree(struct skin_element* root)
103{ 103{
104 int i; 104 int i;
105 char *text;
105 106
106 struct skin_element* current = root; 107 struct skin_element* current = root;
107 108
@@ -123,18 +124,19 @@ void skin_debug_tree(struct skin_element* root)
123 break; 124 break;
124 125
125 case TEXT: 126 case TEXT:
126 printf("[ Plain text on line %d : %s ]\n", current->line, 127 text = current->data;
127 current->text); 128 printf("[ Plain text on line %d : %s ]\n", current->line, text);
128 break; 129 break;
129 130
130 case COMMENT: 131 case COMMENT:
132 text = current->data;
131 printf("[ Comment on line %d: ", current->line); 133 printf("[ Comment on line %d: ", current->line);
132 for(i = 0; i < (int)strlen(current->text); i++) 134 for(i = 0; i < (int)strlen(text); i++)
133 { 135 {
134 if(current->text[i] == '\n') 136 if(text[i] == '\n')
135 printf("\\n"); 137 printf("\\n");
136 else 138 else
137 printf("%c", current->text[i]); 139 printf("%c", text[i]);
138 } 140 }
139 printf(" ]\n"); 141 printf(" ]\n");
140 break; 142 break;
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index 401181cc3d..0eda9daa09 100644
--- a/utils/themeeditor/skin_parser.c
+++ b/utils/themeeditor/skin_parser.c
@@ -30,27 +30,32 @@
30#include "symbols.h" 30#include "symbols.h"
31#include "skin_scan.h" 31#include "skin_scan.h"
32 32
33#ifdef ROCKBOX
33/* Declaration of parse tree buffer */ 34/* Declaration of parse tree buffer */
34char skin_parse_tree[SKIN_MAX_MEMORY]; 35#define SKIN_MAX_MEMORY (30*1024)
35int skin_current_block = 0; 36static char skin_parse_tree[SKIN_MAX_MEMORY];
37static char *skin_buffer;
38#endif
36 39
37/* Global variables for the parser */ 40/* Global variables for the parser */
38int skin_line = 0; 41int skin_line = 0;
39 42
40/* Auxiliary parsing functions (not visible at global scope) */ 43/* Auxiliary parsing functions (not visible at global scope) */
41struct skin_element* skin_parse_viewport(char** document); 44static struct skin_element* skin_parse_viewport(char** document);
42struct skin_element* skin_parse_line(char** document); 45static struct skin_element* skin_parse_line(char** document);
43struct skin_element* skin_parse_line_optional(char** document, int conditional); 46static struct skin_element* skin_parse_line_optional(char** document,
44struct skin_element* skin_parse_sublines(char** document); 47 int conditional);
45struct skin_element* skin_parse_sublines_optional(char** document, 48static struct skin_element* skin_parse_sublines(char** document);
46 int conditional); 49static struct skin_element* skin_parse_sublines_optional(char** document,
47 50 int conditional);
48int skin_parse_tag(struct skin_element* element, char** document); 51
49int skin_parse_text(struct skin_element* element, char** document, 52static int skin_parse_tag(struct skin_element* element, char** document);
50 int conditional); 53static int skin_parse_text(struct skin_element* element, char** document,
51int skin_parse_conditional(struct skin_element* element, char** document); 54 int conditional);
52int skin_parse_comment(struct skin_element* element, char** document); 55static int skin_parse_conditional(struct skin_element* element,
53struct skin_element* skin_parse_code_as_arg(char** document); 56 char** document);
57static int skin_parse_comment(struct skin_element* element, char** document);
58static struct skin_element* skin_parse_code_as_arg(char** document);
54 59
55struct skin_element* skin_parse(const char* document) 60struct skin_element* skin_parse(const char* document)
56{ 61{
@@ -61,6 +66,10 @@ struct skin_element* skin_parse(const char* document)
61 struct skin_element** to_write = 0; 66 struct skin_element** to_write = 0;
62 67
63 char* cursor = (char*)document; /*Keeps track of location in the document*/ 68 char* cursor = (char*)document; /*Keeps track of location in the document*/
69#ifdef ROCKBOX
70 /* FIXME */
71 skin_buffer = &skin_parse_tree[0];
72#endif
64 73
65 skin_line = 1; 74 skin_line = 1;
66 75
@@ -93,7 +102,7 @@ struct skin_element* skin_parse(const char* document)
93 102
94} 103}
95 104
96struct skin_element* skin_parse_viewport(char** document) 105static struct skin_element* skin_parse_viewport(char** document)
97{ 106{
98 107
99 struct skin_element* root = NULL; 108 struct skin_element* root = NULL;
@@ -218,7 +227,7 @@ struct skin_element* skin_parse_viewport(char** document)
218 227
219/* Auxiliary Parsing Functions */ 228/* Auxiliary Parsing Functions */
220 229
221struct skin_element* skin_parse_line(char**document) 230static struct skin_element* skin_parse_line(char**document)
222{ 231{
223 232
224 return skin_parse_line_optional(document, 0); 233 return skin_parse_line_optional(document, 0);
@@ -231,7 +240,8 @@ struct skin_element* skin_parse_line(char**document)
231 * SEPERATESYM. This should only be used when parsing a line inside a 240 * SEPERATESYM. This should only be used when parsing a line inside a
232 * conditional, otherwise just use the wrapper function skin_parse_line() 241 * conditional, otherwise just use the wrapper function skin_parse_line()
233 */ 242 */
234struct skin_element* skin_parse_line_optional(char** document, int conditional) 243static struct skin_element* skin_parse_line_optional(char** document,
244 int conditional)
235{ 245{
236 char* cursor = *document; 246 char* cursor = *document;
237 247
@@ -296,12 +306,12 @@ struct skin_element* skin_parse_line_optional(char** document, int conditional)
296 return retval; 306 return retval;
297} 307}
298 308
299struct skin_element* skin_parse_sublines(char** document) 309static struct skin_element* skin_parse_sublines(char** document)
300{ 310{
301 return skin_parse_sublines_optional(document, 0); 311 return skin_parse_sublines_optional(document, 0);
302} 312}
303 313
304struct skin_element* skin_parse_sublines_optional(char** document, 314static struct skin_element* skin_parse_sublines_optional(char** document,
305 int conditional) 315 int conditional)
306{ 316{
307 struct skin_element* retval; 317 struct skin_element* retval;
@@ -379,7 +389,7 @@ struct skin_element* skin_parse_sublines_optional(char** document,
379 return retval; 389 return retval;
380} 390}
381 391
382int skin_parse_tag(struct skin_element* element, char** document) 392static int skin_parse_tag(struct skin_element* element, char** document)
383{ 393{
384 394
385 char* cursor = *document + 1; 395 char* cursor = *document + 1;
@@ -422,7 +432,8 @@ int skin_parse_tag(struct skin_element* element, char** document)
422 } 432 }
423 433
424 /* Copying basic tag info */ 434 /* Copying basic tag info */
425 element->type = TAG; 435 if(element->type != CONDITIONAL)
436 element->type = TAG;
426 element->tag = tag; 437 element->tag = tag;
427 tag_args = tag->params; 438 tag_args = tag->params;
428 element->line = skin_line; 439 element->line = skin_line;
@@ -606,14 +617,13 @@ int skin_parse_tag(struct skin_element* element, char** document)
606 * If the conditional flag is set true, then parsing text will stop at an 617 * If the conditional flag is set true, then parsing text will stop at an
607 * ARGLISTSEPERATESYM. Only set that flag when parsing within a conditional 618 * ARGLISTSEPERATESYM. Only set that flag when parsing within a conditional
608 */ 619 */
609int skin_parse_text(struct skin_element* element, char** document, 620static int skin_parse_text(struct skin_element* element, char** document,
610 int conditional) 621 int conditional)
611{ 622{
612 char* cursor = *document; 623 char* cursor = *document;
613
614 int length = 0; 624 int length = 0;
615
616 int dest; 625 int dest;
626 char *text = NULL;
617 627
618 /* First figure out how much text we're copying */ 628 /* First figure out how much text we're copying */
619 while(*cursor != '\0' && *cursor != '\n' && *cursor != MULTILINESYM 629 while(*cursor != '\0' && *cursor != '\n' && *cursor != MULTILINESYM
@@ -643,7 +653,7 @@ int skin_parse_text(struct skin_element* element, char** document,
643 element->type = TEXT; 653 element->type = TEXT;
644 element->line = skin_line; 654 element->line = skin_line;
645 element->next = NULL; 655 element->next = NULL;
646 element->text = skin_alloc_string(length); 656 element->data = text = skin_alloc_string(length);
647 657
648 for(dest = 0; dest < length; dest++) 658 for(dest = 0; dest < length; dest++)
649 { 659 {
@@ -651,22 +661,21 @@ int skin_parse_text(struct skin_element* element, char** document,
651 if(*cursor == TAGSYM) 661 if(*cursor == TAGSYM)
652 cursor++; 662 cursor++;
653 663
654 element->text[dest] = *cursor; 664 text[dest] = *cursor;
655 cursor++; 665 cursor++;
656 } 666 }
657 element->text[length] = '\0'; 667 text[length] = '\0';
658 668
659 *document = cursor; 669 *document = cursor;
660 670
661 return 1; 671 return 1;
662} 672}
663 673
664int skin_parse_conditional(struct skin_element* element, char** document) 674static int skin_parse_conditional(struct skin_element* element, char** document)
665{ 675{
666 676
667 char* cursor = *document + 1; /* Starting past the "%" */ 677 char* cursor = *document + 1; /* Starting past the "%" */
668 char* bookmark; 678 char* bookmark;
669 struct skin_element* tag = skin_alloc_element(); /* The tag to evaluate */
670 int children = 1; 679 int children = 1;
671 int i; 680 int i;
672 681
@@ -674,7 +683,7 @@ int skin_parse_conditional(struct skin_element* element, char** document)
674 element->line = skin_line; 683 element->line = skin_line;
675 684
676 /* Parsing the tag first */ 685 /* Parsing the tag first */
677 if(!skin_parse_tag(tag, &cursor)) 686 if(!skin_parse_tag(element, &cursor))
678 return 0; 687 return 0;
679 688
680 /* Counting the children */ 689 /* Counting the children */
@@ -714,21 +723,20 @@ int skin_parse_conditional(struct skin_element* element, char** document)
714 cursor = bookmark; 723 cursor = bookmark;
715 724
716 /* Parsing the children */ 725 /* Parsing the children */
717 element->children_count = children + 1; /* Make sure to include the tag */ 726 element->children = skin_alloc_children(children);
718 element->children = skin_alloc_children(children + 1); 727 element->children_count = children;
719 element->children[0] = tag;
720 728
721 for(i = 1; i < children + 1; i++) 729 for(i = 0; i < children; i++)
722 { 730 {
723 element->children[i] = skin_parse_code_as_arg(&cursor); 731 element->children[i] = skin_parse_code_as_arg(&cursor);
724 skip_whitespace(&cursor); 732 skip_whitespace(&cursor);
725 733
726 if(i < children && *cursor != ENUMLISTSEPERATESYM) 734 if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM)
727 { 735 {
728 skin_error(SEPERATOR_EXPECTED); 736 skin_error(SEPERATOR_EXPECTED);
729 return 0; 737 return 0;
730 } 738 }
731 else if(i == children && *cursor != ENUMLISTCLOSESYM) 739 else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM)
732 { 740 {
733 skin_error(CLOSE_EXPECTED); 741 skin_error(CLOSE_EXPECTED);
734 return 0; 742 return 0;
@@ -744,9 +752,10 @@ int skin_parse_conditional(struct skin_element* element, char** document)
744 return 1; 752 return 1;
745} 753}
746 754
747int skin_parse_comment(struct skin_element* element, char** document) 755static int skin_parse_comment(struct skin_element* element, char** document)
748{ 756{
749 char* cursor = *document; 757 char* cursor = *document;
758 char* text = NULL;
750 759
751 int length; 760 int length;
752 /* 761 /*
@@ -758,12 +767,15 @@ int skin_parse_comment(struct skin_element* element, char** document)
758 767
759 element->type = COMMENT; 768 element->type = COMMENT;
760 element->line = skin_line; 769 element->line = skin_line;
761 element->text = skin_alloc_string(length); 770#ifdef ROCKBOX
771 element->data = NULL;
772#else
773 element->data = text = skin_alloc_string(length);
762 /* We copy from one char past cursor to leave out the # */ 774 /* We copy from one char past cursor to leave out the # */
763 memcpy((void*)(element->text), (void*)(cursor + 1), 775 memcpy((void*)text, (void*)(cursor + 1),
764 sizeof(char) * (length-1)); 776 sizeof(char) * (length-1));
765 element->text[length - 1] = '\0'; 777 text[length - 1] = '\0';
766 778#endif
767 if(cursor[length] == '\n') 779 if(cursor[length] == '\n')
768 skin_line++; 780 skin_line++;
769 781
@@ -774,7 +786,7 @@ int skin_parse_comment(struct skin_element* element, char** document)
774 return 1; 786 return 1;
775} 787}
776 788
777struct skin_element* skin_parse_code_as_arg(char** document) 789static struct skin_element* skin_parse_code_as_arg(char** document)
778{ 790{
779 791
780 int sublines = 0; 792 int sublines = 0;
@@ -813,29 +825,21 @@ struct skin_element* skin_parse_code_as_arg(char** document)
813 825
814 826
815/* Memory management */ 827/* Memory management */
816struct skin_element* skin_alloc_element() 828char* skin_alloc(size_t size)
817{ 829{
818 830#ifdef ROCKBOX
819#if 0 831 char *retval = skin_buffer;
820 832 skin_buffer = (void *)(((unsigned long)skin_buffer + 3) & ~3);
821 char* retval = &skin_parse_tree[skin_current_block * 4]; 833 return retval;
822 834#else
823 int delta = sizeof(struct skin_element) / (sizeof(char) * 4); 835 return malloc(size);
824
825 /* If one block is partially filled, make sure to advance to the
826 * next one for the next allocation
827 */
828 if(sizeof(struct skin_element) % (sizeof(char) * 4) != 0)
829 delta++;
830
831 skin_current_block += delta;
832
833 return (struct skin_element*)retval;
834
835#endif 836#endif
837}
836 838
839struct skin_element* skin_alloc_element()
840{
837 struct skin_element* retval = (struct skin_element*) 841 struct skin_element* retval = (struct skin_element*)
838 malloc(sizeof(struct skin_element)); 842 skin_alloc(sizeof(struct skin_element));
839 retval->next = NULL; 843 retval->next = NULL;
840 retval->params_count = 0; 844 retval->params_count = 0;
841 retval->children_count = 0; 845 retval->children_count = 0;
@@ -846,60 +850,25 @@ struct skin_element* skin_alloc_element()
846 850
847struct skin_tag_parameter* skin_alloc_params(int count) 851struct skin_tag_parameter* skin_alloc_params(int count)
848{ 852{
849#if 0 853 size_t size = sizeof(struct skin_tag_parameter) * count;
850 854 return (struct skin_tag_parameter*)skin_alloc(size);
851 char* retval = &skin_parse_tree[skin_current_block * 4];
852
853 int delta = sizeof(struct skin_tag_parameter) / (sizeof(char) * 4);
854 delta *= count;
855
856 /* Correcting uneven alignment */
857 if(count * sizeof(struct skin_tag_parameter) % (sizeof(char) * 4) != 0)
858 delta++;
859
860 skin_current_block += delta;
861
862 return (struct skin_tag_parameter*) retval;
863
864#endif
865
866 return (struct skin_tag_parameter*)malloc(sizeof(struct skin_tag_parameter)
867 * count);
868 855
869} 856}
870 857
871char* skin_alloc_string(int length) 858char* skin_alloc_string(int length)
872{ 859{
873 860 return (char*)skin_alloc(sizeof(char) * (length + 1));
874#if 0
875 char* retval = &skin_parse_tree[skin_current_block * 4];
876
877 /* Checking alignment */
878 length++; /* Accounting for the null terminator */
879 int delta = length / 4;
880 if(length % 4 != 0)
881 delta++;
882
883 skin_current_block += delta;
884
885 if(skin_current_block >= SKIN_MAX_MEMORY / 4)
886 skin_error(MEMORY_LIMIT_EXCEEDED);
887
888 return retval;
889
890#endif
891
892 return (char*)malloc(sizeof(char) * (length + 1));
893
894} 861}
895 862
896struct skin_element** skin_alloc_children(int count) 863struct skin_element** skin_alloc_children(int count)
897{ 864{
898 return (struct skin_element**) malloc(sizeof(struct skin_element*) * count); 865 return (struct skin_element**)
866 skin_alloc(sizeof(struct skin_element*) * count);
899} 867}
900 868
901void skin_free_tree(struct skin_element* root) 869void skin_free_tree(struct skin_element* root)
902{ 870{
871#ifndef ROCKBOX
903 int i; 872 int i;
904 873
905 /* First make the recursive call */ 874 /* First make the recursive call */
@@ -908,8 +877,8 @@ void skin_free_tree(struct skin_element* root)
908 skin_free_tree(root->next); 877 skin_free_tree(root->next);
909 878
910 /* Free any text */ 879 /* Free any text */
911 if(root->type == TEXT) 880 if(root->type == TEXT || root->type == COMMENT)
912 free(root->text); 881 free(root->data);
913 882
914 /* Then recursively free any children, before freeing their pointers */ 883 /* Then recursively free any children, before freeing their pointers */
915 for(i = 0; i < root->children_count; i++) 884 for(i = 0; i < root->children_count; i++)
@@ -926,4 +895,7 @@ void skin_free_tree(struct skin_element* root)
926 895
927 /* Finally, delete root's memory */ 896 /* Finally, delete root's memory */
928 free(root); 897 free(root);
898#else
899 (void)root;
900#endif
929} 901}
diff --git a/utils/themeeditor/skin_parser.h b/utils/themeeditor/skin_parser.h
index d3821c0f9b..c15ba9da8d 100644
--- a/utils/themeeditor/skin_parser.h
+++ b/utils/themeeditor/skin_parser.h
@@ -26,14 +26,7 @@
26extern "C" 26extern "C"
27{ 27{
28#endif 28#endif
29 29#include <stdlib.h>
30
31#define SKIN_MAX_MEMORY 1048576
32
33/********************************************************************
34 ****** A global buffer will be used to store the parse tree *******
35 *******************************************************************/
36extern char skin_parse_tree[];
37 30
38/******************************************************************** 31/********************************************************************
39 ****** Data Structures ********************************************* 32 ****** Data Structures *********************************************
@@ -98,8 +91,11 @@ struct skin_element
98 /* The line on which it's defined in the source file */ 91 /* The line on which it's defined in the source file */
99 int line; 92 int line;
100 93
101 /* Text for comments and plaintext */ 94 /* Placeholder for element data
102 char* text; 95 * TEXT and COMMENT uses it for the text string
96 * TAG, VIEWPORT, LINE, etc may use it for post parse extra storage
97 */
98 void* data;
103 99
104 /* The tag or conditional name */ 100 /* The tag or conditional name */
105 struct tag_info *tag; 101 struct tag_info *tag;
@@ -125,6 +121,7 @@ struct skin_element
125struct skin_element* skin_parse(const char* document); 121struct skin_element* skin_parse(const char* document);
126 122
127/* Memory management functions */ 123/* Memory management functions */
124char *skin_alloc(size_t size);
128struct skin_element* skin_alloc_element(); 125struct skin_element* skin_alloc_element();
129struct skin_element** skin_alloc_children(int count); 126struct skin_element** skin_alloc_children(int count);
130struct skin_tag_parameter* skin_alloc_params(int count); 127struct skin_tag_parameter* skin_alloc_params(int count);
@@ -132,6 +129,7 @@ char* skin_alloc_string(int length);
132 129
133void skin_free_tree(struct skin_element* root); 130void skin_free_tree(struct skin_element* root);
134 131
132
135#ifdef __cplusplus 133#ifdef __cplusplus
136} 134}
137#endif 135#endif