texttransformer.jpg

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

  • Recursive search for required units during translation
  • Optional generation of dummy code
  • Exclusion of certain files from translation
  • Use of a "cover" file for unknown types
  • Identifiers can be replaced by complex expressions

02/07/2022
Delphi2Cpp 2.1
  • Delphi inline variables and constants become to C++ local variables and constants
  • Large ranges in case statements are shifted to the default section of a switch-statement now
  • Check of loop variable types, to prevent infinite loops
  • There is a new option to normalize namespace as C++Builder does
  • Simplified manipulation of initialization/finalization order of units
  • For C++Builder there is the new helper function DynamicArrayPointer to pass dynamic arrays
  • Initialization Finalization and Assign operators in records are parsed and output, but not automatically called in C++
  • The "Comp" type, which only exists for backwards compatibility, has been removed to avoid confusion with commonly used variables of that name
  • The code translated to C++ with Delphi2Cpp is now updated and hosted on GitHub
  • The video of the German presentation at CodeRage 2021 has now been uploaded to YouTube in three slightly expanded parts in English

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;
                                           }                  

  • The macros "DECLARE_DYNAMIC" and "IMPLEMENT_DYNAMIC" can be renamed by means of the substitution table of the translator now. An obvious alternative would be to use the macros "DECLARE_DYNCREATE" and "IMPLEMENT_DYNCREATE" also defined in the Microsoft Foundation Classes (MFC).
  • The calculation of the list of the constructors of the base classes, which can be accessed also in the derived class, was improved. Previously also equally named overwritten constructors were added to the list. From now on, this only happens if the extended RTTI abilities are enabled, to use the TD2CObjects or the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC marcros. Both need the basic standard constructors.
  • The names of originally used constructors are inserted as comments into the translated code now, if the "Verbose" option is enabled and the name is not "Create". This makes it easy to make manually corrections, if there are differently named Delphi constructors with the same signature.
  • The adaptation at the passing of variables to Windows API functions was improved. If a function is declared as EXTERNALSYM, the translator uses it only when there isn't any alternative declaration. An example of first case would be "PeekMessage" and an example of second case would be "PtInRect". All files of the folder "CodeGear\RAD Studio\6.0\source\Win32\rtl\win" are interpreted as C-like now.


01/05/2011 Version 1.6.2

  • There is a simplified treatment of resource strings in Delphi2Cpp now. In C++, the use of resource strings isn't as simple as in Delphi. In C++, at first resource files with string lists must be created from where the strings then can be loaded at runtime. Delphi2Cpp offers a workaround solution now which usually makes translated programs run also without resource file and which can be enlarged by real resource files in a simple way.
  • Parameter lists are found out correctly for nested functions now if forward declarations are needed there.
  • The support for UnicodeStrings was improved. UnicodeStrings are treated correctly in the source code now although Delphi2Cpp is restricted to the language standard of Delphi 7 essentially. In addition the distinction between WideString and UnicodeString in the options, which had had been formal only till now, now it has real consequences for the translation, e.g. the "c_bstr" method isn't called for UnicodeStrings any more.
  • Reference variables for structures which are inserted temporarily as results of with expressions are modified by "consts" now if there is a reading access to them only. So, occasional error messages of the compiler are avoided, that an L value of the corresponding type is required.
  • Since for C++Builder types of base classes, properties and field with "published" visibility may not be qualified by namespaces in according cases using clauses are written now at the beginning of the header files.
  • For this update large quantities of Delphi source code has been translated. Many further detail improvements are derived from these experiments.


10/31/2011 Version 1.6.0

  • The user interface is based on unicode now so that special characters in comments of foreign languages in UTF8 encoded Delphi files are shown correctly now. Further other flaws of the user interface were removed. E.g. you can search on the log page expressions in the log tree now too. At the translation from files Delphi2Cpp doesn't push itself to the foreground any more so that other work can be done in addition on the same computer.
  • There also are some other small improvements: when copying comments, no mixed line endings from single "line feed" characters and combinations with it and the "carriage return" character can result any more. Comments after variable declarations aren't inserted before the initialization any more and more.


