08/26/2024
Delphi2Cpp 2.4
The current update Delphi2Cpp 2.4.0 is primarily dedicated to the new features in the recently released RAD Studio 12.1, but it also contains many other, partly fundamental, improvements. RAD Studio 12.1 again includes a usable C++Builder with a new, modern Clang compiler. Also new in Delphi 12.1 is the support of multi-line strings: the multiline example shows how Delphi2Cpp 2.4. converts them to C++.
1. Code that uses the cross-platform message manager TMessageManager is now translated without errors.
2. Code that uses the atomic functions no longer requires manual post-processing. This affects:
AtomicDecrement
AtomicIncrement
AtomicExchange
AtomicCmpExchange
3. The translation of System.System.SyncObjs.pas has been revised and completed for Windows using CRITICAL_SECTION.
4. There is now an additional option to optimize the translated code for the modern C++Builder compiler.
5. There is now an additional version of the Synedit components translated for C++Builder for the modern 64-bit compiler. The previous versions have also been partially updated.
https://github.com/dm-e/SynEditCb
Improved algorithms
The method by which the previously found types, variables, etc. are looked up when generating the output has been fundamentally improved. Previously, a kind of "brute force" method was used, which sometimes resulted in incorrect alternatives. The new algorithm is much more intelligent. This means that this method is not only more precise, it also works around 25% faster (SynEdit example previously 4:00 min, now 2:55 min). Redeclarations of identifiers are also now treated differently than before. For compilers other than C++Builder, redeclarations such as the following are now suppressed (or output as a comment):
dupIgnore = System.Types.TDuplicates.dupIgnore;
If necessary, the original type is now referred to using appropriate qualification. In contrast to Delphi, this is always possible in C++.
Both improvements together lead to a more precise qualification of the identifiers and thus ultimately also lead to improved disambiguation.
Copy comments
If the feature is used to automatically insert prepared C++ code, the corresponding output code is now marked with two comment characters:
//# copied begin ... prepared code // copied end
E.g.:
(*#_#include "math.h"_#*) -> //# copied begin #include "math.h" //# copied end
out parameters
Up to now Delphi2Cpp has treated var parameters and out parameters indiscriminately, since there is no real equivalent to out parameters in C++. Now, by initializing the passed out parameters, at least the fact that out parameters lose their possibly contained values when being passed to the function is taken into account. This makes it clear in the translated code that these are not simple reference parameters.
Example:
function TryParse(const S: string; out Value: Cardinal): Boolean; var E: Integer; ... -> bool __fastcall TryParse(const String S, unsigned int& Value) { Value = 0; //# clear out parameter bool result = false; int E = 0; ...
Additional tools
1. ExtractIdentifiers is a tool with which you can now create and correct identifier lists outside of the Delphi2Cpp IDE.
Note: when creating these lists within the IDE, there is now a change that numbers are no longer inserted into this list.
2. ExtractReworked is a tool with which you can simplify the adoption of changed translation results.
10/19/2023
Delphi2Cpp 2.3
Conversion of DFM files to C++
The code of DFM files can now optionally be converted into C++ code that is executed at runtime when the form or a frame is created. Essentially, the DFM code becomes to a series of simple assignments of values to component properties. Delphi2Cpp also manages to map other sometimes complex serialization actions in an intuitive and simple way. For this purpose, special routines are called which do not assign the values to the properties directly, but rather pass them as arguments to the routines, in which further actions can then be carried out. Especially for third-party components, Delphi2Cpp can be configured to call such user-defined functions.
By translating the DFM code, GUI applications can be built in C++Builder that do not require any DFM files at all. For other compilers, converting the DFM code is the essential bridge to using C++ GUI libraries.
More details about converting DFM files
Delphi2Cpp 2.2
01/31/2023
Adopting changes to Delphi2C# to facilitate translation of incomplete code
|
02/07/2022
Delphi2Cpp 2.1
|
08/06/2021
DelphiXE2Cpp11 now is Delphi2Cpp 2.0
For C++98, the inner functions are now extracted from nested functions so that they become class functions or normal free functions. Parameters and variables of the outer function are passed to the extracted functions. Delphi2Cpp 1 already had this feature, but it was missing in Delphi2Cpp 2.x up to now. With this feature, Delphi2Cpp 2.x can be seen as the legitimate successor to Delphi2Cpp 1 and thus becomes Delphi2Cpp 2.0.
03/31/2021
For recursively called nested functions, Delphi2Cpp 2.x now generates explicit forward declarations in C ++ instead of the error-causing auto routines. E.g .:
function nested : boolean;
function nested_reflexive(depth :Integer) : boolean; begin if depth = 2 then result := true else result := nested_reflexive(depth + 1); end;
begin result := nested_reflexive(0); end;
->
function<bool (int)> nested_reflexive;
bool __fastcall nested() { bool result = false;
nested_reflexive = [&](int depth) -> bool { bool result = false; if(depth == 2) result = true; else result = nested_reflexive(depth + 1); return result; }; result = nested_reflexive(0); return result; }
Additional RTL files have been translated:
System.ZLib
System.ZLibConst
System.Win.Registry
08/05/2020
Improved solution for the C ++ replication of module-wide visibility of class members in Delphi.
The actualized documentation already contains information to the planned programm Delphi2CB. Delphi2CB will be a low cost extract from Delphi2Cpp 2.x for users of C++Builder.
06/23/2020
Delphi2Cpp 2.x translation-service offer: 1000 lines of your code converted for free
04/02/2020
Documentation actualized, beta offer closed
11/15/2019
Nifty class references
For other compilers then C++Builder Delphi2Cpp 2.x supports a new pattern to create class references, which is much more nifty than that of the old Delphi2Cpp. There is a function:
template <class Class> TClass class_id()
which delivers instances of class references in a similar way as the __classid function at C++Builder. Class instances can be created from such class references by calling virtual constructor functions.
10/16/2019
Offer of Delphi2Cpp 2.x beta
01/30/2011 Version 1.6.3
Member variables are initialized in the initialization lists of the constructors with default values automatically now, if there aren't any explicit initializations in the body of the constructor. If there are such explicit initializations, then they are moved into the initialization list. This shift doesn't take place if the initialization depends on a condition. Example:
constructor Base.Create(arg : Integer); __fastcall Base::Base( int arg ) begin : FI(arg), FList := TList.Create; FList(new TList), FI := arg; FTimeOut(0) if arg <> $00 then { FTimeOut := arg if ( arg != 0x00 ) else FTimeOut = arg; FTimeOut := DefaultTimeout; else end; FTimeOut = DefaultTimeout; }
|
01/05/2011 Version 1.6.2
|
10/31/2011 Version 1.6.0
|
10/10/2011 Version 1.5.2
|
09/26/2011 Version 1.5.1
|
08/22/2011 Version 1.5.0
|
06/21/2011 Version 1.4.9
|
05/31/2011 Version 1.4.8
|
05/08/2011 Version 1.4.7
|
04/11/2011 Version 1.4.5
|
03/14/2011 Version 1.4.3
|
02/21/2011 Version 1.4.2
|
A customer of Delphi2Cpp has contributed a "high-performance template class that emulates Delphi sets". Features:
|
Many thanks to Daniel Flower.
02/04/2011 Version 1.4.1
- There is a workaround now for returning static arrays from functions. Because this is not possible in C++, a pointer to the first element of the array is returned and used as argument for "memcpy". In cases, where the static array is locally constructed inside of a function, a helping array in the file scope is used for an intermediate copy of the array.
- With-statement are translated in another manner now. Instead of inserting the with-expression at all according positions, a temporary variable of the resulting type is created now. So constructions like the following are translated correctly too:
with TmyObject.Create do try // do something with the object finally Free; end;
->
{ /*# with TmyObject.Create do */ TmyObject* tmp2 = new TmyObject; try { // do something with the object } __finally { tmp2->Free(); } }
- The hardly understandable error message "unit expected" appeared, if an included file began with an UTF8 BOM. This BOM is created from recent Delphi versions and is accepted from Delphi2Cpp now too.
- There is now a simplifying macro for the dynamic_cast<> in place of the "is" operator:
#define ObjectIs(xObj, xIs) dynamic_cast< xIs >( xObj )
This macro must be contained in the overwritten System.pas. If this file is not used also the marco is not used, the translation remains the same as in the previous versions of Delphi2Cpp.
- Instead of the not existing "BDE.pas" "bde.int" is analyzed now, if the path of this file belongs to the include paths. If the files "WinTypes.pas" and "WinProc.pas" are not found, the preprocessor replaces their references with the reference to "Windows.pas".
- More special bug fixes.
01/16/2011 Version 1.4.0
- The professional version of Delphi2Cpp.exe can be executed as command line programm too now.
- The source code file "System.pas" - particularly important to Delphi - can individually be overwritten and/or extended now (only in the professional version of Delphi2Cpp).
- The skeleton of such an individual "System.pas" is installed into the "source" folder. The most important functions for the memory management are defined in this "d2c_system.pas". The translation of the file with Delphi2Cpp yields working C++ code and can be compiled and linked together with the translated files of one's own.
- "d2c_system.pas" contains among others also special functions for "Inc" and "Dec" which work also for enumerated types. For such types these functions aren't replaced by the incrementing or decrementing operators at the translation any more.
- The function "Fillchar" will not be converted to the "memset" function automatically any longer. In a more systematic way the function was inserted in "d2c_system.pas" instead.
- Temporary parameters in function calls are put in front of these calls explicitly as variables now. This variable and the function call are enclosed into a {...} block. So the life time of the variables is guaranteed for the time period of the function call. It is ensured at the same time that the two instructions are within a common block even if the original instruction had been an isolated part of a control structure without such block. E.g.:
if Greet(PChar('hello ' + Name + '!')) then Exit;
->
{ AnsiString Str__0( "hello " ) + Name + "!"; if ( Greet( Str__0.c_str( ) ) ) return;; }
If a temporary "set" of values is passed as "open array" parameter to a function, a corresponding array is produced in C++ output now, which is put in front of the function call.
procedure Log(strings : array of String);
Log(['one', 'two', 'three']);
->
void __fastcall Log( const String* strings, int strings_maxidx )
{ String tmp__0[ 3 ]; tmp__0[ 0 ] = "one"; tmp__0[ 1 ] = "two"; tmp__0[ 2 ] = "three"; Log( tmp__0, 3 ); }
- Improvements in the calculation of compile time constants.
- The strategy, to leave identifiers of type identifiers unchanged has been exceeded. E.g. "String" isn't replaced by "AnsiString" or "WideString" any more.
- Till now, "String" parameters were always treated like Delphi strings, also if the option for the translation as standard strings was activated. From this update on, "String" parameters are treated in conformity with "AnsiString" and "WideString".
- Missing namespace identifier at constants and in redeclared constructors are written now.
- The case sensitivity of sections of code where "Cpp" is defined isn't corrected any more. Before, e.g. it could happen that "# include <io.h>" was changed to "#Include <io.h>".
- Substitutions are already executed now before a used unit is opened so that instead of the original unit another one can be included. The special substitution of "WinProc" to "Windows" already was done automatically, if "WinProc" wasn't found. This happens for "WinTypes" now automatically, too.
- "MSWINDOWS" per default is defined now. This definition can be removed or replaced of course.
- The quality of the translation was checked once more by a: in May 2010 the real example "ATBinHex" was translated with Delphi2Cpp 1.3.0 for the first time. Now the example was translated again with Delphi2Cpp 1.4.0. The number of required manual corrections is reduced to less than the half.
- The help to Delphi2Cpp optionally can be installed also as a PDF file.
- There is now a Translation service with Delphi2Cpp.
12/06/2010 Version 1.3.9
- "ShortString" and "String[n]" are translated adequately now as far as possible. I.e. calls of "Length", "SetLength", "Low" and "High" are treated for these string types especially. For other string methods "ShortString" and "String[n]" are converted into a strings temporarily. (ShortString were treated like normal strings till now.)
- The methods for the calculation of pointer types were revised completely. This often leads to more precise translation results than till now. This concerns particularly dynamic arrays. Till now, parameter type frequently became replaced by base types. This still happens in few wanted cases, such as the substitution of "PChar" by "char*".
- The definition of constants by other constants is completely made in C++ now by substitution of the values of the constants already defined so that the compiler don't complains any more.
- The namespace feature was completed: the names of namespaces of base classes are inserted and forward declarations are written into the namespace now.
- Faults with global variables in the interface part were eliminated.
- and much more.
11/09/2010 Version 1.3.8
- In the professional version there is a new option now, to create a namespace for each unit. In C++ header files the namespaces are put in front of types from other units and in the C++ implementation files according using clauses are inserted. Identifiers, which are qualified by namespace's are resolved accordingly.
- The Delphi directives $HPPEMIT, $EXTERNALVAR, &NODEFINE and $NOINCLUDE are supported by Delphi2Cpp now.
- With the update 1.3.6. a bug was built into the dialog for the list of the include paths. At multiple use of the dialog the list was copied repeatedly. This fault was fixed.
- More error information is already shown to in the file manager during the processing of the files now.
- If in a case statement a set of more than 1000 elements is defined for a "case", these cases are listed no longer completely at the translation. A note is written instead: "There are too much cases! This section of code has to be converted by hand!". Delphi2Cpp needed much time till now, to write such lists, so that it seemed as if the program stood still.
- Bug fix in the preprozessor: "UNDEF" didn't work for identifiers, which were not already set as defined in the options of Delphi2Cpp. The directives "$I+" and $I-" are ignored now.
10/25/2010 Version 1.3.7
Many improvements of details in the implementation part of units which are often hard to describe. Some important points are:
- Previously only the priority of the "and" and "or" operators over the equality operators were considered. The order in which other operators are executed within expressions in Delphi is now reproduced in the translated C++ code too.
- "not" is converted to '~' now if the type of the following expression is not a boolean.
- The bug was fixed, that functions for the initialization of arrays were not called, if there is no intitialization part in the unit.
- Many other improvements with typecasts, pointers, nested functions etc..
10/03/2010 Version 1.3.6
|
09/13/2010 Version 1.3.5
Because of the size of the expansions and improvements the version number is increased by two digit at once at this update.
|
08/15/2010 Version 1.3.3
|
http://www.texttransformer.com/Videos_en.html
07/25/2010 Version 1.3.2
|
catch(...) { ... // Anweisungen throw; }
07/05/2010 Version 1.3.1
|
if(...) { delete p; p = NULL; }
06/14/2010 Version 1.3.0.1
Fractional digits were treated like digits in front of a decimal point. So a number like 1.002 became 1.2. This bug is fixed now.
05/25/2010 Version 1.3.0
Developing in Delphi, compiling C++:
The translated C++ code can be synchronized now with the code which is further developed in Delphi. The parts of the code which required a post-processing in C++ can already be prepared in Delphi, such that they don't have to be reworked once more at renewed translation. At the preparations of the Delphi code a pre-defined constant can be used, so that by means of a conditional compilation certain code sections are relevant only for the translation into C++ while other sections are visible for the Delphi compiler only. Furthermore complete C++ code sections can already be written into the Delphi code to insert them into the generated output in a way which doesn't disturb the Delphi compiler.
Further innovations in Delphi2Cpp 1.3.0:
|
05/13/2010 Version 1.2.9
-Warnings and error and single steps of the translation are logged in an additional panel now.
-By a more exact treatment of namespaces the quality of the translation was improved further.
05/02/2010 Version 1.2.8
-The order of type definitions gets corrected now. The definitions are written, when defining type is known. At the same time, the recognition of the types at later positions in the code is improved. See in the help the section: "Order of type definitions".
-Message handlers are translated now by means of the VCL_MESSAGE_HANDLER macro.
-goto statements are translated now and the update contains many more other small improvements.
-There is more and more feedback from users, which helps to improve Delphi2Cpp very much. Thanks to all of them!
04/25/2010 Version 1.2.7
Several new translation options have been added:
|
In addition, there are some improvements on the translation quality and some bug fixes again:
|
04/18/2010 Version 1.2.6
Much improved translation results, because
-the interpretation of structure parameters of functions in WinProcs.pas has changed in accordance with the CBuilder VCL
- boolean and bitwise "and" and "or" operators are distinguished
-default parameters in nested functions are taken into account
-and there are many further detail improvements.
-In addition, the access to elements is written now in the usual notation with the pointer operator "a->" instead of the previous notation "(*a).".
-Superfluous set definitions are avoided.
04/07/2010 Version 1.2.5
-The list of identifiers can be saved now, which was created by the preprocessor to unify their notations: The list can be loaded again for another session, so that the notations of the identifiers in the generated C++ output are the same as in the previous files.
-In the professional version of Delphi2Cpp there is now an additional substitution table for the translator similar to the substitution table for the preprocessor.
-The treatment of arrays has been revised. The strategy of indexation has changed (You can find more information to this point in the sections of the help: Static arrays, Open array parameters.)
03/24/2010 Version 1.2.4
-Initialization and finalization of units.
-Initialization of array's.
-Several other small improvements.
03/18/2010 Version 1.2.3
-Many small special improvements of the quality of translation.
03/07/2010 Version 1.2.2
-Nested Delphi functions are broken up into normal member functions now. All needed parameters are passed to these functions.
-Overwritten properties are overwritten in C++ now accordingly.
02/28/2010 Version 1.2.1
-Delphi2CppInstall.exe installs a demo version of Delphi2Cpp now, which can be used without time limit. The demo program makes translations of the same quality as the licensed program. The amount of the output code, however, is restricted to 10000 characters for the implementation part and it isn't possible to load or save code and options. At the purchase of a license of Delphi2Cpp a link is delivered on a version of Delphi2Cpp in which the complete functionality of the program can be used.
-Additional option for precompiled headers.
-Improvement of the translation of pointers to pointers.
-Cosmetic improvements:
a) instead of the unusual notation
(*fo).bar , now: fo->bar
b) instead of the unusual indentation of parenthsis:
if(...) { ... }
now:
if(...) { ... }
02/17/2010 Version 1.2.0
- C++ code can optionally be generated for other compilers than the CBuilder too. For the other compilers Delphi properties are eliminated by corresponding calls of additional Read or Write methods.
- Notations and translations of identifiers can be controlled by an individual translation table now.
- The quality of the translation was increased further, particularly concerning the pointers to arrays, typecasts, __classid and much more.
- The price for Delphi2Cpp was raised once more a little bit, according to the extended abilities of the program.
02/04/2010 Version 1.1.9
- At places where C++ expects constant expressions, the values of constants are written in the translation now instead of the constants themselves.
- For global functions is registered now if the return type is a pointer. This was forgotten till now.
- The change in the last update to translate string parameter "(s : string)" as "(consts string& s)" was undone because this led to conflicts with the CBuilder VCL).
- A fbug was fixed, by which often wrong translation alternatives were selected for special VCL functions.
02/01/2010 Version 1.1.8
- The translation of the implementation part of the pas files is several times faster now than before.
- Sub-functions of nested functions are treated correctly now. The nesting remains furthermore, though.
- Improvements in the treatment of string additions and string parameters.
01/25/2010 Version 1.1.7
- Many with-statements, which were not translated correctly until now, are analyzed and translated correctly now.
- Many more small improvements.
01/17/2010 Version 1.1.6
-Declarations of classes are looked up in the units actually included only now.
-Unit namespaces are marked correctly now with two colons in qualified identifiers. E.g.: Graphics:: ...
-The determination of the list of the constructors of the predecessor classes was improved.
01/06/2010 Version 1.1.5
- Error positions in the window of the Delphi source code were shifted now and then because they referred to the preprocessed code. The preprocessed code is shown on this window after the translation now.
- Comments were reproduced only incompletely from the interface part. This was improved.
- Constants of the interface part were translated as static constants in the C++- headers till now. This could lead to many warning messages of the compiler if the header was included in several files. The constants now are declared externally and in instantiated in the accompanying implementation file with their value now. However, this can result in faults in rarer cases if the values of the constants are already needed in the header.
- Dimensions of arrays in C++ were calculted as differences of the upper and lower limitation of Delphi ranges till now. The upper limit is taken now as dimension, so that it is made sure that index access to the array doesn't exceed the limitation.
- Many other improvements at several translation details.
12/15/2009 Version 1.1.0
- Instances of structures are created as automatic variables and submitted as references to functions in the translated code now. Unlike this, furthermore class instances are manipulated as pointers.
- "array of type"-parameters are interpreted per default as references on dynamic arrays now.
- The notations of the TObject elements are provided in the preprocessor now. So the elements are recognized in any case.
- Global functions and procedures are recognized now.
- "String" is now correctly translated to "String", not to "AnsiString".
- In consideration of another month of work, that was done to improve the translation quality, the price of Delphi2Cpp was increased. In the trial version the translation is cut off after 10000 characters now.
12/14/2009 Version 1.0.9
- The overwritten constructors of a class are supplemented with the complete list of the not overwritten constructors automatically now.
- A function is now translated correctly too, if the function name itself is used instead of the predefined variable "Result".
- In calls like "foo(['hello', 'world'])" Delphi2Cpp decides now by the expected type of the parameter, whether a set or an array of const is passed.
- A lot of other small compltements and improvements.
12/08/2009 Version 1.0.8
- the recognition of variable types in with-statements was improved.
- friend class declarations were added to classes with ancestors only. Now they are declared for all classes inside of a unit.
12/04/2009 Version 1.0.7
- The bug was fixed, that the parser didn't recognize the names of especially treated VCL fiunction following on "inherited", e.g. "inherited delete".
- Numbers beginning with '0', like '0943' were written unchanged into the output. But C++ regards them as octal numbers. Noe the leading '0' characters are removed.
- The bug was fixed, that the exponent was separated by a blank in exponetial numbers.
- Special parameter declarations were improved:
const Args: array of const -> const TVarRec * Args, const int Args_Size
const Value -> const int Value
12/03/2009 Version 1.0.6
- If no ancestor type is specified when declaring a new object class, Delphi automatically uses TObject as the ancestor. In C++ this is made explicit now.
- At positions, where resource strings are used, they are now substituted be the according macro, which loads the string.
- A bug was fixed, which sometimes prevented the recognition of types in the current scope.
12/02/2009 Version 1.0.5
- Constructors wihtout parameters aren't inserted any more.
- Calls of constructors without parameters of the base class inside of the constructor of a derived class are commented out, e.g.
// inherited::Create;
- the type information of overwriteen properties is evaluated now.
- If the size of an array is specified by an enumerated type, the size is evaluated from the smallest and greatest value of the type.
12/01/2009 Version 1.0.4
- Improvement: forward declarations of VCL classes were not used for the evaluation of pointer types
- Missing constructors in derived classes are inserted automatically, e.g.
inline __fastcall virtual TDerivedComponent(TComponent* Owner) : inherited(Owner) { }
11/29/2009 Version 1.0.3
- Treatment of sets has been improved further.
E.g. type TIntSet = set of 1..250; -> typedef System::Set < int/* range 1..250*/, 1, 250 > TIntSet;
- Variables are m as extern now in the C++ headers and their instances are included into the implementation cpp-files.
11/26/2009 Version 1.0.2
- doubled pseudo forward declaration like "class classname{}" is not generated any more
- Improvement of assignements of sets.
var MySet: set of 'a'..'z'; begin MySet := ['a','b','c']; ->
typedef System::Set < char, 97, 122 > test__0;
#define test__1 ( test__0 ()
<< char ( 97 ) << char ( 98 ) << char ( 99 ) )
System::Set < char, 97, 122 > MySet;
MySet = test__1;
11/25/2009 version 1.0.1
- the preprocessor executes include directives now
- un/defines in not defined regions aren't executed any longer
11/17/2009 version 1.0.0 published, price for early buers 58,- €
Deutsch
Latest News |
08/26/24
Delphi2Cpp 2.4: Updated to RAD Studio 12.1 Athens [more...] |
01/29/24
Aurora2Cpp: Delphi 7 translator [more...] |
"Thanks for your great work, really appreciate the work you have done on zlib and compiling ... test case." Mattewada, Udayabhaskar
Nokia India
02/01/2021
|
[from case study...] "A masterpiece -- Delphi2Cpp has exceeded all my expectations by far." Tony Hürlimann
virtual-optima
08/20/2011
|
"First off, I have to say WOW! Delphi2Cpp is doing a *fantastic* job!" Daniel Flower
linkrealms
01/15/2011
|
This website is generated from plain text with [Minimal Website ]
|
Minimal Website
is made with TextTransformer
|
TextTransformer is made with Borland
CBuilder
|