Recent

Author Topic: CtoPascalConverter3 Full release  (Read 3342 times)

Handegun

  • Newbie
  • Posts: 1
CtoPascalConverter3 Full release
« on: July 21, 2022, 06:43:44 am »
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

  • Hero Member
  • *****
  • Posts: 1288
Re: CtoPascalConverter3 Full release
« Reply #1 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.
regards
Andreas

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: CtoPascalConverter3 Full release
« Reply #2 on: July 21, 2022, 09:23:37 am »
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
    );

« Last Edit: July 21, 2022, 11:29:10 am by marcov »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: CtoPascalConverter3 Full release
« Reply #3 on: July 21, 2022, 10:55:27 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.

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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

domasz

  • Sr. Member
  • ****
  • Posts: 423
Re: CtoPascalConverter3 Full release
« Reply #4 on: November 03, 2022, 01:03:14 pm »
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  [Select][+][-]
  1. for(int ch = 0; ch < channels; ++ch) {
  2.                                 bufOffset[ch] = (bufOffset[ch] + 0x3C0) & 0x3ff;
  3.                                 double *bufOffsetPtr = buf[ch] + bufOffset[ch];
  4.  

Output:
Code: Pascal  [Select][+][-]
  1. for(Integer ch = 0; ch < channels;  Dec             ch)
  2.                         begin
  3.                                 bufOffset[ch] = (bufOffset[ch] + $3C0)    and    $3ff;
  4.                                 Double *bufOffsetPtr = buf[ch] + bufOffset[ch];
  5.  

Does the source code look like this?
Code: Pascal  [Select][+][-]
  1. Str := StringReplace(Str, 'int ', 'Integer ', [rfReplaceAll]);
  2. Str := StringReplace(Str, '0x ', '$ ', [rfReplaceAll]);
  3. Str := StringReplace(Str, '& ', 'and ', [rfReplaceAll]);
« Last Edit: November 03, 2022, 01:18:59 pm by domasz »

mika

  • Full Member
  • ***
  • Posts: 102
Re: CtoPascalConverter3 Full release
« Reply #5 on: November 03, 2022, 01:31:12 pm »
https://en.delphipraxis.net/topic/7176-ctopascalconverter3/
It is a trolling and joke. We wont hear from Op never ever again.

 

TinyPortal © 2005-2018