Files
zig/stage0/dump.h
Motiejus Jakštys 00a6cb4fd4 Replace structural Air/IP comparison with text-based dumpers
Remove all @import("zig_internals") from stage0/ so that test_obj
compilation is independent of the Zig compiler (~6min). The sema
comparison now uses text-based dumpers:

- Zig side (src/verbose_air.zig): compiles source through the full Zig
  pipeline, captures verbose_air output, exports zig_dump_air() as a C
  function. Compiled as a separate dumper_obj that is cached
  independently.

- C side (stage0/verbose_air.c): formats C Air structs to text in the
  same format as Zig's Air/print.zig.

Changing stage0 code no longer triggers Zig compiler recompilation:
C compile + cached test_obj + cached dumper + link = seconds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:48:40 +00:00

19 lines
668 B
C

// dump.h — Shared result type for text-based C/Zig comparison dumpers.
#ifndef _ZIG0_DUMP_H__
#define _ZIG0_DUMP_H__
#include <stddef.h>
typedef struct {
char* text; // Heap-allocated, NULL on error. Caller frees.
char* error_msg; // Heap-allocated, NULL on success. Caller frees.
} DumpResult;
// Zig side: compile source file at src_path, run full Zig pipeline, dump text.
// src_path: file path relative to cwd.
// func_filter: NULL=all functions, "foo"=only functions containing 'foo'.
extern DumpResult zig_dump_air(const char* src_path, const char* func_filter);
extern DumpResult zig_dump_intern_pool(const char* source, size_t len);
#endif