ada95 有 3 个文件 .ali、.adb 和 .o - 我可以编译吗

发布于 2024-08-20 06:12:32 字数 325 浏览 6 评论 0原文

我找到了一些旧的大学作业,上面有我的最终 Ada95 项目。遗憾的是,光盘已损坏,我只恢复了 3 个文件(无法恢复源文件和可执行文件):

project.adb、project.ali 和 project.o

这 3 个文件是否足以编译新的 exe?我现在正在下载 gnat 编译器,但不得不承认,我几乎忘记了与 ada 相关的所有内容......

Frank

[编辑] 糟糕......使用 GCC 编译 project.adb 会引发有关缺少广告文件的错误,我无法恢复该错误。

是否可以提取此/仅编译“.o”或“.ali”文件?或者说,我吃饱了?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恏ㄋ傷疤忘ㄋ疼 2024-08-27 06:12:32

project.adb一个源文件。

既然您说 gcc 抱怨缺少 .ads 文件,则表明 project.adb 包含包主体。您可以通过将以下内容放入 package.ads 来手动构建相应的包规范:

package Project is
end Project;

现在这几乎肯定还不够,因为项目规范中可能有一些类型和常量声明,因此您必须分析包主体并识别它引用了什么。推断这些声明应该是什么样子并添加它们。哦,如果您的包体“包含”任何不属于标准 Ada 库的包,您也必须恢复这些包。

如果您确实设法编译逆向工程规范和主体,您仍然需要创建一个“驱动程序”程序来“使用”项目包,并调用执行以下功能的任何函数和/或过程:你的项目(并且你必须将这些子程序的规范 - 与它们在包体中的外观相匹配 - 也拉入规范中。)

坦率地说,如果是我,我会花更多的时间来尝试使用一些磁盘恢复工具来恢复磁盘上的所有内容。

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.

筑梦 2024-08-27 06:12:32

在 Ada95(和 2005)中,主要使用 adb 文件(偶尔使用广告文件),其他所有内容都是在运行时生成的。在您的情况下,adb 文件肯定与其他广告文件链接。

然而,广告文件通常是小程序(显然,如果您没有像“哲学家就餐”那样尝试真正奇特的东西),它们与程序的算法/数学结构有关,如果您可以挖掘出您在项目中做了什么,那么应该不是不可能恢复吧!

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 !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文