Log in

No account? Create an account

Previous Entry | Next Entry


Arguing with WvArgs

  • 7th Oct, 2005 at 3:13 AM

Over the past three days, I've been doing a bunch of work on the WvStreams 5.0 release. This means that I've trawled through the bug tracking system trying to get all the nasty bugs out of the way.

One of those things has been converting WvArgs, our argument parser from using popt to argp.

Argp is arguably a more reliable and better maintained piece of software. And when pzion wrote WvArgs, he did a very respectable job with the API, so I had few reasons to change that. And since we had never shipped WvArgs before, I didn't feel so bad about mucking about with the internal implementation.

What gave me a nasty headache is the fact that popt and argp are complete opposites. Popt is implemented as a generator, so it is procedurally driven; whilst argp is implemented as a data-driven state machine. Which meant that I had to basically invert the insides of WvArgs, without breaking its API.

This caused me a little bit of distress, and I found that I was suffering from ennui halfway through the transition. But I persevered! Now I've got something that appears to be bug-free and happily working.

Though it does make me wish for a program-at-a-time refactoring browser. It would have been very nice to be able to do global changes, or to move bits of code around easily. I did a lot of typing that I didn't want to do, over these past few days. It's put my mind on the well-worn track of writing the source-editing minor-mode of my dreams. But I'll have to shelve this until I get more time on my hands.


( 4 comments — Leave a comment )
7th Oct, 2005 17:18 (UTC)
There's a C++ refactoring mode for Emacs available, it's called Xfactor or Xrefactor, if I recall, you might want to have a look at that?
7th Oct, 2005 17:42 (UTC)
You're talking about Xrefactory, which is non-free.

As well, I'm looking for more than just a refactoring tool. What I want is actually a semantic browser that understands source code, and also gives out semantic warnings. (Like, "undefined variable used" or "uninitialised member variable".)
7th Oct, 2005 17:46 (UTC)
Yes, that's the one.

And it is a semantic browser. It has the EDG C++ front end inside of it to parse C++ and "understand" it. It's rather smart, I'm told.
7th Oct, 2005 17:51 (UTC)
Not as smart as I'd like it to be. So one day, I'll get around to writing a free tool.
( 4 comments — Leave a comment )