Solved

Convert Borland Pascal to GUI 32 bit Windows

Posted on 2004-04-20
8
411 Views
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.
0
Comment
Question by:Idarac
  • 4
  • 4
8 Comments
 
LVL 6

Expert Comment

by:MannSoft
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;
end;

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

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.
0
 
LVL 1

Author Comment

by:Idarac
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?
0
 
LVL 6

Expert Comment

by:MannSoft
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.
0
 
LVL 1

Author Comment

by:Idarac
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?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 6

Expert Comment

by:MannSoft
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.
0
 
LVL 1

Author Comment

by:Idarac
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.
0
 
LVL 6

Accepted Solution

by:
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.
0
 
LVL 1

Author Comment

by:Idarac
ID: 10899368
OK

Thanx for your help.

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
A Short Story about the Best File Recovery Software – Acronis True Image 2017
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now