-- Leo's gemini proxy

-- Connecting to gemini.conman.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

I was working harder, not smarter

Another department at the Ft. Lauderdale Office of the Corporation is refactoring their code. Normally this wouldn't affect other groups, but this particular code requires some executables we produce, and to make it easier to install, we, or rather, I, needed to create a new repository with just these executables.


Easier said than done.


There's about a dozen small utilities, each a single C file, but unfortunately, to get the banana (the single C file) you also need the 800 pound gorilla (its dependencies). Also, these exectuables are spread through most of our projects—there's a few for “Project: Wolowizard [1]” (which is also used for “Project: Sippy-Cup [2]”), multiple ones for “Project: Lumbergh [3],” a few for “Project: Cleese [4]” and … oh, I never even talked about this other project, so let's just call it “Project: Clean-Socks.”


Uhg.


So that's how I spent my time last week, working on “Project: Seymore,” rewriting a dozen small utilities to remove the 800 pounds of gorilla normally required to compile these tools. All these utilties do is transform data from format A to format B. The critical ones take a text file of lines usually in the form of “A = B” but there was one that took over a day to complete because of the input format:



A = B:foo,bar,... name1="value" name2="value" ...
A = B:none


Oh, writing parsing code in C is so much fun! And as I was stuck writing this, I kept thinking just how much easier this would be with LPEG [5]. But alas, I wanted to keep the dependencies to a minimum, so it was just grind, grind, grind until it was done.


Then today, I found that I had installed peg/leg [6], the recursive-descent parser generator for C, on my work machine eight years ago.


Eight years ago!


Head, meet desk.


Including the time to upgrade peg/leg, the time it took me to rewrite the utility that took me nearly two days only took two hours (most of the code among most of the utilities is the same—check options, open files, sort the data, remove duplicates, write the data; it's only the portion that reads and converts the data that differs). It's also shorter, and I think easier to modify.


So memo to self: before diving into a project, check to see if I already have the right tools installed.


Sigh.


[1] /boston/2010/10/11.1

[2] /boston/2014/03/05.1

[3] /boston/2018/09/11.2

[4] /boston/2018/09/11.2

[5] http://www.inf.puc-rio.br/~roberto/lpeg/

[6] https://www.piumarta.com/software/peg/


Gemini Mention this post

Contact the author


-- Response ended

-- Page fetched on Sat May 18 05:12:18 2024