10/10/2011 Version 1.5.2

  • The result of the breakup of nested functions was optimized. All parameters, variables and constants were passed from the primary function to the subordinate functions till now. This is only carried out for the quantities actually required from Delphi2Cpp 1.5.2 on. It is taken into account that at multiple nesting possible parameters which aren't needed in a function itself but in a function subordinated to it are passed through. The "result" variable for the return value of the topmost function is submitted to subordinate functions under the name "xResult" and therefore is distinguished from the "result" variables there.
  • Files beginning with an UTF8 Byte Order Mark (BOM) are converted to ANSI now, before they are processed. (All files are saved as ANSI files.)


09/26/2011 Version 1.5.1

  • System unit and Sysutils unit are pretranslated for Linux now too.
  • At the translation of "for"-loops the number of lopps is calculated only once now before the beginning of the first run.
  • The bug in the commandline mode was fixed, that the overwritten System.pas was not found.
  • There isn' taplus operator to add a wchar_t to a WideString. Such additions are made by means of a string now, which are created temporarily from the character.
  • With the key word "absolute" a variable can be declared in Delphi that resides at the same address as an existing variable. This behavior is reproduced in C++ now by declaring the new variable as a reference to the existing variable. If necessary according typecast's are inserted.
  • The real example "ATBinHex" was translated with Delphi2Cpp 1.5.1 now. The number of required manual corrections is reduced further.


08/22/2011 Version 1.5.0

  • Delphi2Cpp includes an almost complete translation of the system unit and the Sysutils unit of Delphi to C++ now. Particularly the Sysem unit is basically in Delphi, because it is included implicitly in all other units. It balks at an automatic translation because many intrinsic functions belong to it, which are installed directly into the Delphi compiler and aren't definded in "System.pas" at all or only cryptically. The unit Sysutils is also basic since it is included by most of other Delphi units. While the C++ Builder is partly providing the functionality of these two units in a C++ adaption of the Delphi RTL/VCL, the prefabricated C++ translations make the translation of the Delphi code of one's own easier for other compilers enormously. Also for C++ Builder the parts of the System unit are completed now, which are missing in the Delphi RTL/VCL adaption of the manufacturer of C++ Builder.
  • In the course of the systematization accompanied with the translation of the whole System unit the existing files "d2c_file.h/.cpp" were renamed to "d2c_sysfile.h/.cpp".
  • There is a C++ counterpart for "array of const" parameters for other compilers than the C++ Builder now. With C++Builder a macro is used to initialize an OpenArray class with the elements of the "array of const" and which constructs a second parameter for the number of elements at the same time. There is a similar OpenArray class, now for other compilers, which is based on a std::vector. Since this class has the size method an additional parameter isn't necessary.
  • A character c cannot be converted directly into a standard string in Visual C++. This is required for example at an assignment of a chain of strings to the string S:S= c + S. Therefore the conversion is made by the constructor "basic_string (size_type n, chartT c, ...)" now, that is: S = String(1, c) + S. This works for the standard strings of all compilers.
  • At the comparisons of standard strings with a character the latter is converted into a string in the way just mentioned. E.g. "if S == c then" becomes: if " (S == string (1, c)) ".
  • Delphi set's are translated now as Daniel Flower's TSet automatically for other compilers than the C++ Builder, instead of using "System::Set". TSet is defined in the file DelphiSets.h.
  • At the execution of Delphi2Cpp in the command line mode the error messages and warnings which are produced at the processing of single files are output now, too.
  • The treatment of namespaces was changed slightly: if an extended "System.pas" is set, the namespace for it is "d2c_system" per default, notwithstanding of the actual file name. This expression can be changed in an additional field of the options dialog now. If no extended "System.pas" is set, the system namespace is "System" per default and it can be changed in the same way.
  • Also the table of the substitutions of the translator can be used now, to change the namespace for a file. So it is possible, to create the same namespace for the contents of different files.
  • The namespace option is no longer mandatorily required for the use of an overwritten "System.pas" for the C++ Builder. Notwithstanding whether this option is activated or not, the namespacs - normally: d2c_system - is preceeded to the type "file", to the distinct it from the definition as void* in the Borland "System.pas".
  • The fault was eliminated, that the address operator was executed again if in Delphi the address of a variable is passed to a function and the variable as a var parameter is already an address in C++.
  • This update was made in cooperation with a customer who has written a case study about his project. Many thanks to Tony.



