Developer Wouter Van Nifterick has a C-To-Delphi converter tool available over on GitHub under an MIT open source license. The tool contains a split view where you can write standard C code on the left side of the split view and it will show you translated code in Object Pascal (Delphi) on the right side of the split view. The DelphiAST library is used to perform syntax checking on the Delphi code side. Some of the features of the converter tool include:
- If function main exists, a program will be generated. Otherwise a pascal unit with interface/implementation sections.
- Converts routines and arguments
- Converts for loops
- Converts case statements
- Converts structs
- Converts enums
- Converts 1 and 2 dimensional arrays
- Converts many other common routines to Delphi equivalents (strcpy,strcat,strlen,printf,argv,argc,etc)
- Converts classes
- drag/drop multiple C files to the application. It’ll find the .h files that belong to it, and convert all to .pas files in the same folder
If you are looking to convert some standard C code to Delphi or utilize some libraries that are written in C from your Delphi applications this converter tool can really give you a head start.