📄 main.h
字号:
/***************************************************************** Qt based generic FORTRAN 77 conversion into C++ Pseudocode **** written by John Coe III -- July 21, 2007 **** Version 1.1 jciii@earthlink.net ******************************************************************/#include <qapplication.h>#include <qstring.h>#include <qfiledialog.h>#include <qfile.h>#include <qdir.h>#include <qmessagebox.h>/* Global parameters defaults */QString ENDCHAR = ";"; // End of statement stringQString LABEL ="cont";// Used for labels and goto statementsQString INDENTCHAR = " "; // Indentation string, can be a tabint _IndentLength = 2; // This changes the indent spacingint _AutoDecIndex = 1; // For do loops, to turn off set to zeroint _MaxLineLength = 85; // Maximum length of program code/* Global headers from information file */QStringList fileHeader, programHeader;/* Constant array lengths */const int _ReservedLength = 15;const int _CondLength = 11;const int _CppKeywordLength = 32;const int _CppVarLength = 6;/* Enumeration for the types of Fortran program lines */enum FortranType{ eComment, eBeginProgram, eSubroutine, eEndProgram, eBlank, eWrite, eRead, eData, eSave, eRecord, eOpen, eClose, eRewind, ePrint, eType, eFormat, ePause, eStop, eEquivalence, eImplicit, eIntrinsic, ePointer, eStructure, eEndStructure, eUnion, eEndUnion, eBlock, // version 1.1 addition eCommon, // version 1.1 addition eExternal, // version 1.1 addition eInclude, eDefine, eIfDef, eEndDef, eCode, eVariable, eParameter, eIf, eElseIf, eElse, eEndIf, eContLine, eDo, eDoWhile, eEndDo, eContinue, eReturn, eCall, eLabel, eGoto, eUnknown,};/* Reserved Cpp variable types */QString CppReserved[] ={ "char", "char", "int", "short", "char", "int", "int", "short", "int", "long double", "double", "float", "float", "double", "double",};/* Reserved Fortran variable types */QString FortranReserved[] = { "CHARACTER",
"BYTE",
"LOGICAL*4",
"LOGICAL*2",
"LOGICAL*1",
"LOGICAL", "INTEGER*4",
"INTEGER*2",
"INTEGER",
"REAL*16",
"REAL*8",
"REAL*4",
"REAL",
"DOUBLEPRECISION",
"DOUBLE PRECISION" // version 1.1 addition
};/* Reserved Cpp conditional types */QString CppCond[] ={ "&&", "==", "||", "!=", "<", "<=", ">", ">=", "!", "TRUE", "FALSE", //"="};/* Reserved Fortran conditional types */QString FortranCond[] ={ ".AND.",
".EQ.",
".OR.",
".NE.",
".LT.",
".LE.",
".GT.",
".GE.",
".NOT.", ".TRUE.", ".FALSE." //":=" // this could be modified for Ada};/* Some Cpp reserved keywords */QString CppKeywords[] ={ "auto", "break", "case", "char", "class", "const", "default", "delete", "double", "enum", "extern", "float", "friend", "int", "long", "new", "private", "public", "protected", "register", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "virtual"};/* Prototypes */bool convertFortran(const QString fileName);QString swapConditionals(QString code);QString swapVariables(QString code, int replace);void swapKeywords(QString &code);FortranType determineFortranType( QString fullLine, QString &code, QString &label, bool &isCont );QString indentation(int indent);QString cleanCode(QString cleanData);QString processDo(QString doLoop);QString breakApart(QString code, QString &remain);int location(QChar myChar, QString codeSection);bool loadInfoFile(const QString &fileName);QString processString(QString& data);QString makeIntoCppFile(QString fileName);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -