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.

isSelfDefinedMacro

Determines whether macro is of the form: #define FOO FOO (Possibly with trailing tokens) Macros of this form will not be translated.

Translator.isSelfDefinedMacro
fn isSelfDefinedMacro(t: *Translator, name: []const u8, macro: aro.Preprocessor.Macro) bool

File

lib/compiler/translate-c/Translator.zig:395

Code

fn isSelfDefinedMacro(t: *Translator, name: []const u8, macro: aro.Preprocessor.Macro) bool {
    if (macro.is_func) return false;

    if (macro.tokens.len < 1) return false;
    const first_tok = macro.tokens[0];

    const source = t.comp.getSource(macro.loc.id);
    const slice = source.buf[first_tok.start..first_tok.end];

    return std.mem.eql(u8, name, slice);
}