This turned out to be quite a chore; I didn’t want to use Rez, because it’s
deprecated, and the
hdiutil udifrez and
hdiutil udifderez options are,
well, not particularly well documented (not to mention asymmetric unless
you’re using the undocumented XML format).
Anyway, it turns out that the documentation on the legacy MacOS resource fork format is in the book More Macintosh Toolbox, though that doesn’t actually define the format of the resources themselves (for that you have to look elsewhere). I haven’t split out the resource fork parsing/generating code, unlike the Alias/Bookmark code, because this really is the only place that the resource fork format is being used now.