summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-06-17 07:56:51 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-06-17 07:56:51 +0000
commitb2ea95e8d27d8d9fdc5a5422c45218026ad01476 (patch)
tree989b602a000da22145de727f0766e0ed5e8859f9
parent1dc2c5ebcbdf2046c2aad6314018796fe3d0d06e (diff)
downloadrockbox-b2ea95e8d27d8d9fdc5a5422c45218026ad01476.tar.gz
rockbox-b2ea95e8d27d8d9fdc5a5422c45218026ad01476.zip
make the parser slightly more usable for rockbox, move the buffer allocation into the lib (maybe not the best spot?)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26880 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--lib/skin_parser/Makefile2
-rw-r--r--lib/skin_parser/skin_parser.c25
2 files changed, 6 insertions, 21 deletions
diff --git a/lib/skin_parser/Makefile b/lib/skin_parser/Makefile
index 5c1be67578..4026f9e9a9 100644
--- a/lib/skin_parser/Makefile
+++ b/lib/skin_parser/Makefile
@@ -9,7 +9,7 @@
9 9
10BUILDDIR ?= . 10BUILDDIR ?= .
11 11
12SRC = skin_parser.c skin_debug.c skin_scan.c tag_table.c 12SRC = skin_buffer.c skin_parser.c skin_debug.c skin_scan.c tag_table.c
13OBJ := $(patsubst %.c,$(BUILDDIR)/%.o,$(SRC)) 13OBJ := $(patsubst %.c,$(BUILDDIR)/%.o,$(SRC))
14OUT = $(BUILDDIR)/libskin_parser.a 14OUT = $(BUILDDIR)/libskin_parser.a
15CC = gcc 15CC = gcc
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 93a71919bf..f7ff4ad693 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -24,19 +24,13 @@
24#include <string.h> 24#include <string.h>
25#include <ctype.h> 25#include <ctype.h>
26 26
27#include "skin_buffer.h"
27#include "skin_parser.h" 28#include "skin_parser.h"
28#include "skin_debug.h" 29#include "skin_debug.h"
29#include "tag_table.h" 30#include "tag_table.h"
30#include "symbols.h" 31#include "symbols.h"
31#include "skin_scan.h" 32#include "skin_scan.h"
32 33
33#ifdef ROCKBOX
34/* Declaration of parse tree buffer */
35#define SKIN_MAX_MEMORY (30*1024)
36static char skin_parse_tree[SKIN_MAX_MEMORY];
37static char *skin_buffer;
38#endif
39
40/* Global variables for the parser */ 34/* Global variables for the parser */
41int skin_line = 0; 35int skin_line = 0;
42 36
@@ -66,11 +60,7 @@ struct skin_element* skin_parse(const char* document)
66 struct skin_element** to_write = 0; 60 struct skin_element** to_write = 0;
67 61
68 char* cursor = (char*)document; /*Keeps track of location in the document*/ 62 char* cursor = (char*)document; /*Keeps track of location in the document*/
69#ifdef ROCKBOX 63
70 /* FIXME */
71 skin_buffer = &skin_parse_tree[0];
72#endif
73
74 skin_line = 1; 64 skin_line = 1;
75 65
76 skin_clear_errors(); 66 skin_clear_errors();
@@ -765,8 +755,9 @@ static int skin_parse_conditional(struct skin_element* element, char** document)
765static int skin_parse_comment(struct skin_element* element, char** document) 755static int skin_parse_comment(struct skin_element* element, char** document)
766{ 756{
767 char* cursor = *document; 757 char* cursor = *document;
758#ifndef ROCKBOX
768 char* text = NULL; 759 char* text = NULL;
769 760#endif
770 int length; 761 int length;
771 /* 762 /*
772 * Finding the index of the ending newline or null-terminator 763 * Finding the index of the ending newline or null-terminator
@@ -847,13 +838,7 @@ static struct skin_element* skin_parse_code_as_arg(char** document)
847/* Memory management */ 838/* Memory management */
848char* skin_alloc(size_t size) 839char* skin_alloc(size_t size)
849{ 840{
850#ifdef ROCKBOX 841 return skin_buffer_alloc(size);
851 char *retval = skin_buffer;
852 skin_buffer = (void *)(((unsigned long)skin_buffer + 3) & ~3);
853 return retval;
854#else
855 return malloc(size);
856#endif
857} 842}
858 843
859struct skin_element* skin_alloc_element() 844struct skin_element* skin_alloc_element()