From 47775214d6287537d6e148c37e0c49aa8228b81b Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 17 Feb 2026 21:51:01 +0100 Subject: Fix some tools and examples after core:os update and using-stmt feature --- core/encoding/xml/example/xml_example.odin | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'core/encoding') diff --git a/core/encoding/xml/example/xml_example.odin b/core/encoding/xml/example/xml_example.odin index 9648143db..267ae2ca9 100644 --- a/core/encoding/xml/example/xml_example.odin +++ b/core/encoding/xml/example/xml_example.odin @@ -10,8 +10,6 @@ import "core:hash" N :: 1 example :: proc() { - using fmt - docs: [N]^xml.Document errs: [N]xml.Error times: [N]time.Duration @@ -59,23 +57,23 @@ example :: proc() { fmt.printf("[Average]: %v bytes in %.2f ms (%.2f MiB/s).\n", len(input), average_ms, average_speed) if errs[0] != .None { - printf("Load/Parse error: %v\n", errs[0]) + fmt.printf("Load/Parse error: %v\n", errs[0]) if errs[0] == .File_Error { - println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?") + fmt.println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?") } return } charlist, charlist_ok := xml.find_child_by_ident(docs[0], 0, "charlist") if !charlist_ok { - eprintln("Could not locate top-level `` tag.") - return + fmt.eprintln("Could not locate top-level `` tag.") + return } - printf("Found `` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count) + fmt.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) + fmt.printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32) for round in 0.. (crc32: u32) { } main :: proc() { - using fmt - track: mem.Tracking_Allocator mem.tracking_allocator_init(&track, context.allocator) context.allocator = mem.tracking_allocator(&track) @@ -103,10 +99,10 @@ main :: proc() { example() if len(track.allocation_map) > 0 { - println() + fmt.println() for _, v in track.allocation_map { - printf("%v Leaked %v bytes.\n", v.location, v.size) + fmt.printf("%v Leaked %v bytes.\n", v.location, v.size) } } - println("Done and cleaned up!") + fmt.println("Done and cleaned up!") } -- cgit v1.2.3 From a90f2ad3a0233803f220a4d2b132a474f8044781 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 17 Feb 2026 23:08:32 +0100 Subject: Print errors in tools and examples to stderr --- core/crypto/_edwards25519/tools/edwards_gen_tables.odin | 2 +- core/crypto/_weierstrass/tools/ecc_gen_tables.odin | 2 +- core/encoding/xml/example/xml_example.odin | 4 ++-- core/unicode/tools/generate_entity_table.odin | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'core/encoding') diff --git a/core/crypto/_edwards25519/tools/edwards_gen_tables.odin b/core/crypto/_edwards25519/tools/edwards_gen_tables.odin index 15df478ea..a204e6ac6 100644 --- a/core/crypto/_edwards25519/tools/edwards_gen_tables.odin +++ b/core/crypto/_edwards25519/tools/edwards_gen_tables.odin @@ -80,7 +80,7 @@ main :: proc() { fn, err := path.join({ODIN_ROOT, "core", "crypto", "_edwards25519", "edwards25519_table.odin"}, context.allocator) if err != .None { - fmt.printfln("Join path error for edwards25519_table.odin: %v", err); + fmt.eprintfln("Join path error for edwards25519_table.odin: %v", err); os.exit(1); } bld: strings.Builder diff --git a/core/crypto/_weierstrass/tools/ecc_gen_tables.odin b/core/crypto/_weierstrass/tools/ecc_gen_tables.odin index 33f6d7510..3211c65f3 100644 --- a/core/crypto/_weierstrass/tools/ecc_gen_tables.odin +++ b/core/crypto/_weierstrass/tools/ecc_gen_tables.odin @@ -70,7 +70,7 @@ gen_tables :: proc($CURVE: string) { fn_ := "sec" + CURVE + "_table.odin" fn, err := path.join({ODIN_ROOT, "core", "crypto", "_weierstrass", fn_}, context.allocator) if err != .None { - fmt.printfln("Join path error for %s: %v", fn_, err); + fmt.eprintfln("Join path error for %s: %v", fn_, err); os.exit(1); } bld: strings.Builder diff --git a/core/encoding/xml/example/xml_example.odin b/core/encoding/xml/example/xml_example.odin index 267ae2ca9..5ea689069 100644 --- a/core/encoding/xml/example/xml_example.odin +++ b/core/encoding/xml/example/xml_example.odin @@ -57,9 +57,9 @@ example :: proc() { fmt.printf("[Average]: %v bytes in %.2f ms (%.2f MiB/s).\n", len(input), average_ms, average_speed) if errs[0] != .None { - fmt.printf("Load/Parse error: %v\n", errs[0]) + fmt.eprintf("Load/Parse error: %v\n", errs[0]) if errs[0] == .File_Error { - fmt.println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?") + fmt.eprintln("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?") } return } diff --git a/core/unicode/tools/generate_entity_table.odin b/core/unicode/tools/generate_entity_table.odin index 116bc433f..2fe127caf 100644 --- a/core/unicode/tools/generate_entity_table.odin +++ b/core/unicode/tools/generate_entity_table.odin @@ -24,7 +24,7 @@ main :: proc() { defer delete(filename) if err_xml != .None { - fmt.printfln("Join path error for unicode.xml: %v", err_xml); + fmt.eprintfln("Join path error for unicode.xml: %v", err_xml); os.exit(1); } @@ -32,7 +32,7 @@ main :: proc() { defer delete(generated_filename) if err_generated != .None { - fmt.printfln("Join path error for generated.odin: %v", err_generated); + fmt.eprintfln("Join path error for generated.odin: %v", err_generated); os.exit(1); } @@ -40,7 +40,7 @@ main :: proc() { defer xml.destroy(doc) if err != .None { - fmt.printfln("Load/Parse error: %v", err) + fmt.eprintfln("Load/Parse error: %v", err) if err == .File_Error { fmt.eprintfln("%q not found. Did you run \"tests\\download_assets.py\"?", filename) } -- cgit v1.2.3