Factor out code to iterate through records

Add new API function ihex_iterate_records() containing the handling of different record types to avoid duplicated code in existing and future API function implementations.

Also make this iterator publicly available for custom use of the data records.

This is a rebased version of the code previously suggested as RFC, thus fixes #24.