Sign in Join

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

Mailing lists / fpc-pascal / 2017-05

Translation C to Pascal

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Marc Santhoff

Hi,

since fpc supports a lot of intresting SoCs and Microcontrollers - has anyone really used Allwinner A20? - I need an update:

Which translator do you use for making Object Pascal code from C?

For headers there is the very well working h2pas. But what tool is recommendable for .c files?

The one I used in the past had many flaws, at first a strongly limited subset of translatable statements. Secondly it is not actively developed, thats why I'm searching a new and better one.

TIA,
Marc

Marc Santhoff
to fredvs
fredvs wrote
Hello. The best (IMHO) is c2pas32 --> http://www.astonshell.com/freeware/c2pas32/

Nice program, i fed the adc.c source from STMs fwlib for stm32f4 through and the generated code looks fine. There is some guessing on type casts, but I hope those can be cleared using simple scripting or the like.

But it is old and translate into Delphi code, so still work after...

Will see that when trying the compiler on it, not enough time for mkore than some preparations currently. Maybe switching to mode Delphi is fine, if anything is working for embedded targets.

Many thanks,
Marc

Unknown author
to Marc Santhoff
Marc Santhoff wrote 11 lines
On Di, 2017-05-02 at 08:33 -0700, fredvs wrote: > Hello. > > The best (IMHO) is c2pas32 --> > http://www.astonshell.com/freeware/c2pas32/ Nice program, i fed the adc.c source from STMs fwlib for stm32f4 through and the generated code looks fine. There is some guessing on type casts, but I hope those can be cleared using simple scripting or the like.

There was also a mailing list thread about this a few weeks/months ago, where I was discussing the idea with a few other people on the list.

Another idea is to link in C source as .a files into your fpc program? If you want to write wrappers around the C code and use the C code directly as .a files from gcc generated...

But depends.. what you need.