* (e.g. EINVAL -> WSAEINVAL). We painstakenly map the missing constants to their WSA
* equivalent values and expose the WSA constants on their own.
*/
private static void initWindows(PyObject dict) {
// the few POSIX errnos Windows defines
ConstantSet winErrnos = ConstantSet.getConstantSet("Errno");
// WSA errnos (and other Windows LastErrors)
ConstantSet lastErrors = ConstantSet.getConstantSet("LastError");
// Fill the gaps by searching through every possible constantine Errno first
// checking if it's defined on Windows, then falling back to the WSA prefixed
// version if it exists
Constant constant;
for (Constant errno : Errno.values()) {
String errnoName = errno.name();
if ((constant = winErrnos.getConstant(errnoName)) != null
|| (constant = lastErrors.getConstant("WSA" + errnoName)) != null) {
addCode(dict, errnoName, constant.value(), constant.toString());
}
}
// Then provide the WSA names
for (Constant lastError : lastErrors) {