errnoMap

Reverse mapping of errno values to their string names.

Automatically generated by introspecting core.stdc.errno with the code below.

string[134] errnoMap;

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

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

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

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

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