@@ -257,35 +257,37 @@ static void set_error(document* d, const char* msg)
257 strcpy(d->error_message, msg);
257 strcpy(d->error_message, msg);
260−#define ARGUMENTS , document* d
261−#define VARIABLES const char *tag_start, *name_start, *name_end, *quote_start, *quote_end
263static inline str gap(const char* ref, const char* start, const char* end)
260static inline str gap(const char* ref, const char* start, const char* end)
265 return start_end(start - ref, end - ref);
262 return start_end(start - ref, end - ref);
268−#define abort(x) return x
265+#define P_Abort(x) return x
269−#define NameStart name_start = p
266+#define P_NameStart name_start = p
270−#define NameEnd name_end = p
267+#define P_NameEnd name_end = p
271−#define QuoteStart quote_start = p
268+#define P_QuoteStart quote_start = p
272−#define QuoteEnd \
269+#define P_QuoteEnd \
273 quote_end = p; \
270 quote_end = p; \
274 attr_alloc(&d->attrs, 1); \
271 attr_alloc(&d->attrs, 1); \
275 d->attrs.attrs[d->attrs.used].name = gap(d->body, name_start, name_end); \
272 d->attrs.attrs[d->attrs.used].name = gap(d->body, name_start, name_end); \
276 d->attrs.attrs[d->attrs.used].value = gap(d->body, quote_start, quote_end); \
273 d->attrs.attrs[d->attrs.used].value = gap(d->body, quote_start, quote_end); \
277 d->attrs.used++;
274 d->attrs.used++;
278−#define AttribsStart printf("AttribsStart %s\n", p)
275+#define P_AttribsStart printf("AttribsStart %s\n", p)
279−#define AttribsEnd printf("AttribsEnd %s\n", p)
276+#define P_AttribsEnd printf("AttribsEnd %s\n", p)
280−#define Tag tag_start = p
277+#define P_Tag tag_start = p
281−#define TagComment printf("TagComment %s\n", p)
278+#define P_TagComment printf("TagComment %s\n", p)
282−#define TagOpen printf("TagOpen %s\n", p)
279+#define P_TagOpen printf("TagOpen %s\n", p)
283−#define TagClose printf("TagClose %s\n", p)
280+#define P_TagClose printf("TagClose %s\n", p)
284−#define TagOpenClose \
281+#define P_TagOpenClose \
285 d->nodes.nodes[d->nodes.used_front].outer = gap(d->body, tag_start, p); \
282 d->nodes.nodes[d->nodes.used_front].outer = gap(d->body, tag_start, p); \
286 printf("TagOpenClose %s\n", p)
283 printf("TagOpenClose %s\n", p)
285+static const char* parser(const char* p, document* d)
287+ const char *tag_start, *name_start, *name_end, *quote_start, *quote_end;
288−#include "test.h"
288+# include "test.h"
290// Based on looking at ~50Kb XML documents, they seem to have ~700 attributes
292// Based on looking at ~50Kb XML documents, they seem to have ~700 attributes
291// and ~300 nodes, so size appropriately to cope with that.
293// and ~300 nodes, so size appropriately to cope with that.