06/21/2011 Version 1.4.9


  • The type names "Char" and "PChar" aren't translated according to the options for the string translation into "char" and "char*" or into "wchar_t" and "wchar_t*" any more, but "Char" is left non-translated and "PChar" is translated to "Char*". The name "String" also isn't changed at the translation. So the generated C++ code can be switched from Ansi strings to Wide strings more easily with the help of corresponding definitions of "Char" as "typedef char Char;" or "typedef wchar_t Char;" and corresponding definition of "String".
  • If the option "string as WideString" is selected, "Char" and "PChar" are translated correspondingly as "wchar_t" and "wchar_t* now, analogously to Delphi2009.
  • High( X ) and Low( X ) are translated now by template functions High< X >() or Low< X >(), if X is a type identifier. These functions are evaluated at compile time already and they are portable. Registrated users find the definitions of "High" and "Low" in "d2c_system.pas".
  • The function "Pos" isn't translated by "find" for standard strings any more. A "Pos" function must be called also in C++ instead. Mostly with "find" and addition of the value 1 to the result the same results could be achieved as with "Pos", but in the case that no sub-string is found, with string::npos a type is returned, which doesn't yield the value -1 on all systems in the comparison with integers.
  • The SmallString class was extended and is based now on a character array, which is terninated with null.
  • The signature of functions, which expect a string by value, isn't changed any more. Before, Delphi2Cpp had changed the code to pass a constant reference of the string instead. This is more efficient in C++, since it avoids copying the character array, but a manual post-processing of the code was necessary, if the string is changed within the function body.
  • The bug was fixed that generated C++Builder project files for console applications got the extension "bpk" instead of "bpr".
  • Announcement: the next update will deliver a C++ translation of the files "System.pas" and "Sysutils.pas". The prize for Delphi2Cpp will be raised considerably again with the version 1.5.0.



05/31/2011 Version 1.4.8

  • Delphi method pointers which make the event treatment by delegation possible are reproduced also for other compilers than the C++ Builder now. There is the language expansion for it in the C++ Builder with the "__closure" keyword.
  • There is a SmallString class for Visual C++ and other compilers now.
  • The Delphi directives $HPPEMIT, $EXTERNALVAR, $NODEFINE and $NOINCLUDE are supported now completely. This make the translation of the VCL possible.
  • The unification of the case-notations of identifiers is expanded on the contents of comments now. So, the symbols are assigned correctly in the directives mentioned above. This expansion can have effects on pretranslated C++ code. The identifiers used there have to be be included in the substitution list from now on.
  • Constants aren't treated any more as variables to be declared externally.
  • The bug was fixed, that the identifiers of namespaces were missing for the first parameters in nested functions and for base classes of objects.


