Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

DelphiBaseNcoding

Port of BaseNcoding to Delphi

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

#DelphiBaseNcoding#

Port of BaseNcoding to Delphi

CSharp Source Code Location: [https://github.com/KvanTTT/BaseNcoding](https://github.com/KvanTTT/BaseNcoding)

Porting guidelines:

pascal
DelphiBaseNcoding is a straight clone of BaseNcoding with as little changes as 
possible, to allow easy Synchronization in the future.
pascal
1. All file names (units) are the same, but with a "u" prefix. 
2. Some variables were closely named. 
3. Some functions were written by me because i could not find a Delphi Equivalent
   of the C# function used, in the RTL or for Backwards Compatibility with older
   Unicode versions of Delphi.

Hints about the code:

pascal
1.  Multi-condition "for" loops and loops where iterator gets changed inside 
  the loop were converted to while loops.
pascal
2.  Log method (Delphi Equivalent "LogN"), two arguments (a, newBase) needed to be 
    swapped in Delphi.
pascal
3.  All Strings were ported as 1-Based (Index) because that is what Delphi Desktop 
   Compilers Uses by Default.
pascal
4.  The "Base Strings" were converted to Constant Arrays in Delphi.
pascal
5.  Delphi needs manual disposal of objects created , as they don't have built-in 
    destructor (automatic garbage collectors) support in them.
pascal
6.  This Library is written with (Delphi XE7 Update 1). 
    This Library supports only Unicode versions of Delphi (Delphi 2009 and above). 
    Mobile Compilers are NOT Supported. you could make a fork and implement it.
pascal
7.  Some functions that needed the (BigInteger Type) in C# for operations 
    were not ported due to the fact that Delphi does not offer Built in Support for 
    Big Integers. (might port them later if i find a suitable Library).

Common pitfalls during porting:

pascal
1. Calling Log methods without swapping arguments places.
2. Writing for .. to .. do loop instead of for .. downto .. do in rare cases.
3. Wrong Indexing of values from Strings.

To Do Lists:

pascal
1. Port BaseN and BaseBigN.
2. (May be) Add Test Units.