Create dummy code

Top  Previous  Next

User interface > Translation options > Output options > Create dummy code

A frame of an application only will be created, if the checkbox to create dummy routines is activated in the output options dialog. To create a frame only might be useful if the application uses code that can not or shall not be translated, e.g. if only the working code of a GUI application shall be converted. Such a frame application can be relatively easily made to compile and link. Once there is a running frame application, it can then be expanded piece by piece into a working application.

 

 

In such a frame:

 

 

1. function bodies aren't written, default values are returned. Example:

 

String Translate(String AText)

{

  return L"";

}

 

 

2. unknown types are output as TObject-type. Example:

 

If the application uses third party code, which is not used for the translation, the types defined in that code, e.g. a type named "TThirdPartyType" cannot be found. It will be replaced by "TObject" then:

 

       virtual void foo(/*#TThirdPartyType*/ System::TObject* AThirdParty);

 

 

If the files to the VCL are in the folder for files, which shall be used for the translation, but shall not be translated themselves, the VCL types will be found and written into the output. e.g.

 

       virtual void SetPicture(Vcl::Graphics::TBitmap* const APicture) = 0;

 

As there is no C++ counterpart of the VCL the VCL types aren't defined there. In this case the code can be made compile, by creation of a file, which defines these types. It could look like:

 

 

#ifndef MissingTypesH

#define MissingTypesH

 

#include "System.h"

#include "d2c_system.h"

 

//namespace System {

//        namespace Classes

//        {

//                typedef System::TObject TStream;

//        }

//}

 

namespace Vcl {

       

       namespace Stdctrls {

               typedef System::TObject TCheckBox;

               typedef System::TObject TComboBox;

       } // Stdctrls

 

       namespace Graphics {

               typedef int TColor;

               typedef System::TObject TBitmap;

       } // Graphics

       

} // Vcl        

 

 

#endif // MissingTypesH

 

 

 

3. using directives of unknown units or of units not to translate are commented out. Example:

 

//# #include "Vcl.Controls.h"

//# #include "System.Classes.h"

//# #include "Winapi.Windows.h"

//# #include "Vcl.Graphics.h"

//# #include "Winapi.Messages.h"

//# #include "System.Contnrs.h"

 

 

In addition to the two cases above there is a third case which consists in the code of the RTL. Most parts of the RTL are converted to C++. If this code shall not be used for the dummy application, the missing types can be defined as the types of the VCL. If the code shall be used the according commenting out must be undone for the lines in question

 

//# #include "Vcl.Controls.h"

#include "System.Classes.h"

//# #include "Winapi.Windows.h"

//# #include "Vcl.Graphics.h"

//# #include "Winapi.Messages.h"

//# #include "System.Contnrs.h"

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content