Our staff is just finishing up the loading of data entry screens from plain text layouts. The new code is much simpler. It will be easier to maintain.
For a while there was a bug that made some old-style layouts go haywire. Weird colors, everything out of place. In the last post I forgot to mention one more problem with binary data: byte orders. That’s what caused the error.
There are two ways for computers to store multi-byte numbers. Big-endian systems order the bytes from biggest to smallest. Little-endian goes small to big. It’s just a hardware thing. Neither is better or worse. For most things it makes no difference.
Intel chips are little-endian. Ditto for MS-DOS, Windows, and anything else in Wintel world. Motorola chips are big-endian. So was the Macintosh, back when it ran on 680×0 and PPC.
When the Mac switched to Intel in 2006, all Mac apps had to to add code to swap bytes around when reading old data with the new chip. We already did that in 2001 for the Windows version, so moving the Mac app to little-ends was not painful. The biggest problem was the switch of programming tools, from Metrowerks CodeWarrior to Apple’s Xcode.
A Goldenseal company file can use either byte order, or it may have some of each. Each record stores that info along with its version number. Any files started on pre-2007 Macs probably have both types of ordering.
The update to TurtleSoft Pro makes every record little-endian. Fortunately, the new M1 and M2 Apple chips are also little-ended, so we probably won’t need to swap bytes for a long time in the future.
However, there is one pocket of big-endian data that still remains: layouts for screens, reports and printed forms. They started out as old-style Mac resources: big-endian. Thanks to their packed binary format, it’s not easy to change them over. Instead, we’ll keep reading the old format for a while, but gradually convert them to text.
Last December our staff added one innocent line of code that gave the wrong endian marker to layouts coming from the database. It scrambled all the multi-byte formatting, including colors and screen positions. Oops.
When binary data is off by one byte, things also get weird. For a while we thought that was the cause. Finally, we ran older versions and narrowed it down to the day when the bug started. That made it easier to spot the culprit.
Byte order is one more reason to switch data to text. ASCII and UTF-8 use single bytes, which are the same for any endian. If Apple decides to move the Mac to some new big-endian chip in 2038, the update will be less painful.
I’m pretty sure there are no more huge changes left to do before finishing TurtleSoft Pro. So, our staff is back to normal programming. The process is simple but repetitive. Use the new app in parallel with the current Goldenseal. Get it to work. Fix any problems. Rinse, repeat.
Dennis Kolva
Programming Director
TurtleSoft.com