From 06ea93da8269ada1b19ce28791a05e57fbb453ac Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Mon, 7 Jun 2010 23:49:06 +0000 Subject: Theme Editor: Factored out code to skip over enum/arg lists while scanning for children counts, and fixed all of the parsing bugs caused by innacurate children counts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26679 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/skin_scan.c | 59 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'utils/themeeditor/skin_scan.c') diff --git a/utils/themeeditor/skin_scan.c b/utils/themeeditor/skin_scan.c index 19e959b5b8..79f7162aab 100644 --- a/utils/themeeditor/skin_scan.c +++ b/utils/themeeditor/skin_scan.c @@ -34,14 +34,69 @@ /* Simple function to advance a char* past a comment */ void skip_comment(char** document) { - for(/*NO INIT*/;**document != '\n' && **document != '\0'; (*document)++); + while(**document != '\n' && **document != '\0') + (*document)++; if(**document == '\n') (*document)++; } void skip_whitespace(char** document) { - for(/*NO INIT*/; **document == ' ' || **document == '\t'; (*document)++); + while(**document == ' ' || **document == '\t') + (*document)++; +} + +void skip_arglist(char** document) +{ + if(**document == ARGLISTOPENSYM) + (*document)++; + while(**document && **document != ARGLISTCLOSESYM) + { + if(**document == TAGSYM) + { + (*document)++; + if(**document == '\0') + break; + (*document)++; + } + else if(**document == ARGLISTOPENSYM) + skip_arglist(document); + else if(**document == ENUMLISTOPENSYM) + skip_enumlist(document); + else if(**document == COMMENTSYM) + skip_comment(document); + else + (*document)++; + } + if(**document == ARGLISTCLOSESYM) + (*document)++; +} + +void skip_enumlist(char** document) +{ + if(**document == ENUMLISTOPENSYM) + (*document)++; + while(**document && **document != ENUMLISTCLOSESYM) + { + if(**document == TAGSYM) + { + (*document)++; + if(**document == '\0') + break; + (*document)++; + } + else if(**document == ARGLISTOPENSYM) + skip_arglist(document); + else if(**document == ENUMLISTOPENSYM) + skip_enumlist(document); + else if(**document == COMMENTSYM) + skip_comment(document); + else + (*document)++; + } + + if(**document == ENUMLISTCLOSESYM) + (*document)++; } char* scan_string(char** document) -- cgit v1.2.3