国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

如何將C/C++程序轉(zhuǎn)譯成Delphi(二)

2019-11-18 18:50:30
字體:
供稿:網(wǎng)友
. Anatomy of a C Header


Back to contents

## to do

2. Conversion Basics

2.1. Naming

The naming in converted header files should follow Borland's style as far as possible. This means, keep the original names, but make them more Delphi-like.

How should the C names be translated into Delphi?

The C-PRogrammer usually uses upper case letters for type identifiers, e.g. MY_TYPE. In Delphi, a type identifier has a T-prefix followed by the name of the type in mixed (proper) case. Underscores are not used. The Delphi-like translation of the C type identifier MY_TYPE is TMyType.

In C older header files the pointer-type is named LPMY_TYPE. In translation to Delphi it should be PMyType to conform with Borland's style.

Constants are usually named identically to the original name, including upper case letters and underscores.

A few examples:

CDelphi-Translation


typedef struct _IMAGE_FILE_HEADER {
  Word Machine;
  WORD NumberOfSections;
  DWORD TimeDateStamp;
  DWORD PointerToSymbolTable;
  DWORD NumberOfSymbols;
  WORD SizeOfOptionalHeader;
  WORD Characteristics;
} IMAGE_FILE_HEADER,
*PIMAGE_FILE_HEADER;
type
  PImageFileHeader = ^TImageFileHeader;
  TImageFileHeader = packed record
    Machine: Word;
    NumberOfSections: Word;
    TimeDateStamp: DWORD;
    PointerToSymbolTable: DWORD;
    NumberOfSymbols: DWORD;
    SizeOfOptionalHeader: Word;
    Characteristics: Word;
  end;




#define LANG_NEUTRAL 0x00
#define LANG_AFRIKAANS 0x36
#define LANG_ALBANIAN 0x1C

#define LANG_ARABIC 0x01
#define LANG_BASQUE 0x2D
#define LANG_BELARUSIAN 0x23
#define LANG_BULGARIAN 0x02
#define LANG_CATALAN 0x03
#define LANG_CHINESE 0x04
CONST
  LANG_NEUTRAL = $00;
  LANG_AFRIKAANS = $36;
  LANG_ALBANIAN = $1C;
  LANG_ARABIC = $01;
  LANG_BASQUE = $2D;
  LANG_BELARUSIAN = $23;
  LANG_BULGARIAN = $02;
  LANG_CATALAN = $03;
  LANG_CHINESE = $04;

上一篇:如何將C/C++程序轉(zhuǎn)譯成Delphi(三)

下一篇:如何將C/C++程序轉(zhuǎn)譯成Delphi

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
學(xué)習(xí)交流
熱門圖片

新聞熱點(diǎn)

疑難解答

圖片精選

網(wǎng)友關(guān)注

主站蜘蛛池模板: 巩留县| 望奎县| 秦安县| 文成县| 蓝田县| 宜宾县| 沐川县| 沙河市| 泽州县| 香港 | 达尔| 北京市| 财经| 永安市| 阜康市| 大厂| 桂阳县| 合阳县| 揭西县| 东乡族自治县| 贡觉县| 东安县| 通许县| 林州市| 建瓯市| 陆川县| 江川县| 明星| 武夷山市| 祁阳县| 汉寿县| 南平市| 习水县| 石台县| 伊吾县| 乳山市| 西林县| 定陶县| 富阳市| 永定县| 临泽县|