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:

 

public static string Translate(string AText)

{

       return string.Empty;

}

 

 

2. unknown types are output as object-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:

 

       private void foo(/*#TThirdPartyType*/ object 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.

 

       private void SetPicture(TBitmap Value);

 

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 the types and properties that are needed. It could look like:

 

 

public class TComboBox

{

public TStrings Items { get; internal set; }

public int ItemIndex { get; internal set; }

public string Text { get; internal set; }

}

public class TCheckBox

{

public bool Checked { get; internal set;

}

public class Mouse

{

public TPoint CursorPos { get; internal set; }

}

public class Brush

{

public uint Color { get; set; }

}

 

 

 

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

 

//# using System.Generics.Collections;

//# using System.SysUtils;

//# using Vcl.StdCtrls;

//# using static System.Generics.Collections.CollectionsInterface;

//# using static System.SysUtils.SysUtilsInterface;

//# using static Vcl.StdCtrls.StdCtrlsInterface;

//# using static superobject.superobjectInterface;

//# using superobject;

using System;

using static System.SystemInterface

 

 

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

 

//# using System.Generics.Collections;

using System.SysUtils;

//# using Vcl.StdCtrls;

//# using static System.Generics.Collections.CollectionsInterface;

using static System.SysUtils.SysUtilsInterface;

//# using static Vcl.StdCtrls.StdCtrlsInterface;

//# using static superobject.superobjectInterface;

//# using superobject;

using System;

using static System.SystemInterface

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content