Revamped the text-handling routines and added support for text styles. This is trickier than it sounds because style information in Storyspace, naturally enough, coincides with the sorts of styles that QuickDraw used. The style information is stored in a hand-built heap flattened in the binary disk file, and reading it is tricky because, if you don’t get it exactly right, you have garbage and no hint of what went wrong. I remember that this drove me up a wall for the original Storyspace for Windows. Good times.
To make things worse, I lost a perfectly good hour debugging this because unit tests were asking for one file and SSPFile was opening another file just like it, but with different style information. Storyspace was doing it right but the results were wrong.
Another long session began a cleanup of the guard field parser. This is very old code, largely untouched since I added some features to support my IWHD paper in 1995. It’s so old that it doesn’t use std::string, since the standard template library wasn’t even a standard until 1994. So everything is built around old-fashioned C strings. Worse, everything depended on buffers of fixed size, because Jay Bolter, who did the coding for Storyspace 1, had a signature avoidance of variable-length strings. So not only do I have the ghost of my own old style, filled with fstrcpy
and strchr
, I’ve also got this palimpsest of Bolter’s style. It still needs more work, but all the antique machinery has now been replaced and those ugly buffers are all gone.
Other bits and pieces for Sunday afternoon included fast enumeration support for Nodes, Links, and Styles, and adding a pane splitter to support an optional map view. The latter was especially nasty because XCode started to crash when resizing Interface Builder elements. Something is not right.
Is there a secret trick to tell XCode to heal an ailing project? Email me.