rochus-keller / C2OBX

C header file to Oberon+ definition module transpiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a tool to transpile a C header file (with includes) to a corresponding Oberon+ definition module.

It already works well with the SDL2 headers (with only minimal modifications), but consider the tool work-in-progress.

Note that since it is undecidable, whether a C pointer is indeed a pointer to the given object or in fact a pointer to an array of such objects, and Oberon+ only supports pointers to structured types, all *basic_type are converted to CPOINTER TO CARRAY of basic_type (i.e. *[]), but *structured_type are translated to Oberon+ CPOINTER TO structured_type (i.e. *). The special case of **type which is used to get a pointer out of a procedure is handled by *[]*type for structured types and void, and *[] for basic types.

Pending:

  • process comments (line and block)
  • consider #DEFINE constants
  • use original type names for basic types (instead of plain C basic types)

About

C header file to Oberon+ definition module transpiler

License:GNU General Public License v2.0


Languages

Language:C 74.0%Language:C++ 25.7%Language:QMake 0.3%