texttransformer.jpg

This article can be obsolete: Actual documentation online

Order of type definitions


In Delphi types can be defined by other types, which aren't defined yet. In C++ a type only can be defined by another type, which is already defined. So the order of the Delphi type definitions has to be rearranged sometimes.


The following example is taken from the file "ShellApi.pas":


  PSHFileOpStructA = ^TSHFileOpStructA;
  PSHFileOpStructW = ^TSHFileOpStructW;
  PSHFileOpStruct = PSHFileOpStructA;
  {$EXTERNALSYM _SHFILEOPSTRUCTA}
  _SHFILEOPSTRUCTA = packed record
    Wnd: HWND;
    wFunc: UINT;
    pFrom: PAnsiChar;
    pTo: PAnsiChar;
    fFlags: FILEOP_FLAGS;
    fAnyOperationsAborted: BOOL;
    hNameMappings: Pointer;
    lpszProgressTitle: PAnsiChar; { only used if FOF_SIMPLEPROGRESS }
  end;
  {$EXTERNALSYM _SHFILEOPSTRUCTW}
  _SHFILEOPSTRUCTW = packed record
    Wnd: HWND;
    wFunc: UINT;
    pFrom: PWideChar;
    pTo: PWideChar;
    fFlags: FILEOP_FLAGS;
    fAnyOperationsAborted: BOOL;
    hNameMappings: Pointer;
    lpszProgressTitle: PWideChar; { only used if FOF_SIMPLEPROGRESS }
  end;
  {$EXTERNALSYM _SHFILEOPSTRUCT}
  _SHFILEOPSTRUCT = _SHFILEOPSTRUCTA;
  TSHFileOpStructA = _SHFILEOPSTRUCTA;
  TSHFileOpStructW = _SHFILEOPSTRUCTW;
  TSHFileOpStruct = TSHFileOpStructA;
  {$EXTERNALSYM SHFILEOPSTRUCTA}
  SHFILEOPSTRUCTA = _SHFILEOPSTRUCTA;
  {$EXTERNALSYM SHFILEOPSTRUCTW}
  SHFILEOPSTRUCTW = _SHFILEOPSTRUCTW;
  {$EXTERNALSYM SHFILEOPSTRUCT}
  SHFILEOPSTRUCT = SHFILEOPSTRUCTA;

This is translated to:


/*# waiting for definiens
typedef TSHFileOpStructA *PSHFileOpStructA;
*/ /*# waiting for definiens
typedef TSHFileOpStructW *PSHFileOpStructW;
*/ /*# waiting for definiens
typedef PSHFileOpStructA PSHFileOpStruct;
*/

/*$EXTERNALSYM _SHFILEOPSTRUCTA*/


#pragma pack(push, 1)
struct _SHFILEOPSTRUCTA {
  HWND Wnd;
  UINT wFunc;
  PAnsiChar pFrom;
  PAnsiChar pTo;
  FILEOP_FLAGS fFlags;
  BOOL fAnyOperationsAborted;
  void* hNameMappings;
  PAnsiChar lpszProgressTitle; /* only used if FOF_SIMPLEPROGRESS */
};

#pragma pack(pop);
  /*$EXTERNALSYM _SHFILEOPSTRUCTW*/

 #pragma pack(push, 1)
struct _SHFILEOPSTRUCTW {
  HWND Wnd;
  UINT wFunc;
  PWideChar pFrom;
  PWideChar pTo;
  FILEOP_FLAGS fFlags;
  BOOL fAnyOperationsAborted;
  void* hNameMappings;
  PWideChar lpszProgressTitle; /* only used if FOF_SIMPLEPROGRESS */
};

#pragma pack(pop);

/*$EXTERNALSYM _SHFILEOPSTRUCT*/


typedef _SHFILEOPSTRUCTA _SHFILEOPSTRUCT;
typedef TSHFileOpStructA *PSHFileOpStructA;
typedef PSHFileOpStructA PSHFileOpStruct;
typedef _SHFILEOPSTRUCTA TSHFileOpStructA;
typedef TSHFileOpStructW *PSHFileOpStructW;
typedef _SHFILEOPSTRUCTW TSHFileOpStructW;
typedef TSHFileOpStructA TSHFileOpStruct;
  /*$EXTERNALSYM SHFILEOPSTRUCTA*/
typedef _SHFILEOPSTRUCTA SHFILEOPSTRUCTA;
  /*$EXTERNALSYM SHFILEOPSTRUCTW*/
typedef _SHFILEOPSTRUCTW SHFILEOPSTRUCTW;
  /*$EXTERNALSYM SHFILEOPSTRUCT*/
typedef SHFILEOPSTRUCTA SHFILEOPSTRUCT;

   deutsch Deutsch

 

 
Latest News
10/28/24
Delphi2Cpp 2.5: Symbol names matching declaration case [more...]

08/26/24
Delphi2Cpp 2.4: Updated to RAD Studio 12.1 Athens [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