summaryrefslogtreecommitdiff
path: root/include/hubbub/types.h
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-03-21 13:20:22 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-03-21 13:20:22 +0000
commit4da6a038c15a5fa3d1c754b7278ae47627a44718 (patch)
treebd3f06540ff87963913848c6fea5cb1b7eec62e3 /include/hubbub/types.h
parenteebff1268e029fa6a31d391c175a66e159a45ecf (diff)
downloadlibhubbub-4da6a038c15a5fa3d1c754b7278ae47627a44718.tar.gz
libhubbub-4da6a038c15a5fa3d1c754b7278ae47627a44718.tar.bz2
hubbub_strings may now be either an offset into the data buffer or a pointer to constant data.
Fix up tokeniser and treebuilder to deal with this. Fix up testcases, too. The tokeniser will only ever emit strings of type HUBBUB_STRING_OFF. Anything else is a bug which should be fixed. The treebuilder may emit strings of either type. svn path=/trunk/hubbub/; revision=4014
Diffstat (limited to 'include/hubbub/types.h')
-rw-r--r--include/hubbub/types.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/hubbub/types.h b/include/hubbub/types.h
index 922bdbb..e58a88b 100644
--- a/include/hubbub/types.h
+++ b/include/hubbub/types.h
@@ -57,7 +57,16 @@ typedef enum hubbub_token_type {
* Tokeniser string type
*/
typedef struct hubbub_string {
- uint32_t data_off; /**< Byte offset of string start */
+ enum {
+ HUBBUB_STRING_OFF,
+ HUBBUB_STRING_PTR
+ } type;
+
+ union {
+ const uint8_t *ptr; /**< Pointer to data */
+ uint32_t off; /**< Byte offset of string start */
+ } data;
+
size_t len; /**< Byte length of string */
} hubbub_string;