Forum > Translations

CtoPascalConverter3 Full release

(1/2) > >>

Handegun:
I honestly don't know if this will be welcome here but I'll try anyway. My dad has been working on his translator between c and pascal for thirty years and had finally released the full version. He will need help and feedback to get it to the point of translating to all languages but this is what it is at the moment. The links are up on delphi, his personal blog or reddit so if you want to download for free then it's now available. He has been working so hard for years to provide this for free and I'm hoping to get some traction going for him. Easiest way is to search through r/CtoPascalConverter3 which is how I was recommended to this forum. Thank you for your time any suggestions or help would be appreciated and if not allowed please delete.

af0815:
It looks like closed source project for Delphi only. So it is not interesting here. But i cant go deeper, because i have no interrest on a menbership on the publishing page there.

marcov:
Open source would be better, but when doing header conversion or codec conversion all help is welcome, as some converters work better on some headers.

However some configuration would also be nice, I tested a microsoft SDK header iphlpapi.h, which is a MSDN header


* The first attempt, loading it from the SDK dir hung itself, the second attempt generated an exception
* Configuration: removing generation of $HPEMIT and $EXTERNALSYMBOL.
* Configuration: be able to specify a name of a DLL for header conversion purposes (so that WINAPI expands to  "stdcall external dllname name '_symbolname'; etc)
* Then I tried with only the headers outside of the SDK, and it didn't detect DWORD as a type, so decoding a prototype like below failed and generated a {$HPPEMIT for DWORD and an untranslated prototype.
* Another isolated run and it didn't generate anything anymore and I always got the exception. Does it hold state somewhere (temp files?)
The results looked quite ok, but were not really reproducible.


--- Quote ---DWORD
WINAPI
GetIpAddrTable(
    _Out_writes_bytes_opt_(*pdwSize)    PMIB_IPADDRTABLE pIpAddrTable,
    _Inout_                       PULONG           pdwSize,
    _In_                          BOOL             bOrder
    );

--- End quote ---

MarkMLl:

--- Quote from: af0815 on July 21, 2022, 06:55:44 am ---It looks like closed source project for Delphi only. So it is not interesting here. But i cant go deeper, because i have no interrest on a menbership on the publishing page there.

--- End quote ---

I disagree: all projects which might have some relevance to Object Pascal or related dialects are relevant here, since it nothing else they demonstrate that something is "doable" hence encourage other members of the community.

I think you need to consider that if OP's father has been working on it for that long, he might be unfamiliar with SourceForge etc.: at least he doesn't stand accused of only being prepared to talk to Facebook members :-)

MarkMLl

domasz:
On the blog there are no download links.
The no-membership download link is dead.
So I downloaded from Embarcadero and tried it.

Seems like the whole converter just does find&replace. It should rather interpret the source, "understand" it and then build the output.

Input:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for(int ch = 0; ch < channels; ++ch) {                                bufOffset[ch] = (bufOffset[ch] + 0x3C0) & 0x3ff;                                double *bufOffsetPtr = buf[ch] + bufOffset[ch]; 
Output:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for(Integer ch = 0; ch < channels;  Dec             ch)                         begin                                bufOffset[ch] = (bufOffset[ch] + $3C0)    and    $3ff;                                Double *bufOffsetPtr = buf[ch] + bufOffset[ch]; 
Does the source code look like this?

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Str := StringReplace(Str, 'int ', 'Integer ', [rfReplaceAll]);Str := StringReplace(Str, '0x ', '$ ', [rfReplaceAll]);Str := StringReplace(Str, '& ', 'and ', [rfReplaceAll]);

Navigation

[0] Message Index

[#] Next page

Go to full version