Doxygen comments & coding style & bug fixes

Most of the commits are no functional changes. Exceptions are:
- 08bde5f Aways exit if sanity checks fails
- b11b2e2 Fix compilation issue on FreeBSD
- abb9e23 Unified parsing using macro "PARSE_ERR"
- 3d14f9d Fix possible unconditional comma issue in PARSE_ERR macro