Added macro names for error code numbers; converted more functions to modern C declarations.