package xml_example import "core:encoding/xml" import "core:mem" import "core:fmt" import "core:time" import "core:strings" import "core:hash" N :: 1 example :: proc() { using fmt docs: [N]^xml.Document errs: [N]xml.Error times: [N]time.Duration defer for round in 0..` tag.") return } printf("Found `` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count) crc32 := doc_hash(docs[0], false) printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32) for round in 0.. (crc32: u32) { buf: strings.Builder defer strings.builder_destroy(&buf) w := strings.to_writer(&buf) xml.print(w, doc) tree := strings.to_string(buf) if print { fmt.println(tree) } return hash.crc32(transmute([]u8)tree) } main :: proc() { using fmt track: mem.Tracking_Allocator mem.tracking_allocator_init(&track, context.allocator) context.allocator = mem.tracking_allocator(&track) example() if len(track.allocation_map) > 0 { println() for _, v in track.allocation_map { printf("%v Leaked %v bytes.\n", v.location, v.size) } } println("Done and cleaned up!") }