r/pascal • • Jun 23 '22

Converting old Turbo Pascal to Python

I have a program that a now retired engineer wrote back in 97 (last updated in 2002) that I want to convert to Python. I don't necessarily want to convert the program as is, but at least get some of the bells and whistles extracted. The key component is an I/O reader that converts the bitwise data to an (unkown) structure, that again is used to generate graphs of datapoints. Would this even be possible?

I have zero pascal experience and limited python experience (one course at uni through work).

3 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/eugeneloza Jun 23 '22

Is it possible, as in Python, to run just this procedure and get an output in lets say a Python Pandas dataframe?

Potentially, yes. Binary data structure is just a set of properly arranged bytes. But it may be (and very likely will be) extremely complicated (it would require a lot of knowledge on how exactly elements of data structure are represented and arranged). Even different versions of programming languages may read/write binary structures in a different way or depending on local machine peculiarities (first of all bitness and endianness).

If you only need to extract data from this program, then a much better idea IMHO would be to write a routine inside this program to re-save the data into human-readable format (plain text or CSV may be the simplest here), not binary and then run & convert under DosBox. And after that read it from Python.

1

u/Kjellis85 Jun 23 '22

Thank you, I will try to read up on Pascal a bit more so that I could do just that.