Skip to content

Commit

Permalink
New utility to list duplicatted keywords. This helps when resolving c…
Browse files Browse the repository at this point in the history
…ross reference links.
  • Loading branch information
NormanDunbar committed Jan 11, 2017
1 parent b7c558c commit 1a16109
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sphinx/source/duplicateKeywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

The following are duplicated keywords

DIV
DRAW
MOD
PLOT
PRT_USE
RELEASE
SEARCH
SET

Finished.

63 changes: 63 additions & 0 deletions tools/listDuplicateKeywords.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <list>
#include <cctype>

//
// listDuplicateKeyword <keyword file>
//
// This program will read the list of keywords produced by extracteAllKeywords.cmd,
// and will list all those found to be duplicated. This helps when setting up the
// keyword and reference links.
//

using std::string;
using std::getline;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using std::ifstream;


string this_line;
string last_line = "Dummy Keyword";

void doFile(const char *fname);


int main (int argc, char *argv[])
{
if (argc != 2) {
cerr << "No keyword file parameter supplied.";
return 1;
}

cout << endl << "The following are duplicated keywords" << endl << endl;
doFile(argv[1]);
cout << endl << "Finished." << endl << endl;

return 0;
}


void doFile(const char *fname)
{
// Open a file, read it, extract the keywords.
// Then check if this one is the same as the previous one.

ifstream ifs (fname, std::ifstream::in);
while (ifs.good()) {
getline(ifs, this_line);
if (this_line == last_line) {
cout << last_line << endl;
}

last_line = this_line;
}

ifs.close();
}

0 comments on commit 1a16109

Please sign in to comment.