Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

renderValueC

ConfigHeader.renderValueC
fn renderValueC(conf: *const Configuration, w: *Writer, newline: []const u8, name: []const u8, value: Value.Index) !void

File

lib/compiler/Maker/Step/ConfigHeader.zig:424

Code

fn renderValueC(conf: *const Configuration, w: *Writer, newline: []const u8, name: []const u8, value: Value.Index) !void {
    switch (value.unpack(conf)) {
        .undef => try w.print("/* #undef {s} */{s}", .{ name, newline }),
        .defined => try w.print("#define {s}{s}", .{ name, newline }),
        .bool => |b| return renderValueCBool(w, newline, name, b),
        inline .u64, .i64 => |i| try w.print("#define {s} {d}{s}", .{ name, i, newline }),
        .ident => |ident| return renderValueCIdent(w, newline, name, ident),
        .string => |string| try w.print("#define {s} \"{f}\"{s}", .{ name, std.zig.fmtString(string), newline }),
    }
}