Home

Awesome

Chet - C Header Translator for Delphi

Chet is a .h-to-.pas translator powered by libclang for Delphi.

Features

Unlike some other header translators, Chet uses the Clang compiler to parse header files, resulting in more accurate translations that require fewer manual adjustments.

Some notable features are:

Limitations

Requirements

Since Chet uses an actual compiler, you will need to have a (minimal) C develop environment installed, as well as LLVM with Clang. Clang needs to be able to find the system headers for the development environment. These will usually be available if you have some version of Visual Studio with Visual C++ installed. The free (community) edition of Visual Studio suffices.

You can run Chet first to check for any errors related to missing dependencies. If you get any dependency errors when running the translator, then you can download the dependencies here:

You can use the pre-compiled 64-bit Windows Chet application in the Bin directory.

If you want to compile Chet yourself, then you also need libclang for Delphi and make sure the Delphi IDE can find it (the Chet project will find it automatically if the Neslib.Clang directory is at the same level as the Chet directory).

Contributions

Thank you for these contributions:

User Guide

Chet is pretty straightforward. In many cases, you only need to provide a directory with header files, the name of the output .pas file and select "Run Header Translator (F9)".

For more control over the conversion process, you can specify various options, described below.

Chet Screenshot

Menu

Any configuration options you set can be saved to a .chet configuration file (which is a simple ini-file). This allows you to load the settings later to rerun the conversion (for example, when new versions of the header files have been released). You can load and save these configuration options using the File menu.

To help pre-configure some settings for a new session, select File | New Project... (Ctrl+N). You enter the name of the project and Chet will pre-configure some settings based on the name you enter (although you can always modify those settings later).

The Run menu just as the single option Run Header Translator, which you can also activate with F9.

Project Page

The project page contains the most important configuration options:

Platforms Page

On this page you specify what platforms you want to target, and how you want to configure them.

Next are checkboxes for all platforms you want to target (32-bit Windows, 64-bit Windows, 32-bit macOS, 64-bit Linux, iOS and Android). For each platform that you check, you must enter the following options:

Parse Options Page

Here you can customize the Clang parsing process.

Conversion Options

This is where you customize the generated output.

Note that only Doxygen style documentation comments are parsed by Clang. These are comments that follow any of these format conventions:

Chet tries to convert #define declarations to constants if possible. This only works if:

Ignore Page

Here you can specify a list of symbols to ignore. These symbols will not be translated.

The most common use is to ignore #define's that generate conversion errors, or functions you don't need. You can also choose to ignore some types, but that may result in compilation errors later because expected types are missing.

Note that symbols are case-sensitive.

Translate Page

The final page just has a single button "Run Header Translator" (which you can also activate with F9). It shows the progress of the translation process, as well as any errors that occurred while parsing the header files.

You can use these errors to fix the header files, add missing header files, or configure that parsing process by adding command line arguments (for example, by adding include search paths).

License

Chet is licensed under the Simplified BSD License. See License.txt for details.