tags:

views:

108

answers:

2

Hi,

I've found some old college work, with my final Ada95 project on it. Sadly, the disc was corrupted, and I have only managed to recover 3 files (the source and executable couldnt be recovered):

project.adb, project.ali and project.o

Are these 3 files enough to compile a new exe? I'm downloading the gnat compiler now, but have to admit, I have forgotten almost everything ada related...

Frank

[EDIT] shucks.... using GCC to compile the project.adb throws an error about a missing ads file, which I cannot recover.

Is it possible to extract this / compile just the ".o" or ".ali" files? Or, am I stuffed?

+3  A: 

project.adb is a source file.

Since you say that gcc complains about a missing .ads file, that indicates that project.adb contains a package body. You can manually construct a corresponding package spec by putting the following into package.ads:

package Project is
end Project;

Now that's almost certainly not enough, because the project spec probably had some type and constant declarations in it, so you'd have to analyze your package body and identify what it references. Infer what those declarations should look like and add them. Oh, and if your package body "with's" any packages that are not part of the standard Ada library, you'll have to recover those as well.

If you do manage to get your reverse engineered spec and the body to compile, you'll still have to create a "driver" program that "with's" the project package, and calls whatever functions and/or procedures that carried out the function of your project (and you'll have to pull the specs of those subprograms--which match their appearance in the package body--into the spec as well.)

Frankly, if it were me, I'd spend more time on trying to use some disk recovery tools to pull whatever else I could off the disk.

Marc C
no worries, was just a bit of nostalgia... Thank you
frank
A: 

In Ada95 (and 2005) one mostly work with adb files (occasionally with ads files) everything else is generated on the run. In your case the adb file is surely other linked up to other ads files.

However, ads files are usually small programs (Obviously, if you are not attempting really exotic things as 'the dining philosophers') which pertain to the algorithmic/mathematical structure of the program, if you can dig out what you did in your project then it should not be impossible to restore it !

Arkapravo