[Patch] Implements changing the type of TConvType and TConvFamily to Word (Delphi compatibility)
As discussed on the mailing list, in Delphi TConvType and TConvFamily are actually of type Word.
This has as a consequence that you cannot use some return value as an error indication, since all valid return values will be in the complete range of type Word. (Well, one coud reserve either 0 or $FFFF for that, but that would be Delphi incompatible again).
Therefor another mechanism to indicate an error as a function result had to be implemented.
The same applies to functions that return a string: any string returned could also be a valid return value.
So, again for consistency a new mechanism for that was also implemented.
For the API this has no consequence ATM, it's all in the implementation.
If so desired the TryXXX functions could also become part of the API, so users can avoid (expensive) exceptions.
Some notes:
- For consistency now exceptions are raised where Delpi (7) also does this (even if the Delphi docs say the don't).
- While Delphi alllows registering more than High(Word) conversion types, the return value of the registering function will then wrap around. That makes absolutely no sense at all, so I chose to raise an exception there. (The same for conversion families.)
- Delphi does not disallow registering a conversion type with a conversion factor < -1.0, so I fixed that as well.
- I also fixed an unrelated comment (added a "not")
I plan to also implement the UnregsiterXXX functions.
That will require a major refactoring of the implementation, since simply reading TheUnits[Index] of TheFamilies[Index] won't suffice anymore.
For that I need to have this patch applied first.
convutils-tconvtype-tconvfamily-equals-type-word.diff