Porting Code: Various Issues

Status
Not open for further replies.
Porting Code for Orbital Mechanics


I'm currently engrossed/engaged in a personal project in which I'm porting various useful programs that currently exist in Basic(IBM, Quick and GW) and Turbo Pascal to Python. My goal is to make said programs available to all, (with proper credit to the orginal authors, who have made the source code available to the public) in a format that is cross platform. It is a secondary goal to have these programs in a Python source format to serve as a useful teaching tool for those who wish to study the subject matter or the programming language.

Some thoughts arise: Some programs are small and easier to analyze, thus having the benefit of being easy to port, test and improve. One is complex, both in construction and in the math, making it easier to port modules and functions piecemeal. The hope is that after "re-assembling" and testing, that improvements and chances to recast the code (or refactor) will be obvious.

Some background: The small Basic programs are used for calculating antenna and circuit characteristics. The large Pascal program is used for calculating positions and such of earth-orbiting objects, like weather satellites. Other folks have built sucessful Delphi and C++ programs from the existing Pascal code, it is well documented and structured.

Any helpful hints for porting old Pascal code? (Note, I can read and understand the code, but don't currently have a copy of Turbo Pascal 7 for Dos in which to test and compare results with.)

q
 
As far as getting Pascal there is a surplus computer and software store in Allen, I might find it there.

What I have decided to do is port the whole darn thing and check the overall results with wxtrack and xsat.

Right now I'm working on building a project list of all modules and dependencies in Excel. Thank god this is cleanly documented Pascal and not the orginal code, Fortran!

q
 

JukeQube

Smack-Fu Master, in training
51
code:<HR>
Code:
Integer Types
------------------------------------------------------
Type                Range             Format
------------------------------------------------------
shortint         -128 .. 127          Signed 8-bit
integer        -32768 .. 32767        Signed 16-bit
longint   -2147483648 .. 2147483647   Signed 32-bit
byte                0 .. 255          Unsigned 8-bit
word                0 .. 65535        Unsigned 16-bit
------------------------------------------------------

Real Types
----------------------------------------------------------------
Type      Range               Significant Digits  Size in Bytes
----------------------------------------------------------------
real      2.9 x 10^-39 .. 1.7 x 10^38        11-12       6
single    1.5 x 10^-45 .. 3.4 x 10^38         7-8        4
double    5.0 x 10^-324 .. 1.7 x 10^308      15-16       8
extended  3.4 x 10^-4932 .. 1.1 x 10^4932    19-20       10
comp      -2^63 + 1 .. 2^63 - 1              19-20       8
----------------------------------------------------------------

This comes from "Turbo Pascal Reference Guide Version 5.0." I hope it's somewhat useful. :) If this book was mine I would offer to send it to you, but alas it is not. :( I hope this is useful.
 
Thank you kind sirs.

I think I can use the FloatType in Python to replace both reals and doubles.

Some more thoughts on porting large programs.

One friend suggest that I keep the original source in the new code as comments. I protested, say that a practice like that would make the code unreadable and I could always do a side by side compare.

I decided instead to do a line by line port by copying each function into a file and converting it a line at a time. Since most of the code is calculations, there may be very little to be refactored later on.

q
 
Another thought. I'll head out to the local used bookstore today and scrounge around for some old Pascal manuals. Gives me a chance to look at books and other things.

Cooless indeed, I just replaced a entire module, with two built-in functions. :D

Praise Guido!

I'm also keeping a running log of what I'm doing for documentation purposes.

q (happy coding mode) :)
 
Status
Not open for further replies.