The CVT Module
From Jim Starkey on the Firebird Development List 10th February 2004
I am in the process of encapsulating CVT into a single class Move. Most of this involves untangling unholy relationships between CVT and parts of the engine it shouldn't even know exist. The basic idea is to make a simple (sic!) Move class that can be subclassed in different contexts for specialised behaviors. I'm sure everyone who has tripped over that snakepit has had similar asperations, and I would like the benefit of hearing any thoughts on the subject.
One big issue is error reporting. The existing module passes the address of an error reporting function on every call. The problem is allocating an error string. The module currently has conditional compilation for allocating the string, hoping someone else will do the right thing about making the string go away.
I'm changing the interface slightly. Each function now has an optional "void* errorArg" which will be passed through to a small number of error reporting methods. In the base class, the errorArg will be ignored and an appropriate (whatever that turns out to mean) exception thrown. For compatibility, the engine and non-engine clients will subclass Move, overriding those methods to do what ever the old CVT did.
Another problem is international character sets. I haven't studied the problem completely, but most environments don't have the facilities to load and process them. I am thinking about making methods that in the base class are no-ops that can be overriden in context specific subclasses. Again, ideas would be appreciated.
It is my firm intention that Move will have no non-platform conditionalization or dependences.
Wish me luck...