Jan 12
Reviving old code
Persona was my first X11 app. It’s not much, just a basic address book, but it has been interesting to get it up and running again. I’m creating new project pages for all my various little projects and it seemed appropriate to start with the oldest.
Persona uses the XForms library written by Mark Overmars and T.C. Zhao. (Not to be confused with the XML format). Back around 95 I discovered this library and found it so much easier than trying to write raw Xlib apps. With oval buttons! I wrote a C++ wrapper around it which I thought was pretty nice. And so when I wrote Persona in 99 I used it, even though QT and GTK+ must have been around by then. XForms is pretty obsolete now, but fortunately it can still be downloaded from its Savannah project page. And it still builds and links against X11 without any problems.
Getting Persona working with modern standardised C++ was the main bit of work. Back when I wrote Persona the C++ standard was still being discussed, things weren’t stable, so there are some work arounds. For example I wanted to use auto_ptr, but I found GCC had removed it as “because the details of the interface are still being discussed by the C++ standardization committee”. I copied in my own copy as djm_memory, but that clashes with the now standardised memory header, so djm_memory had to go.
Some other antiquitisms:
- I had using std; instead of using namespace std;
- I was using strstream instead of stringstream – Quietened that down with-Wno-deprecated.
I switched off the GCC warning which drives Nigel nuts, “has virtual functions but non-virtual destructor”, with -Wno-non-virtual-dtor. For me this may really point to a memory leak, but I’m going to ignore that for now.
My XForms wrapper code uses member functions and templates a lot. So I got a lot of error messages like: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&MainForm::prev’ It’s nice when the compiler tells you how to fix your bug. I wonder why they tightened the member function rules up though?
Finally, it lives!
I also rediscovered Persona has a text command mode implemented with Lex and Yacc. I’d forgotten that. Persona will run in text mode if there is no X11 display, or if “-text” is passed on the command line. It’s not very good though, because I never implemented the search command for this mode.
Fonts aren’t the same so I tweaked some of the placements, not much though. This makes me realize XForms didn’t have very good font handling.
Next task: to rewrite Persona with a GTK or wxWidgets interface. Hmmm, maybe not. I’ll just leave Persona as it is, as a piece of LinuxSoftware history.