05/08/2011 Version 1.4.7

  • Complete Delphi projects can be converted to C++Builder projects now with Delphi2Cpp at once, provided that the Delphi dpr-file is in the root folder of unambiguously named source files of the project. In detail: 1. the files belonging to the project are looked up recursively in the subdirectories, 2. the according paths are taken into the project options, 3. the files are translated, 4. a Delphi2Cpp management is produced, 5. a C++-Builder project file is created (second, third and 4th point only with the professional edition).
  • You can see this new feature in a video, which presents the conversion of a Delphi project of the game "Tetris" to C++ : http://www.texttransformer.com/D2C_Videos_en.html
  • The paths for the files not to be translated (VCL) and the paths for the files to be translated are set separately in the project options now.
  • Selected project options can be marked now as default options which are loaded automatically at the restart.
  • The routines Read(Ln)/Write(Ln), which accept an arbitrary number of parameters in Delphi are taken to pieces by Delphi2Cpp now. In each call of these functions only one I/O parameter is passed.
  • The special formatting instructions for Write(Ln) and Str procedures marked by colons, are reproduced with usual parameters separated by commas in the separated calls now.
  • For the reproduction of the Delphi I/O routines which don't can be transferred to C++ analogously, there is prefabricated C++ code now. It defines: TTextRec, typed and untyped TFileRec and the functions: IOResult, FileSize, Flush, AssignFile, Seek, SeekEof, SeekEoLn, Erase, Rename, Eof, EoLn, SetTextBuf, Truncate, Close, CloseFile, Rewrite, Reset, BlockWrite, BlockRead, Write, WriteLn, Read und ReadLn.
  • Missing return values and parameters of routines in the implementation part are completed by the values from the corresponding declarations now automatically.
  • Records with methods are accepted and translated by Delphi2Cpp now. This is a first step beyond Delphi 7.


04/11/2011 Version 1.4.5

  • The Meta capabilities of Delphi which are partly reproduced by the C++ expansions of the C++ Builder, which however are not available for other compilers, can be simulated now with a TObject class, which was developed especially for Delphi2Cpp. class methods, such as "ClassName" and "InheritsFrom", are available with that. There is even the possibility of producing objects of the respectively required type now with a virtual "Create" method. Also for the C++ Builder there is this possibility now: Delphi2Cpp can provide that a class which originally is derived from TObject of the C++ Builder VCL, is derived from a class TD2CObjekt in the translated code instead. TD2CObjekt has this "Create" method. (The TObject/TD2CObject classe are delivered with the professional version of Delphi2Cpp only.)
  • class methods were translated as simple static methods till now. In C++ no counterpart of Delphi's "Self" exists then. From now on class methods get an additional parameter, which is a pointer to the type of the calling object and functions as "Self" with that.
  • Virtual class methods also can be translated now. Though static methods of C++ cannot be virtual, the additional parameters allows the redirection to a virtual method, which is inserted by Delphi2Cpp now in addition to the static method.
  • The "is" operator is translated now like: Obj->ClassNameIs( targetClass->ClassName() ), if a VCL class is tested for a Meta-class.
  • The integration of the overwritten "System.pas" was improved. At a definition like "THandle = System.THandle" the type is looked up in the own sytem file now at first.
  • Comparisons of a string with the empty string are replaced in the translation by the method calls "IsEmpty" or "empty" now. The efficiency is increased for std::strings and for VCL strings ambiguities are avoided.
  • The translation of abstract methods was changed. Because objects with abstract methods can be created in Delphi, but not in C++, these methods aren't translated as abstract in C++ any mor, but such, that they throw a exceptions, if called.
  • Because this update is very essential, a version jump from 1.4.3 to 1.4.5 is justified.


03/14/2011 Version 1.4.3
  • Inline assembler is processed now in the professional version of Delphi2Cpp: Delphi comments are converted to C++ comments, Delphi expressions used inside of the assembler code are analysed and converted and identifiers can be substituted by other identifiers. Local labels are converted to global labels for other compilers than C++Builder. These actions often suffice to get operating code. However, assembler expert knowledge is needed in individual cases.
  • In nested functions the "result" value of the primary function is passed through subordinate functions to subordinate procedures now. Local type definitions within the primary function are moved in the C++ code to positions which permits the use of the parameters of these types also in the subordinate functions.
  • The translation table of the translator also is applied to the names of helping variables now which are needed for the definition of implicitly defined types. So a adjustment of the according names in the C++ Builder VCL is possible, which can be different there from version to version. Also the set type "System::Set" can be renamed this way now, e.g. for a comfortable integration of Daniel Flower TSet.
  • Comments, which were wrongly placed inside of a statement are written behind the statement now.
  • Faults at structures implicitly defined within a variable definition were eliminated. The type of the elements wasn't recognized.

