eerimoq / bincopy

Mangling of various file formats that conveys binary information (Motorola S-Record, Intel HEX, TI-TXT, Verilog VMEM, ELF and binary files).
MIT License
109 stars 38 forks source link

Have 'Segment.chunks' yield smaller 'Segment's #37

Closed bessman closed 11 months ago

bessman commented 11 months ago

Per discussion in #35.

Three tests are failing so it wasn't quite as straight-forward as I'd hoped. I'll try to get them passing.

bessman commented 11 months ago

Tests are passing. I reverted the changes to _Chunk, since it's no longer needed except for compatibility.

Should Segment have a __len__ instead?

bessman commented 11 months ago

I'm working on updating outdated docstrings referring to Chunk.

bessman commented 11 months ago

One subtle change that comes with this is that Segment instances can now be immediately adjacent to each other. Previously, one could rely on data immediately before or after a Segment being null. Could that be a problem?

eerimoq commented 11 months ago

Will think about that tomorrow.

eerimoq commented 11 months ago

I think it's fine.

bessman commented 11 months ago

Went ahead and added Segment.__len__, taking word_size_bytes into account.