C to Delphi

From: Bob Richardson (bobrNO_at_SPAMhidbey.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 13:25:59 -0800

I've had good success in this project. The approach I've used is to
gradually change the C code to look more like Delphi. In particular this
meant converting many of the "for" statement to "while" statements. Once I
had dumbed down the C, I then converted it, pretty much line for line, into
Delphi, but with as much typecasting as possible. Of course there are lots
of little "gotchas" - like:

const
  alpha = 'abcd'
in C the 'a' is in alpha[0] while it's in alpha[1] in Pascal.

I presume that 0x8000 in C = $8000 in Pascal.

I think I'm down to just this one question.

The following C line:

   if (success ? !(PlayNS(player)) : PlayNS(player))
     {

was converted to

      if success then
        success := not PlayNS(player)
      else
        success := PlayNS(player);
      if success then
      begin

BUT THIS DOESN'T WORK. note: PlayNS returns a boolean.

How should I translate
   if (success ? !(PlayNS(player)) : PlayNS(player))



Relevant Pages

  • ACM Converter - need help with it
    ... I want to have the option of converting ripped .wav files ... then read 'fin' into the TACMIn (which I cannot ... Delphi Super Page/Multimedia/acmaudio.zip ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: How to create an all-user writable file
    ... Here you can find definitions of Windows API converted to Delphi ... Estimate the time you will spend to invoking API functions from Pascal plus converting structures. ... just to see a user-writable Textfile. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: VCL to VCL .NET
    ... converting a VCL win32 application in to .NET. ... Can anyone please suggest a good website / reference point where I could look at the issues while converting such project? ... I've expanded this information in chapter 7 of my Delphi 2007 Development Essentials courseware manual (which is available on Lulu.com ... CodeGear Technology Partner -- CodeGear RAD Studio Reseller ...
    (borland.public.delphi.non-technical)
  • Re: Convert QT to Delphi - I dont know if this is possible or not
    ... What is the point of converting it to Delphi? ... designer and on windows it all integrates into VC. ... Or should I go for FPC? ...
    (borland.public.delphi.non-technical)
  • Re: Delphi: Linux and .NET
    ... Did you know that Delphi Applications runs faster on Linux ... small example and report the bug to wine. ... > Here we are busily converting our code to .NET, ...
    (borland.public.delphi.non-technical)