As I mentioned in my last post about Orpheus I will today show how to move the Abbrevia component suite to RAD Studio XE5.
But before I have to mention that I got a special permission from Embarcadero to show my experiences with the RAD Studio XE5 product.
RAD Studio XE5 is the brand new product from Embarcadero that allows native development for the the Win32, Win64, OS X, iOS and Android platform.
Jim McKeeth and Marco Cantu have written some nice examples about how to share the code between iOS and Android.
You can get more information about Android and RAD Studio at Embarcadero.
I’m using a pre-release version of RAD Studio XE5.
Okay, let’s come back to Abbrevia. Like Orpheus, Abbrevia has originally been written by the great TurboPower company that closed on January 7, 2003. Today, 10 years later a lot of applications still use their code.
Abbrevia is now released under the Mozilla 1.1 license and it is hosted at SourceForge. Abbrevia is maintained by Craig Peterson who works for Scooter Software the producer of Beyond Compare. IMO Beyond Compare is a must for every Delphi developer but let’s come back to Abbrevia.
The migration to RAD Studio XE5 is easy. I checked out the latest version from SVN, made a copy of the RAD Studio XE4 project group, renamed it to RAD Studio XE5 and saved every package in a new RAD Studio XE5 folder. At last I changed the lib suffix from 180 to 190 and everything compiled.
Everything compiled at once but I got one simple warning: “The symbol StrLen is deprecated.” A short look at System.SysUtils shows the issue:
{$IFNDEF NEXTGEN} function StrLen(const Str: PAnsiChar): Cardinal; overload; inline; deprecated 'Moved to the AnsiStrings unit'; {$ENDIF !NEXTGEN}
This issue has been introduced with RAD Studio XE4. It is because of the NEXTGEN compiler, the compiler for iOS and Android, which doesn’t support AnsiStrings in the way the old desktop compiler does. I don’t want to start a discussion about this but I simply would like to say that I do like this strategy.
Anyway, the AnsiString stuff has moved to the unit System.AnsiStrings. Furthermore Abbrevia already uses a compiler symbol for the use of this unit:
{$IF RTLVersion >= 25} {$DEFINE HasAnsiStrings} {$IFEND}
This means I could write
uses {$IFDEF MSWINDOWS} Windows, {$ENDIF} SysUtils, {$IFDEF HasAnsiStrings} System.AnsiStrings, {$ENDIF} AbBitBkt, AbCharset, AbDfBase, AbDfDec, AbDfEnc, AbExcept, AbResString; ... Len := {$IFDEF HasAnsiStrings}System.AnsiStrings.{$ENDIF}StrLen(Buff); ...
As you can see again it is very easy to maintain old components with RAD Studio XE5. And EMBT has done a lot of effort to share the code between the old desktop compiler and the NEXTGEN compiler.
Next time I will move SynEdit to RAD Studio XE5. Again, stay tuned.