upgrade error reporting

+ Add file, line and function info to error messages.
+ Fix checking if status in bounds.
+ Add convenience macros and rename enumeration constants just in case.

See #3.