From ee081ca70322cd01d0642fdb1860e6bfbfb48e85 Mon Sep 17 00:00:00 2001 From: steven-vd Date: Sun, 16 Aug 2026 15:00:32 +0200 Subject: Initial commit --- examples/c89.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/c89.c (limited to 'examples/c89.c') diff --git a/examples/c89.c b/examples/c89.c new file mode 100644 index 0000000..4b0eaf6 --- /dev/null +++ b/examples/c89.c @@ -0,0 +1,33 @@ +#include +#include +#define ASSERT assert +#define IMXML_SIMD_DEFAULT SSE2 +#define IMXML_IMPLEMENTATION +#include "imxml.h" + +int main (void) { + ImxmlString s, from, to, msg; + XmlContent content; + ImxmlCharSequence const xml = "Hello, World!"IMXML_LIT_PAD; + XmlParser p = {0}; + p.head = xml; + + imxml_strlit89(s, "msg"); + assert(xml_tag_expect_str(&p, s)); + imxml_strlit89(s, "from"); + assert(xml_attr_expect_str(&p, s)); + from = xml_value(&p); + imxml_strlit89(s, "to"); + assert(xml_attr_expect_str(&p, s)); + to = xml_value(&p); + + content = xml_content(&p); + assert(content.type == XML_CONTENT_TEXT); + msg = content.data; + assert(xml_content(&p).type == XML_CONTENT_TAG); + + printf("%.*s->%.*s: '%.*s'\n", (int)from.count, from.items, (int)to.count, to.items, (int)msg.count, msg.items); + + return 0; +} + -- cgit v1.2.3