STinC++ rewrites the programs in Software Tools in Pascal using C++
I’m not sure that a book written today would spend so much time on file i/o and file system manipulation. While its aims are rather different, Stroustrup’s A Tour of C++, one of the few "beginner’s books" I have my shelf, has a section on file i/o which runs to a total of 17 lines. Several times over the past six months (hey, crazy times) I’ve had to remind myself that, for some proportion of Software Tools in Pascal's original audience and perhaps a larger proportion of the audience for its predecessor Software Tools, programs couldn’t rove around the filesystem, that files couldn’t contain arbitrary text, nor could programs copy or move files around in the filesystem. Given that we all been able to do all these things, pretty much regardless of a programming language choice, for the last thirty years or more, most of the programs in this chapter feel a little inconsequential. This is particularly the case for makecopy which is barely more than a wrapper around a library function. The final program,
archive, does feel more substantial though. I enjoyed working on it, and it’s really quite a satisfying piece of code.
I found out this morning that the source code for Software Tools in Pascal is on Brian Kernighan’s old Princeton University website in the archive format (well, almost - there’s some extra stuff after the first entry, and the length of MAN/archive.m is wrong). I used my version to extract everything and now I feel kind of validated.
On to chapter four, sorting.
This whole endeavour relies on Software Tools in Pascal and Software Tools, both by Brian W Kernighan and PJ Plauger. I love these books and commend them to you. They are both still in print, but new copies are, frankly, just ridiculously expensive. Happily, there are plenty of second-hand copies floating round, or you can borrow them from The Internet Archive using the links above.
For this project I’ve been using JetBrain’s CLion, which I liked enough to buy and renew, because it’s a year already, a license.
The test harness I’m using is Catch. I’ve been aware of Catch pretty much since it was first released, but this project is the first time really getting in and using it. I like it, and it’ll be my first choice in the future.