Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Convert Borland Pascal to GUI 32 bit Windows

Posted on 2004-04-20
Medium Priority
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.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


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 1000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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