Convert Borland Pascal to GUI 32 bit Windows

Posted on 2004-04-20
Last Modified: 2010-04-16
I have to convert a Borland Pascal App into a Windows GUI app. The resulting app has to be compatible with:

All operating systems Windows 98,2000 XP.
Current data and index files.

Has to provide a GUI interface to the use.

I need to know which development environment I would need. Any thing I should be aware of while convcerting the source.
Question by:Idarac
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4

Expert Comment

ID: 10868412
Well, the easiest development environment to step up to would be Borland Delphi.  That way you wont have to rewrite your code in a whole new language, just maybe make a few changes here and there (some functions may have been renamed, for example Assign() is now AssignFile()).

One thing to be aware of though, you'll be going from 16bit to 32bit, which means some of your numeric data types will be changing size (Integer and Word become signed and unsigned 32bit respectively).  In most cases that isn't a big deal, but when you're working with binary files, it is a big deal (reading a single integer with BP will read 2 bytes, with Delphi it'll read 4).  So you'll have to take that into consideration when working with your data files.  If they are typed files and you have records, it's actually an easy fix.  For example:

{ BP Record }
type MyRecord = Record
  MyInt: Integer;
  MyWord: Word;

{ Delphi Equivalent }
type MyRecord = Packed Record
  MyInt: SmallInt;
  MyWord: SmallWord;

Also notice the keyword Packed in the type declaration.  BP used packed records by default, but to be more efficient (speed not size wise) Delphi uses record alignment by default.  This will also create problems reading typed files, so the Packed keyword solves that.

There are many other minor issues to consider (for example "set of" doesn't work the same, but isn't commonly used so might not be an issue for you), but I think the renamed functions and different data sizes are the main ones to be aware of.

Author Comment

ID: 10868806
A bit more about actual data files.

Is is safe to assume that any data files the Pascal can work with Delphi can also work with?

I believe there is a packing and reindexing routine with the existing app. What would that tell me about what type of data files I have to work with?

The dataset I was given has extensions of *.dta, *.kx and .xx.

A bitmore about the Pasal project.
I have never used Delphi before how do I get the Pascal source into Delphi?

Expert Comment

ID: 10869212
Yes, it is safe to assume that any data file BP could read, Delphi can also read.  As I said you just need to watch out for some of the differences, like datatype sizes.

With packing and reindexing, it sounds like they are probably some sort of typed files.  When records are deleted from typed files, the most efficient (speed wise) thing to do is to mark the record as deleted, but to actually leave it in the file.  Then when a new record is added it can just overwrite the old deleted record.  But if new records are rarely added, the file is like swiss cheese with holes everywhere after awhile.  Packing the file would mean moving the remaining good records to the front of the file, and then all the deleted records would be on the end and could be truncated (this is efficient, size wise).  Of course there are more interpretations of "packing and reindexing", so this may be way off base.

As for those extensions, they mean nothing to me.  If it's a proprietary application, they could have chosen anything so it doesn't really indicate much.

And as for getting the source into Delphi, it's probably going to be a lot of cutting and pasting.  In the BP program, for example, you may have had a block of code that ran when the 'R' key was pressed.  In your Delphi application you'll have a button on a form to perform the action that the 'R' keypress used to, and so you would paste the code into that button's onClick event handler.

Any code not associated with an event (such as helper functions) could still be kept in separate units, just like you would have done in BP.
Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.


Author Comment

ID: 10872151
I just confirmed that the BP code is version 7.

I have Delphi 2.0 so I am going to try and bring in the version 7 code.

Does Delphi and BP both have a project persay where you load it based on the project?

I am going to install Delphi 2.0 on my computer and try and open the BP 7 project. Anything I should do before I try?

Expert Comment

ID: 10895450
I dont think BP had a project option, you just loaded up the main source file and hit compile.  I've never used anything as old as Delphi 2.0, but even if it does compile the BP code with no changes, it's not going to be a GUI program.  It's definitely going to take a bit of work to get that part done.

Author Comment

ID: 10898946
I have Delphi 2.0 here so I thought I would start with that.

So it seems I need a version of Delphi.

My last question to you is to help me make some sense of the Delphi versions. I see Delphi studio out there. Which version should I start with?

I will then close this question and start a new one when I actually start converting the program.

Accepted Solution

MannSoft earned 250 total points
ID: 10899187
Well I've never used Delphi 2.0, so I don't know what it is capable of, so it may indeed be good enough for you to do what you want.  I was just saying that you won't be able to recompile the BP program in Delphi, and have it become a GUI application without any changes.  No matter which version of Delphi you choose, you're going to have to manually create a GUI and add the code from your BP program behind the various events (mainly behind button clicks)

And about Delphi Studio, I think that is what they started calling versions 6 and 7 because they also came with the Linux equivalent of Delphi, called Kylix.  Unless you are interested in cross-platform development, you could probably save a few bucks by not getting a version with Kylix, because you won't need it.

Author Comment

ID: 10899368

Thanx for your help.

I will probably opening another question once I start the conversion.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This article explores several main social media platforms.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question