将 Fortran 77 程序编码为子例程

发布于 2024-10-11 00:23:13 字数 495 浏览 7 评论 0原文

我接到的任务是为 Fortran 77 程序制作 GUI。为此,我使用 Lahey Fujitsu 编译器和 wisk,它本质上是 Winteracter 的基本版本。现在我正在 90 中编码 gui 部分,说实话,现在我什么也没编码,只是使用 wisk 向导吐出的代码,并且 gui 部分与 77 部分对话时遇到问题。

该程序由一个主程序和14个子程序文件组成。主程序调用所有其他子例程,处理计算并将最终结果写入文本文件。我想做的是将主程序作为子程序,并从程序的 gui 或 fortran 90 部分调用它,从而使 gui 成为主程序。由于 fortran 77 的大部分代码被声明为隐式双精度,而 fortran 90 代码则为隐式无精度,因此是否可以这样做?此外,在 GUI 部分中,我是否必须调用所有子例程,或者将被转换为子例程的主程序是否会处理这个问题?

任何帮助/建议将不胜感激。

如果有任何不清楚的地方(我确信是这样,因为我的 Fortran 技能仍然有限),请让我澄清我的意思。

谢谢, 基督教

I have been given the task of making a gui for a fortran 77 program. To do so I am using a Lahey Fujitsu compiler and wisk, which is essentially a bare bones version of winteracter . Now i am coding the gui portion in 90, to be honest right now i am coding nothing and just using the code the wisk wizard is spitting out, and am having a problem with the gui portion talking to the 77 portion.

The program consists of a main program and 14 subroutine files. The main program makes calls to all of the other subroutines, processes calculations and writes the final result to a text file. What i would like to do is make the main program a subroutine and call it from the gui or fortran 90 portion of the program, thus making the gui the main program. Is it possible to do this since much of the fortran 77 is declared implicit double precision while the fortran 90 code is implicit none? Further more in the gui portion would i have to call all of the subroutines or will the main program, that will be coverted into a subroutine, handle this?

Any help/advice would be appreciated.

If any of this is not clear, which I am sure is the case since my fortran skills are still limited, just ask me to clarify what i mean.

Thanks,
Christian

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

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

发布评论

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

评论(1

几味少女 2024-10-18 00:23:13

我所在的团队正在开发一个程序,该程序主要是用 Fortran 77 编写的,并且大量使用了隐式实数等。但是,有一些模块文件是在稍后阶段添加的,并且这些文件是用 Fortran 编写的90,并且他们使用隐式无。我不知道所有这些是否可以被认为是好的实践,但至少它有效,并且这两种 Fortran 方言的存在到目前为止从未造成任何问题(或者我不记得了......)。因此我怀疑90和77的混合会让你头疼。 (仅供参考,我们使用英特尔编译器)

我现在可能忽略了一些明显的事情,但乍一看,我没有发现您将当前主程序转换为 GUI 子例程并使用“告诉它做什么”的参数数量。如果您沿着这条路走下去,最好尽可能多地保留旧代码 - 让旧的主程序执行子例程调用等。

但是,为旧程序构造某种包装器是不可能的吗? ,即保持原样,创建一个单独的 GUI,并让该 GUI 使用适当的参数调用程序?我在 GUI 编程和包装器创建领域没有太多经验,所以我无法告诉您哪种方法更可取,但这听起来像是您需要修改最少的路线,并且旧程序可以仍然可以用作独立的命令行工具,这在某些情况下可能更可取。

I am part of a team working on a program that is written largely in Fortran 77, and that makes copious use of implicit real etc. There are, however, module files that have been added at a later stage, and those are written in Fortran 90, and they use implicit none. I don't know whether all of this can be considered good practice or not, but at least it works, and the presence of those two Fortran dialects has so far never posed any problems (or none that I can remember...). Therefore I doubt that the mix of 90 and 77 is going to give you a headache. (Just FYI, we use the Intel compiler)

I may now be overlooking something obvious, but at first glance I don't see anything wrong with your idea of turning the current main program into a subroutine of the GUI, and calling it with a number of arguments that "tell it what to do". If you go down that road, best leave as much of the old code untouched as you possibly can - have the old main program do the subroutine calling etc.

Would it not be possible, though, to construct some sort of wrapper for the old program, i.e. leave it as it is, create a separate GUI, and have that GUI call the program with the appropriate parameters? I don't have much experience in the field of GUI programming and wrapper creation though, so I cannot tell you which approach would be preferable, but this sounds like the route for which you'd have to modify least, and the old program could still be used as a standalone command line tool, which may be preferable in some cases.

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