[英]What is the best way to convert Fortran Header Files .INC in c#
I am currently working on a fortran to c# project & I have come across some header files with extension .INC Foll. 我目前正在将Fortran转换为C#项目,并且遇到了扩展名为.INC Foll的一些头文件。 is an example of the header file
是头文件的示例
** MAIN.INC
INTEGER uid
INTEGER MathsMarks
INTEGER AWAMarks
INTEGER ScienceMarks
LOGICAL isStudent
REAL*8 percentage
REAL avg
CHARACTER*2 sName
LOGICAL*1 sUpdateStat
DOUBLE PRECISION d_var
complex*8 c8_var
Can anyone guide me in the best strategy to be used to convert this header file (.INC) in c# 任何人都可以指导我采用最佳策略来转换C#中的此头文件(.INC)
Do you know how main.inc is used? 您知道如何使用main.inc吗? Does it appear in several files or just in one file?
它出现在几个文件中还是仅出现在一个文件中? Is there a common block associated with these variable names?
是否有与这些变量名关联的通用块?
If there are no common blocks associated with it, then it is probably a bunch of commonly used local variables that are not shared. 如果没有与之关联的公共块,则可能是一堆不共享的常用局部变量。
If there is a common block associated with it, then they are global variables. 如果存在与之关联的公共块,则它们是全局变量。 If it had been done properly, the common should also have been in the inc file.
如果操作正确,则公用文件也应该位于inc文件中。 In C# if everything is in the same class, then these will be class level declarations.
在C#中,如果所有内容都在同一类中,则这些将是类级别的声明。
Translations 翻译
[EDITED] Initially, everything is public and static in the initial translation until you figure out what the program is doing. [编辑]最初,所有内容在初始翻译中都是公共的和静态的,直到您弄清楚程序在做什么。 Once you've done that, it can be refactored.
完成此操作后,即可对其进行重构。
If it is named common, put it in a static class of the same name as the named common. 如果将其命名为common,则将其放在与命名common相同名称的静态类中。 If it is unnamed common, then put it in the main class as a static declaration.
如果未命名为common,则将其作为静态声明放入主类。 Normally if something is in a common block, it is shared across functions so don't put it in a struct.
通常,如果某事物位于一个公共块中,则它会在函数之间共享,因此请勿将其放入结构中。
Equivalence is a nasty one: depends on how it is used. 等效是一个讨厌的东西:取决于如何使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.