Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

c to pascal converters

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort

Hello,

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() expressions)

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)

Marco

Reply by email

Unknown author
to Marco van de Voort

c2pas32 often gives acceptable results.

Hello, 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()

expressions) 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) Marco

Reply by email

Marco van de Voort
to Unknown author

In our previous episode, said:

c2pas32 often gives acceptable results.

Definitely the best results so far. If it is enough, I don't know yet, but then it will at least be good enough to speed up fragments. Thanks!

Reply by email