summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-09-17 18:26:06 (GMT)
committerGitHub <noreply@github.com>2020-09-17 18:26:06 (GMT)
commit335e9189ece384977bb1a489ee82251b5668aaf0 (patch)
treeaa8a2c97c73d091da577c015c1870ef21a317021 /src/util.cpp
parent4c850acae57f81ced7f6a624bce8efe9d07c2c4c (diff)
parenta88b298bee89f001072c80e32e04dfd855d05c58 (diff)
downloadDoxygen-335e9189ece384977bb1a489ee82251b5668aaf0.zip
Doxygen-335e9189ece384977bb1a489ee82251b5668aaf0.tar.gz
Doxygen-335e9189ece384977bb1a489ee82251b5668aaf0.tar.bz2
Merge pull request #8033 from albert-github/feature/bug_ftn_recogn
Incorrect duplicate code for Fortran fixed/free recognition
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 34df8d7..5d7d8b4 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1828,7 +1828,7 @@ QCString removeRedundantWhiteSpace(const QCString &s)
{
if (nc != '=')
// avoid splitting operator&=
- {
+ {
*dst++=' ';
}
}
@@ -8474,3 +8474,56 @@ int usedTableLevels()
}
//------------------------------------------------------
+// simplified way to know if this is fixed form
+bool recognizeFixedForm(const char* contents, FortranFormat format)
+{
+ int column=0;
+ bool skipLine=FALSE;
+
+ if (format == FortranFormat_Fixed) return TRUE;
+ if (format == FortranFormat_Free) return FALSE;
+
+ for(int i=0;;i++) {
+ column++;
+
+ switch(contents[i]) {
+ case '\n':
+ column=0;
+ skipLine=FALSE;
+ break;
+ case ' ':
+ break;
+ case '\000':
+ return FALSE;
+ case '#':
+ skipLine=TRUE;
+ break;
+ case 'C':
+ case 'c':
+ case '*':
+ if (column==1) return TRUE;
+ if (skipLine) break;
+ return FALSE;
+ case '!':
+ if (column>1 && column<7) return FALSE;
+ skipLine=TRUE;
+ break;
+ default:
+ if (skipLine) break;
+ if (column>=7) return TRUE;
+ return FALSE;
+ }
+ }
+ return FALSE;
+}
+
+FortranFormat convertFileNameFortranParserCode(QCString fn)
+{
+ QCString ext = getFileNameExtension(fn);
+ QCString parserName = Doxygen::parserManager->getParserName(ext.data());
+
+ if (parserName == "fortranfixed") return FortranFormat_Fixed;
+ else if (parserName == "fortranfree") return FortranFormat_Free;
+
+ return FortranFormat_Unknown;
+}