Show: Automated conversion of C code to .pas (Island)

Recently I started working on an automated conversion tool of C code to Elements. The tool is called “foxy” and is part of the HeaderImporter command line tool.

The tool is meant to output code that works (but usually isn’t pretty) opposed to Oxidizer which tries to create nicer looking code. It takes a json file like:

  "files": [ "nuklear.h"], // Input file(s)
  "outpath": ".", // Output path
  "language":  "oxygene", // Oxygene and Hydrogene are suppoted.
  "namespace": "Nuklear",
  "uses":  ["rtl"],
  "includes": {
    "stddef.h": "", 
"stdint.h": "", 
"windows.h":"#define nk_foreach(c, ctx) for((c) = nk__begin(ctx); (c) != 0; (c) = nk__next(ctx,c))\r\n#define FALSE 0\r\n#define TRUE 1\r\n#define LOWORD(a) ((WORD)(a))\r\n#define HIWORD(a) ((WORD)(((DWORD)(a) >> 16) & 0xFFFF))\r\n",
  "includePaths": ["." ]

The first results of this tool are shown here:

(The nuklear.h file was converted to .pas there; no changes were done to the file after that)

The conversion of the Nuklear toolkit ( to Elements/Island:

Note this tool is currently experimental.

1 Like

Linux version (running in Ubuntu on Windows):