[Lazarus] Translating a small C program to pascal (on lazarus)

Giuliano Colla giuliano.colla at fastwebnet.it
Mon Feb 26 18:56:35 CET 2018


Il 26/02/2018 03:51, Carlos E. R. via Lazarus ha scritto:
> Ah!  I didn't realize it could translate the declarations on a .c file,
> I thought it was only for .h files.
>
> I just had a quick test, but... I'll have to read on it, the quick test
> crashes:

Well actually it is only for .h files, but as .h files are just 
declaration, it can handle a good part of the job.

Most likely it crashes because it doesn't know how to handle the code 
after the declarations.

What I'd do in your place would be to create a sort of .h file, by 
cutting away from the original source everything except the 
declarations, and translate it.

Then translating the code, when you have all declarations in place 
becomes much easier, the bulk of it being sort of:

replace all "{" with "begin"

replace all "}" with "end;"

replace all "0x" with "$"

and so on.

Giuliano



More information about the Lazarus mailing list