summaryrefslogtreecommitdiff
path: root/lib/skin_parser/skin_parser.c
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-15 06:24:11 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-15 06:24:11 +0000
commit15488a00eae8d10249015b88e4b7bdc47365b854 (patch)
tree62439c56fa8a926b148c7a3cc843a0c60f3aac21 /lib/skin_parser/skin_parser.c
parent387af97a26105fce79e6a8726752cf183d40939e (diff)
downloadrockbox-15488a00eae8d10249015b88e4b7bdc47365b854.tar.gz
rockbox-15488a00eae8d10249015b88e4b7bdc47365b854.zip
Theme Editor: Committed FS#11477 to add a DECIMAL parameter type in the parser and adapt the Theme Editor to accomodate the change by Johnathan Gordon. Fixed bug in the parser caused by the patch (error was thrown on zero value) and adapted tag rendering for new format
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27426 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
-rw-r--r--lib/skin_parser/skin_parser.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 2ce41c6d9a..5bc5984fb7 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -23,6 +23,7 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <string.h> 24#include <string.h>
25#include <ctype.h> 25#include <ctype.h>
26#include <stdbool.h>
26 27
27#include "skin_buffer.h" 28#include "skin_buffer.h"
28#include "skin_parser.h" 29#include "skin_parser.h"
@@ -534,7 +535,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
534 /* Storing the type code */ 535 /* Storing the type code */
535 element->params[i].type_code = *tag_args; 536 element->params[i].type_code = *tag_args;
536 537
537 /* Checking a nullable argument for null */ 538 /* Checking a nullable argument for null. */
538 if(*cursor == DEFAULTSYM && !isdigit(cursor[1])) 539 if(*cursor == DEFAULTSYM && !isdigit(cursor[1]))
539 { 540 {
540 if(islower(*tag_args)) 541 if(islower(*tag_args))
@@ -557,8 +558,36 @@ static int skin_parse_tag(struct skin_element* element, char** document)
557 return 0; 558 return 0;
558 } 559 }
559 560
560 element->params[i].type = NUMERIC; 561 element->params[i].type = INTEGER;
561 element->params[i].data.numeric = scan_int(&cursor); 562 element->params[i].data.number = scan_int(&cursor);
563 }
564 else if(tolower(*tag_args) == 'd')
565 {
566 int val = 0;
567 bool have_point = false;
568 bool have_tenth = false;
569 while ( isdigit(*cursor) || *cursor == '.' )
570 {
571 if (*cursor != '.')
572 {
573 val *= 10;
574 val += *cursor - '0';
575 if (have_point)
576 {
577 have_tenth = true;
578 cursor++;
579 break;
580 }
581 }
582 else
583 have_point = true;
584 cursor++;
585 }
586 if (have_tenth == false)
587 val *= 10;
588
589 element->params[i].type = DECIMAL;
590 element->params[i].data.number = val;
562 } 591 }
563 else if(tolower(*tag_args) == 'n' || 592 else if(tolower(*tag_args) == 'n' ||
564 tolower(*tag_args) == 's' || tolower(*tag_args) == 'f') 593 tolower(*tag_args) == 's' || tolower(*tag_args) == 'f')