[Lazarus] Translating a small C program to pascal (on lazarus)
Carlos E. R.
robin.listas at telefonica.net
Mon Feb 26 19:20:33 CET 2018
On 2018-02-26 18:56, Giuliano Colla via Lazarus wrote:
> 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.
That can't explain a "EAccessViolation: Access violation". It could be a
syntax error, yes, but never an exception. And it happens before the
code part.
<https://www.freepascal.org/docs-html/rtl/sysutils/eaccessviolation.html>
Description
EAccessViolation is raised when the OS reports an Access Violation, i.e.
when invalid memory is accessed.
> 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.
Yes, I'll do that.
> 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.
Actually, the OpenC2Pas program did a lot of that :-)
Hopefully, one program translates most of the declarations, and another
a good part of the code :-)
--
Cheers / Saludos,
Carlos E. R.
(from 42.3 x86_64 "Malachite" (Minas Tirith))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180226/cf593f0c/attachment-0001.sig>
More information about the Lazarus
mailing list