As a real example of a translation from Delphi source code into C++, the excellent ATBinHex component of Alexey Torgashin was chosen. ATBinHex is a quick file viewer component with many options. Among others you can change between text, binary, hexadecimal and unicode mode.
Meanwhile no official website for the download of this component seems to exist any more, it is, however, available by different download portals furthermore. The original code is also contained in the zip file of this translation example.
Delphi demo application
A simplified demo has been created, which doesn't depend on additional components as the original demo of Alexey Torgashin. In addition, it isn't necessary to install the component before compiling the application. The translated C++ code isn't tested sufficiently so that at an installation should be done with caution only.
The Delphi demo is in the in the folder "ATBinHexSource". It was made with the BDS 2006. The original source code of Alexey Torgashin in the version 2.7 is in the subdirectory "Source".
Version of CBuilder
The Delphi code was translated by use of the VCL of CBuilder 6 and the project war created for the CBuilder 2009. A use of the translated code with CBuilder 6 would have to fight with additional difficulties because there WideStrings and the __int64 type are supported badly.
ATBinHex.prj Delphi2Cpp options to translate the ATBinHex code ATBinHex.txt List of identifiers, which is included by ATBinHex.prj
Stadia of the translation
Different stadia of the translation can be found in the following folders:
|MadeCpp/||the unmodified result of the translation with Delphi2Cpp 1.4.0|
|MadeCompile/||the C++ code made compile|
|MadeRun/||the C++ code made run|
The project for C++Builder 2009 is in the folder "ATBinHexExe2009".
|ATBinHexCpp||A copy of the folder "MadeRun" (see above)|
|ATBinHexExe.cbproj||C++Builder 2009 project file|
|ATBinHexExeCpp||file for "WinMain"|
In addition ther are copis of the files from ../Delphi2Cpp/Source/CBuilder.
d2c_sysfile.cpp // not used in this project
These files of Delphi2Cpp 1.5.1 are extended by some supplementary functions, which are needed here: Assert, Inc, SetString, Sqr.
It would be easy to achieve perfect translation results by suitable choice and modifications of source code. It, however, was aim in this test to attain an objective assessment of the translation capabilities of Delphi2Cpp. Therefore here was tried to translate publicly available unmodified source code as good as possible.
This translation was made with Delphi2Cpp 1.3.0 for the first time in May 2010. At that time the result was: approx. 7500 lines of Delphi source code were translated. Less than 100 lines of code in the produced C++ code had to be reworked. January 2011 with Delphi2Cpp 1.4.0 the number of necessary coreections was reduced to 34. 24 changes are necessary with Delphi2Cpp 1.5.1 currently in September 2011. 10 changes are simple substitutions of the expression "Classes__0" by "Classes__1". This difference arises from the circumstance that the C++ version of the VCL of the C++ Builders isn't generated with Delphi2Cpp.The ways of counting change with every version of the C++ Builder.
To make the compilable code work, only one final correction was necessary.
|Delphi2Cpp version||date||number of corrections|
|Delphi2Cpp 1.3.0||May 2010||< 100|
|Delphi2Cpp 1.4.0||Jan 2011||34|
|Delphi2Cpp 1.5.1||Sept 2011||24|
Delphi2CB: has been relased [more...]
Delphi2Cpp 2.0: DelphiXE2Cpp11 now is Delphi2Cpp 2.0 [more...]
"Thanks for your great work, really appreciate the work you have done on zlib and compiling ... test case."
Nokia India 02/01/2021
"First off, I have to say WOW! Delphi2Cpp is doing a *fantastic* job!"
This website is generated from plain text with [Minimal Website ]
is made with TextTransformer
TextTransformer is made with Borland