02/21/2011 Version 1.4.2

  • When assigning a void pointer to another type, the void pointer automatically is casted to the other type now.
  • An according cast takes place, if a pointer to another type is expected as parameter in a function call.
  • When closing the file manager a file named "pch.inc" is produced now automatically. It includes the list of all found included header files. This list can be used for the precompiled header or the "stdafx.h" file of Visual C++.
  • There is now the option (professional version only) to suppress the output of include directives into the generated C++'s files. This can make sense if the "pch.inc" mentioned above is used instead.
  • There is a simple possibility now of configuring Delphi2Cpp for individual users. To this end there is an additional page in the dialog of user options.
  • There are a lot of bug fixes concerning primarily multidimensional array's and the use of the code with Visual C++.

A customer of Delphi2Cpp has contributed a "high-performance template class that emulates Delphi sets". Features:

  • Binary compatibility with Delphi's sets.
  • All Delphi and most CBuilder operators and features.
  • Supports unlimited elements (vs Delphi's limit of 256).
  • Highly optimized (supports enhanced CPU instruction sets).
  • Configurable element datatype, thus 8/16/32/64bit portability.

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

  • There is an additional dialog for user settings now. There you can set, whether screen positions shall be restored at the restart of Delphi2Cpp.
  • "System.pas" will always be parsed in addition to the other included files. This procedure provides much more signatures of functions and class and record definitions as before, where only parts of this file were simulated. If "system.pas" cannot be found the program works as before.
  • If an instance identifier for the form associated with a unit is specified in a program file, like in "Demo in 'Demo.pas' {DemoForm}", this is translated now in accordance with the CBuilder convention as "USEFORM("Demo.cpp", DemoForm);".
  • In dependence from the compiler directive "$APPTYPE" the "main" function of a program file is translated as a "WinMain" function for GUI applications and a "main" function for console applications now.
  • Members at the beginning of a class declaration that don’t have a specified visibility for are made by default "__published" for CBuilder and "public" for other compilers now, if the class is derived from "TPersistent".
  • Variables of simple types get initialized now.
  • The higher priority of "and" and "or" operators over the equality operators in Delphi is guaranteed in C++ by according parenthesis now.
  • A string S isn't passed to parameters of the type "var x" and "x : pointer" as "S.c_str()", but as "&S".
  • At a division with '/' the numerator is casted to a double, if it isn't already.
  • The bug was fixed, that accidental value were set for constants with negative values.
  • The bug was fixed, that an exception block "catch (...) {}" was added at the translation of "try/except on E do handle_exeption".
  • Other small bug fixes.



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.

  • With the professional version of the Delphi2Cpp of this update it is possibly at first to preprocess all source files and then to optimize the translation of the preprocessed sources without need to preprocess the code every time once more.
  • The options for other compilers were extended so that from now on also special code variants can be produced for Visual C++ and gcc.
  • A bug at the translation of "program" "library" and "package" files was fixed.
  • Interface types are treated as pointers now.
  • The "file" type and the "text" type are translated as "void*" now.
  • The oreder of declarations has been reworked.
  • Bugs with variable names in nested functions were fixed.
  • Many other small bug fixes.


08/15/2010 Version 1.3.3

  • When a source code was translated a second time, it could happen that types wern't translated correctly any more. Instead the verbose output produced "/*# waiting for definiens ...". Now types defined in other interfaces than of the current source remain marked as defined, so the error will not appear again.
  • PChar, PAnsiChar and PWideChar are converted into the pointers on the corresponding character types now.
  • If the type y is an array, the type of x in "var x : ^y;" is now evaluated as a pointer to an element of y. Otherwise the code is translated as "y* x;"
  • The support for std::string and std::vector was improved for the case that the special treatment of VCL functions is enabled. In addition, the index is corrected now at the access of single characters of the 0 based standard strings.
  • For other compilers as the CBuilder the access to default properties is carried out in the C++ code via the generated access methods just, as in the case of other properties now.
  • Comments after the final dot at the end of a unit aren't ignored any more
  • The missing linebreak is inserted now in cases like: TFormXXX* FormXXX;#pragma resource "*.dfm"
  • There is now a video, which demonstrates how Delphi2Cpp uses typeinformations internally:
http://www.texttransformer.com/Videos_en.html


07/25/2010 Version 1.3.2

  • Small included units triggered a user abort. This bug was fixed.
  • A line comment without a following line break at the end of a file caused an error. This bug was fixed.
  • The choice not to include any precompiled header can be saved in the options file now.
  • The resulting type of the "assigned" function is bool now too, if the option for the special translation from VCL functions turned off. Therefore "and" or "or" translates to "&&" or "||" between calls of "assigned".
  • With C-Like option on "TRec = record ... end;" is now translated to "typedef struct {...} TRec;" instead of "struct TRec {...};" for C++.
  • "finally" is now translated for other compilers than CBuilder as:

      catch(...) 
      { 
        ... // Anweisungen
        throw; 
      }


07/05/2010 Version 1.3.1
  • Read properties are translated for other compilers than CBuilder by const functions only if member variables are returned and not for the call of functions any more.
  • Delphi2Cpp interprets @Me.Parameter as @(Me.Parameter) now instead of (@Me).Parameter before.
  • A bug of the preprocessor was fixed, which occurred if {$IFDEF Cpp} was used several time in the same file.
  • The resulting type of an expression like "not expr" is always evaluated as "bool" now, so that the logical binary operator is chosen now for the translation of "or" or "and" connections of such expressions.
  • In cases like "if(...) FreeAndNil(p)" additional brackets are inserted. Now the result is:

      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:

  • The Windows conformity of the installation and user interface are improved.
  • The access to Arrays remains correct now, despite of the transformation of Delphi-arrays to 0 based C++ arrays. The value of the lower bound (Low) which the array in Delphi had is subtracted from the value of the index now. The functions "Low" and "High" yield the same values now in C++ which result in Delphi. The macro "HIGH" was renamed to "MAXIDX".
  • In the professional version of Delphi2Cpp there is now the option to insert the macros "DECLARE_DYNAMIC" and "IMPLEMENT_DYNAMIC" automatically, which are known from the Microsoft Foundation Classes (MFC) to obtain runtime information for classes.
  • As a real example of a translation from Delphi source code into C++, the excellent ATBinHex component of Alexey Torgashin was translated.
  • The price for Delphi2Cpp was raised once more, according to the extended abilities of the program.

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:

  1. The special treatment of some VCL functions can now be switched off so that you can write your own translations for them.
  2. The creation of comments on the translation can be switched off. In addition these comments start now with "/*#", so that they can easily be distinguished from other comments.
  3. Delphi strings can alternatively be translated in standard strings now.
  4. It can be chosen whether "String" is interpreted as "AnsiString" or "WideString".
  5. For the functions for the substitution of the properties the prefixes can be defined freely.
  6. In the professional version there is the possibility now to force a C-like output.

In addition, there are some improvements on the translation quality and some bug fixes again:

  1. The wrong special treatment of the Insert procedure was corrected.
  2. Initializations of local arrays which were partly missing are created now.
  3. "FreeAndNil" will be replaced by "delete" now.
  4. Errors of parsing newer versions of the VCL were eliminated. "SyncObjs.pas" is excluded from parsing.
  5. Further improvements.


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 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
Minimal Website is made with TextTransformer

TextTransformer
TextTransformer is made with Borland CBuilder

  borland