[fpc-pascal] c to pascal converters

Marco van de Voort marcov at stack.nl
Thu May 3 10:22:23 CEST 2012


I'm in the process of converting an old MSVC6 application to FPC/Delphi,
so I'm thinking about using a c to pascal converter.

The code is older 6-10kloc, and is plain C in a MFC C++ framework. It does
nothing but processing samples (array handling and transformation), and
drawing a graph of it. There are some more I/O related tasks, but they don't
need to be converted because of changing hardware.

A converter would preferably convert method bodies (copy and past to new
file no problem) to Pascal.

The code is fairly straightforward but uses a lot of in-code variable
declarations (often arrays) and a lot of for loops that are not of the
standard form. 

I'm mostly only interested in getting the relevant for and while loops
converted without too much trouble. 

I tried two things on the net (Al Gun's c2pas and an older simtel one) and
they are mostly based on substitution and worse, they do these substitions
indiscriminately.  (e.g.  they do statement like substitutions in for()

Something that just do grunt work, but leaves code alone when in doubt would
already be progress.

Does anybody have good experiences with this or the other converter? (e.g.
for the softfpu units of FPC)


More information about the fpc-pascal mailing list