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 › zig › llvm › BitcodeReader › next Public Function next Doc Source Public Function std.zig.llvm.BitcodeReader.next
pub fn next (bc : *BitcodeReader ) !?Item Params File zig/llvm/BitcodeReader.zig: 136
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180 pub fn next (bc : *BitcodeReader ) !?Item {
while (true ) {
const record = (try bc .nextRecord ()) orelse
return if (bc .stack .items .len > 1 ) error .EndOfStream else null ;
switch (record .id ) {
else => return .{ .record = record },
Abbrev .Builtin .end_block .toRecordId () => {
const block_id = bc .stack .items [bc .stack .items .len - 1 ].block_id .?;
try bc .endBlock ();
return .{ .end_block = .{
.name = if (bc .block_info .get (block_id )) |block_info |
block_info .block_name
else
&.{},
.id = block_id ,
.len = 0 ,
} };
},
Abbrev .Builtin .enter_subblock .toRecordId () => {
const block_id : u32 = @intCast (record .operands [0 ]);
switch (block_id ) {
Block .block_info => {
try bc .startBlock (Block .block_info , @intCast (record .operands [1 ]));
try bc .parseBlockInfoBlock ();
try bc .endBlock ();
},
Block .first_reserved ...Block .last_standard => return error .UnsupportedBlockId ,
else => {
try bc .startBlock (block_id , @intCast (record .operands [1 ]));
return .{ .start_block = .{
.name = if (bc .block_info .get (block_id )) |block_info |
block_info .block_name
else
&.{},
.id = block_id ,
.len = @intCast (record .operands [2 ]),
} };
},
}
},
Abbrev .Builtin .define_abbrev .toRecordId () => try bc .stack .items [bc .stack .items .len - 1 ]
.abbrevs .addOwnedAbbrev (bc .allocator , try record .toOwnedAbbrev (bc .allocator )),
}
}
}