//! The root module every user binary is compiled through (build.zig,
//! `addUserBinary`). The program's own file is imported as `program`, and this
//! shim contributes the declarations Zig resolves from the compilation root —
//! `main` (dispatched by runtime.start) and the panic handler — and pulls in the
//! `_start` entry shim. A program therefore only defines `pub fn main`; nothing
//! else is required in its source file.

const runtime = @import("runtime");
const program = @import("program");

/// Resolved as `@import("root").main` by runtime.start's comptime dispatch.
pub const main = program.main;

/// The panic handler for every safety check in the image (runtime.start.panic).
pub const panic = runtime.panic;

/// std.log for every user binary goes to the tagged kernel log ring (the kernel
/// stamps the sender; see runtime.log). A program overrides by declaring its
/// own `pub const std_options`.
pub const std_options: @import("std").Options =
    if (@hasDecl(program, "std_options")) program.std_options else runtime.log.default_options;

comptime {
    _ = &runtime.start._start; // pull the runtime entry shim into the image
}
