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 standard library.
std › Build › Step › ConfigHeader › create Public Function create Doc Source Public Function std.Build.Step.ConfigHeader.create
pub fn create (owner : *std .Build , options : Options ) *ConfigHeader Params File Build/Step/ConfigHeader.zig: 63
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111 pub fn create (owner : *std .Build , options : Options ) *ConfigHeader {
const graph = owner .graph ;
const arena = graph .arena ;
const wc = &graph .wip_configuration ;
const config_header = graph .create (ConfigHeader );
const include_path : []const u8 = p : {
if (options .include_path ) |p |
break :p graph .dupeString (p );
if (options .style .getPath ()) |s | default : {
const sub_path = switch (s ) {
.src_path => |sp | sp .sub_path ,
.generated => break :default ,
.cwd_relative => |sub_path | sub_path ,
.relative => |r | r .sub_path ,
.dependency => |dependency | dependency .sub_path ,
};
const basename = Io .Dir .path .basename (sub_path );
if (std .mem .endsWith (u8 , basename , ".h.in" ))
break :p graph .dupeString (basename [0 .. basename .len - 3 ]);
}
break :p "config.h" ;
};
const name = if (options .style .getPath ()) |s |
arena .print ("configure {t} header {f} to {s}" , .{ options .style , s , include_path }) catch @panic ("OOM" )
else
arena .print ("configure {t} header to {s}" , .{ options .style , include_path }) catch @panic ("OOM" );
config_header .* = .{
.step = .init (.{
.tag = base_tag ,
.name = name ,
.owner = owner ,
.first_ret_addr = options .first_ret_addr orelse @returnAddress (),
}),
.style = options .style ,
.input_size_limit = options .max_bytes ,
.include_path = include_path ,
.include_guard = if (options .include_guard ) |s | .init (wc .addString (s ) catch @panic ("OOM" )) else .none ,
.generated_dir = graph .addGeneratedFile (&config_header .step ),
};
if (options .style .getPath ()) |s | {
s .addStepDependencies (&config_header .step );
}
return config_header ;
}