Jez Higgins

Freelance software grandad
software created
extended or repaired


Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed

Friday 28 August 2020 The Forest Road Reader, No 2.53 : STinC++ - Chapter Three Wrap Up

STinC++ rewrites the programs in Software Tools in Pascal using C++

  • compare - are these two files the same?

  • include - simple file inclusion

  • concat - file concatentation

  • print - paginating file printer

  • makecopy - file copy

  • archive parts 1, 2, 3, & 4 - file archiving utility

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.

Endnotes

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.


Tagged code, and software-tools-in-c++


Jez Higgins

Freelance software grandad
software created
extended or repaired

Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed