errnoStrings

Reverse mapping of errno values to their string names.

Automatically generated by introspecting core.stdc.errno.

string[134] errnoStrings;

foreach (immutable symname; __traits(allMembers, core.stdc.errno))
{
    static if (symname[0] == 'E')
    {
        immutable idx = __traits(getMember, core.stdc.errno, symname);

        if (errnoStrings[idx].length)
        {
            writefln("%s DUPLICATE %d", symname, idx);
        }
        else
        {
            errnoStrings[idx] = symname;
        }
    }
}

writeln("static immutable string[134] errnoStrings =\n[");

foreach (immutable i, immutable e; errnoStrings)
{
    if (!e.length) continue;
    writefln(`    %-3d : "%s",`, i, e);
}

writeln("];");
version(Posix)
static immutable
string[134] errnoStrings;

Meta