From 848e1b55fc8edb487e9b654b6cf7d3a55f1937ee Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Tue, 1 Jul 2008 22:06:28 +0000 Subject: [PATCH] Adding the Translator Module, which handles blobs of Doxygen Comments. Being heavily reworked at the moment. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10622 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/DoxygenEntity.cpp | 84 ++ Source/DoxygenTranslator/DoxygenEntity.h | 23 + .../DoxygenTranslator/DoxygenTranslator.cpp | 630 ++++++++++ Source/DoxygenTranslator/Skeleton | 1070 +++++++++++++++++ Source/DoxygenTranslator/example.i | 19 + 5 files changed, 1826 insertions(+) create mode 100644 Source/DoxygenTranslator/DoxygenEntity.cpp create mode 100644 Source/DoxygenTranslator/DoxygenEntity.h create mode 100644 Source/DoxygenTranslator/DoxygenTranslator.cpp create mode 100755 Source/DoxygenTranslator/Skeleton create mode 100644 Source/DoxygenTranslator/example.i diff --git a/Source/DoxygenTranslator/DoxygenEntity.cpp b/Source/DoxygenTranslator/DoxygenEntity.cpp new file mode 100644 index 000000000..9b02ade12 --- /dev/null +++ b/Source/DoxygenTranslator/DoxygenEntity.cpp @@ -0,0 +1,84 @@ +#include "DoxygenEntity.h" +#include + +/* Little data class for Doxygen Commands */ + + +/* Basic node for commands that have + * nothing after them + * example: \n + */ +string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention", + "author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", + "class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def", + "defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e", + "else", "elseif", "em", "endcode", "endcond", "enddot", "endhtmlonly", "endif", + "endlatexonly", "endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly", + "enum", "example", "exception", "f$", "f[", "f]", "f{", "f}", "file", "fn", "headerfile", + "hideinitializer", "htmlinclude", "htmlonly", "if", "ifnot", "image", "include", + "includelineno", "ingroup", "internal", "invariant", "interface", "latexonly", "li", + "line", "link", "mainpage", "manonly", "msc", "n", "name", "namespace", "nosubgrouping", + "note", "overload", "p", "package", "page", "par", "paragraph", "param", "post", "pre", + "private", "privatesection", "property", "protected", "protectedsection", "protocol", + "public", "publicsection", "ref", "relates", "relatesalso", "remarks", "return", "retval", + "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", + "subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until", + "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", + "$", "@", string(1, 92), string(1, '&'), "~", "<", ">", string(1, '#'), "%"}; + +string findCommand(int commandNum){ + + int arraySize = sizeof(commandArray2)/sizeof(*commandArray2); + if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){ + return commandArray2[commandNum]; + } + + return "" ; +} + +DoxygenEntity::DoxygenEntity(int typeEnt){ + typeOfEntity = typeEnt; + data = ""; + isLeaf = 1; +} + +/* Basic node for commands that have + * only 1 thing after them + * example: \b word + * OR holding a string + */ +DoxygenEntity::DoxygenEntity(int typeEnt, string param1){ + typeOfEntity = typeEnt; + data = param1; + isLeaf = 1; +} + +/* Nonterminal node + * contains + */ +DoxygenEntity::DoxygenEntity(int typeEnt, list entList){ + typeOfEntity = typeEnt; + data = ""; + isLeaf = 0; + entityList = entList; +} + + +void DoxygenEntity::printEntity(){ + if (isLeaf) { + cout << "Node Command: " << findCommand(typeOfEntity); + if (data.compare("") != 0) cout << "Node Data: " << data; + cout << endl; + } + else{ + list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(); + p++; + } + } +} + +DoxygenEntity::~DoxygenEntity() +{ +} diff --git a/Source/DoxygenTranslator/DoxygenEntity.h b/Source/DoxygenTranslator/DoxygenEntity.h new file mode 100644 index 000000000..8330e4507 --- /dev/null +++ b/Source/DoxygenTranslator/DoxygenEntity.h @@ -0,0 +1,23 @@ + +#include +#include +#include +#include + +using namespace std; + +class DoxygenEntity{ + +public: + DoxygenEntity(int typeEnt); + DoxygenEntity(int typeEnt, string param1); + DoxygenEntity(int typeEnt, list entList); + virtual ~DoxygenEntity(); + void printEntity(); + int typeOfEntity; + list entityList; + string data; + int isLeaf; +}; + + diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp new file mode 100644 index 000000000..dadea41b5 --- /dev/null +++ b/Source/DoxygenTranslator/DoxygenTranslator.cpp @@ -0,0 +1,630 @@ +/* The main class for translating blobs of Doxygen for SWIG + * by Cheryl Foil, mentor Olly Betts, for Google's Summer of Code Program + * Currently the spacing/format on this is a bit goofy in places, due to shuffling code + * between 2 editors! Apologies for anyone combing through it :) + */ +//TODO DOH instead of STL? +//TODO Most commands are not fully implemented + +#include +#include +#include +#include +#include +#include "DoxygenEntity.h" + +using namespace std; + + +////////////////////////////////////////// +/*Set these to pick what internal functions +to test. */ + +//int testCommandParsingFunctions = 1;// not implemented + +int testCodeCrawlingFunctions = 1; +int demonstrateParsing = 0; + +////////////////////////////////////////// + + + +/* Globals*/ + + +// An array of all the commands and my generic description tag, plaindescription + +string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention", + "author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", + "class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def", + "defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e", + "else", "elseif", "em", "endcode", "endcond", "enddot", "endhtmlonly", "endif", + "endlatexonly", "endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly", + "enum", "example", "exception", "f$", "f[", "f]", "f{", "f}", "file", "fn", "headerfile", + "hideinitializer", "htmlinclude", "htmlonly", "if", "ifnot", "image", "include", + "includelineno", "ingroup", "internal", "invariant", "interface", "latexonly", "li", + "line", "link", "mainpage", "manonly", "msc", "n", "name", "namespace", "nosubgrouping", + "note", "overload", "p", "package", "page", "par", "paragraph", "param", "post", "pre", + "private", "privatesection", "property", "protected", "protectedsection", "protocol", + "public", "publicsection", "ref", "relates", "relatesalso", "remarks", "return", "retval", + "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", + "subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until", + "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", + "$", "@", string(1, 92), string(1, '&'), "~", "<", ">", string(1, '#'), "%", "plaindescription"}; + + +string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", + "else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param", + "tparam", "post" , "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "todo", + "version", "warning", "xrefitem" }; + + + int startIndex = 0; + int endIndex = 0; + int isNewLine = 0; + + string doxygenString = ""; + int briefDescExists = 0; + + /* Entity list is the root list. + * it is arranged this way to help documentation modules, + * such as the javaDoc one, "sort" entities where they need to. + */ + + list rootList; + +/* General (untested) assist methods */ + + string StringToLower(string stringToConvert) + + {//change each element of the string to lower case + + for(unsigned int i=0;i= doxygenString.length()) return ""; + int startIndex = startInd; + int endIndex = startInd; + string description = ""; + /* Find the End of the description */ + int keepLooping = 1; + int spareIndex = 0; + int counter; + int finalIndex; + while(keepLooping && endIndex < doxygenString.length()){ + if (doxygenString[endIndex] == '\n'){ + //cout << "1 "; + counter = endIndex; + if ( keepLooping && endIndex < doxygenString.length()-1) { + counter++; + //cout << "Counter :" << counter << endl; + while(keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || + doxygenString[counter] == '*'|| doxygenString[counter] == '\n'|| doxygenString[counter] == '/' + || doxygenString[counter] == '!') ){ + if(doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter;} + else{ counter++;} + } + + } + //endIndex = counter; + } + else if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ + //cout << "2 "; + spareIndex = endIndex; + if (isSectionIndicator(getNextWord(spareIndex))) keepLooping = 0; + } + else if(endIndex < doxygenString.length() - 1 + && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ + //cout << "3 "; + keepLooping = 0; + } + if(keepLooping){ + //cout << "4 "; + endIndex++; + } + } + //cout << "Done with EndIndex" << endl; + while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; + + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' + || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + startInd = finalIndex; + return description; + } + + /* This method is for a specific form of doxygen command + * that begins with a \command and ends in \endcommand + * such as \code and \endcode. The proper usage is + * progressTilEndCommand("endcode", index) + * currently this method does NOT process what is in between the two commands + */ + //TODO Make progressTilCommand return a formatted string + int progressTilEndCommand(string theCommand, int &startInd){ + endIndex = startInd; + while (endIndex < doxygenString.length()){ + if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ + //cout << doxygenString.substr(endIndex + 1 , theCommand.length())<< endl; + if (theCommand.compare(doxygenString.substr(endIndex + 1 , theCommand.length())) == 0){ + startInd = endIndex + theCommand.length() + 1; + return 1; + } + } + endIndex++; + } + //End command not found + return 0; + } + + string getStringTilAnyCommand(string theCommand, int &startInd){ + endIndex = startInd; + startIndex = startInd; + int keepLooping = 1; + while (keepLooping && endIndex < doxygenString.length()){ + if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ + startInd = endIndex; + keepLooping = 0; + } + endIndex++; + } + string description = ""; + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' + || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + startInd = endIndex; + return description; + return 0; + } + ///////////////TEST CLASSES AND MAIN BELOW///////////////// + + + /* Testing clearFluff(), a method to scan past all excess / * ! from beginning of + * a comment blob. Compartmentalised simply because this is a comment habit that + * differs wildly */ + + int testClearFluff(){ + + string cases[] = {"/** WORD", "/*! WORD", "/******* WORD", "///// WORD", "//! WORD", "//! WORD", "///WORD", + "/**\nWORD", "/**\n*WORD", "/** \n WORD"}; + int testPassed = 1; + int casesSize = sizeof(cases)/sizeof(*cases); + for (int i = 0; i < casesSize; i++){ + doxygenString = cases[i]; + if(cases[i][clearFluff(0)] != 'W'){ + cout << "ClearFluff failed for string :" << doxygenString << "\t Displayed :" << cases[i][clearFluff(0)] << ": Instead." << endl; + testPassed = 0; + } + } + if(testPassed) cout << "+++ClearFluff passed for all tests+++\n" << endl; + else cout << "+++ClearFluff FAILED.+++" << endl; + return testPassed; + + }; + + int testGetNextWord(){ + string cases[] = {"/** WORD ", " * WORD ", "///!WORD ", " WORD ", "//! WORD ", " * WORD ", "*WORD "}; + int testPassed = 1; + string testWord = ""; + int placement = 0; + int casesSize = sizeof(cases)/sizeof(*cases); + for (int i = 0; i < casesSize; i++){ + doxygenString = cases[i]; + placement = 0; + testWord = getNextWord(placement); + if(testWord.compare("WORD") != 0){ + cout << "GetNextWord failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0; + } + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + } + placement = 0; + doxygenString = " * @WORD "; + testWord = getNextWord(placement); + if(testWord.compare("@WORD") != 0){ + cout << "GetNextWord failed for string :" + << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = " * "; + testWord.push_back(92); + testWord = testWord + "WORD "; + string commandWord = ""; + commandWord.push_back(92); + commandWord = commandWord + "WORD"; + doxygenString = testWord; + placement = 0; + testWord = getNextWord(placement); + if(testWord.compare(commandWord) != 0){ + cout << "GetNextWord failed for string :" << doxygenString + << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + doxygenString = "WORD ANOTHER WORD1 WORD2 \n"; + placement = 0; + testWord = getNextWord(placement); + if(testWord.compare("WORD") != 0){ + cout << "GetNextWord failed for string :" << doxygenString + << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = getNextWord(placement); + if(testWord.compare("ANOTHER") != 0){ + cout << "GetNextWord failed for string :" << doxygenString + << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = getNextWord(placement); + if(testWord.compare("WORD1") != 0){ + cout << "GetNextWord failed for string :" << doxygenString + << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = getNextWord(placement); + if(testWord.compare("WORD2") != 0){ + cout << "GetNextWord failed for string :" + << doxygenString << "\t Displayed :" << testWord + << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = getNextWord(placement); + if(testWord.compare("") != 0){ + cout << "GetNextWord failed for string :" << doxygenString + << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + testWord = getNextWord(placement); + if(testWord.compare("") != 0){ + cout << "GetNextWord failed for string :" << doxygenString << + "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0;} + //else cout << "GetNextWord passed for string :" << doxygenString << endl; + if(testPassed) cout << "+++NextWord passed for all tests+++\n" << endl; + else cout << "+++NextWord FAILED+++\n" << endl; + return testPassed; + } + + int testGetOneLine(){ + string cases[] = {" * Crop this sentence after this period.\n", + " * Crop this sentence after this period.\n", + "Crop this sentence after this period.\n", + "//! Crop this sentence after this period.\n", + " Crop this sentence after this period.\n" + }; + int testPassed = 1; + string testWord = ""; + int placement = 0; + int casesSize = sizeof(cases)/sizeof(*cases); + for (int i = 0; i < casesSize; i++){ + doxygenString = cases[i]; + placement = 0; + testWord = getOneLine(placement); + if(testWord.compare("Crop this sentence after this period.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0; + } + } + doxygenString = ("Get this line.\n * Now get this line."); + placement = 0; + testWord = getOneLine(placement); + if(testWord.compare("Get this line.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0; + } + testWord = getOneLine(placement); + if(testWord.compare("Now get this line.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0; + } + testWord = getOneLine(placement); + if(testWord.compare("") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; + testPassed = 0; + } + + if(testPassed) cout << "+++GetOneLine passed for all tests+++\n" << endl; + else cout << "+++GetOneLine FAILED+++\n" << endl; + return testPassed; + } +//TODO Flesh testGetStringTilEndOfParagraph out, fix weird spacing problems + int testGetStringTilEndOfParagraph(){ + int placement = 0; + int testPassed = 1; + string testParagraph; + doxygenString = ("/* This is a description,\n * thus it continues on\n * for several lines.\n\n This Shouldn't be included.\n\n **/"); + testParagraph = getStringTilEndOfParagraph(placement); + if( testParagraph.compare("This is a description, thus it continues on for several lines.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testParagraph << ": Instead." << endl; + testPassed = 0; + } + //cout << "Curr Placement: " << placement<< endl; + testParagraph = getStringTilEndOfParagraph(placement); + //cout << "Curr Placement: " << placement<< endl; + if( testParagraph.compare(" This Shouldn't be included.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testParagraph << ": Instead." << endl; + testPassed = 0; + } + + //cout << "Curr Placement: " << placement<< endl; + //cout << "String Length: " << doxygenString.length() << endl; + + doxygenString = "/* This is a description,\n * thus it continues on\n * for several lines.\n * \n * "; + doxygenString.push_back(92); + doxygenString += "author cheryl foil \n\n **/"; + placement = 0; + testParagraph = getStringTilEndOfParagraph(placement); + if( testParagraph.compare("This is a description, thus it continues on for several lines.") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testParagraph << ": Instead." << endl; + testPassed = 0; + } + + if(testPassed) cout << "+++GetDescription passed for all tests+++\n" << endl; + else cout << "+++GetDescription FAILED+++\n" << endl; + return testPassed; + } + + int testProgressTilEndCommand(){ + int placement = 0; + int testPassed = 1; + string testParagraph; + doxygenString = "Let's pretend this \n * is a bunch of code to be ended in "; + doxygenString.push_back(92); + doxygenString += "endcodeSTOP"; + progressTilEndCommand("endcode", placement); + //cout << "Placement : " << placement << endl; + if( doxygenString[placement] != 'S'){ + cout << "GetOneLine failed for string :" << doxygenString << "\n\t Displayed :" << testParagraph << ": Instead." << endl; + testPassed = 0; + } + if(testPassed) cout << "+++ProgressTilEndCommand passed for all tests+++\n" << endl; + else cout << "+++ProgressTilEndCommand FAILED+++\n" << endl; + return testPassed; + } + + int testCCF(){ + cout << "TESTING COMMAND PARSING FUNCTIONS" << endl; + cout << "Testing clearFluff" << endl; + testClearFluff(); + + cout << "Testing getNextWord" << endl; + testGetNextWord(); + cout << "Testing getOneLine"<< endl; + testGetOneLine(); + + cout << "Testing getStringTilEndOfParagraph" << endl; + testGetStringTilEndOfParagraph(); + + cout << "Testing progressTilEndCommand" << endl; + testProgressTilEndCommand(); + + return 1; + } + + /* prints the parse tree + * + */ + void printTree(){ + + list::iterator p = rootList.begin(); + while (p != rootList.end()){ + (*p).printEntity(); + p++; + } + + } + /* The actual "meat" of the doxygen parser. This is not yet fully implemented + * with my current design- however the skeletal outline is contained in + * the file Skeleton + */ + + int addCommand(int commentNum, int &startInd, list &doxyList){ + startIndex = startInd; + string name; + string nextWordInLine = ""; + string restOfLine = ""; + string restOfParagraph = ""; + string headerfile =""; + string headername = ""; + switch(commentNum){ + + + /* \b */ + case 108: + name = getNextWord(startIndex); + if (!name.empty()) doxyList.push_back( DoxygenEntity(108, name)); + else cout << "No word followed b command. Not added" << endl; + break; + /* \brief */ + case 109: + restOfParagraph = getStringTilEndOfParagraph(startIndex); + if(!restOfParagraph.empty()) doxyList.push_back( DoxygenEntity(109, restOfLine)); + else cout << "Nothing followed brief command. Not added" < entityList() ))); + + break; + + default: + cout << "Command " << commentNum << " not supported yet" << endl; + break; + } + startInd = startIndex; + } + + /* Returns the parse tree */ + +list parse(int startInd, int endInd, list &doxyList){ + string currWord = ""; + int startIndex = startInd; + int savedIndex; + int currCommand; + while (startIndex < endIndex){ + savedIndex = startIndex; + currWord = getNextWord(startIndex); + + if(currWord[0] == 92 || currWord[0] == '@'){ + currWord = doxygenString.substr(startIndex+1, currWord.length() - 1); + currCommand = findCommand(currWord); + if (currCommand < 0 ){ cout << "BAD COMMAND: " << currWord << endl; exit(1);} + //cout << "Command: " << currWord << " " << currCommand << endl; + addCommand(currCommand, startIndex, doxyList); + } + else{ + startIndex = savedIndex; + addCommand(238, startIndex, doxyList); + + } + } + + +} + + + int main(int argc, char *argv[]){ + if(testCodeCrawlingFunctions) testCCF(); + if (demonstrateParsing){ + int placement = 0; + clearFluff(0); + parse(0, doxygenString.length(), rootList); + printTree(); + } + return 1; + } diff --git a/Source/DoxygenTranslator/Skeleton b/Source/DoxygenTranslator/Skeleton new file mode 100755 index 000000000..099b94393 --- /dev/null +++ b/Source/DoxygenTranslator/Skeleton @@ -0,0 +1,1070 @@ +/** NOT A WORKING FILE- NOTES/SCRAPS + * A result of the initial implementation, + * stopped early because I changed my design. This is currently + * being reworked in the actual DoxygenTranslator class + */ + + + + +/* The Very Large and Unelegant Solution for dealing with Doxygen commands such as + * " \param". + * This is implemented this way because a LARGE number of potential Doxygen commands + * are not needed (such as PHP only or calling call graphs) and thus are simply + * thrown out. The more useful functions + * maybe be compartmentalised into their own method later on. + */ + +int addComment(int commentNum){ + + startIndex = endIndex; + string name; + string nextWordInLine = ""; + string restOfLine = ""; + string restOfParagraph = ""; + string headerfile =""; + string headername = ""; + switch(commentNum){ + + + /* \a */ + case 101: + nextWordInLine = getNextWord(); + if((nextWordInLine).empty()){ + cout << "Error: No word after tag a "<< endl; + } + else entityList.push_back( DoxygenEntity(101, "", nextWordInLine)); + startIndex = endIndex; + break; + + /* \addindex */ + case 102: + cout << "Add Index May not be Supported."<< endl; + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag a "<< endl; + } + else entityList.push_back( DoxygenEntity(102, "", restOfLine)); + startIndex = endIndex; + break; + + /* \addtogroup */ + case 103: + + + name = getNextWord(); + if (anythingLeftOnLine()){ + restOfLine = getOneLineSentence(); + entityList.push_back( DoxygenEntity(103, "", restOfLine)); + } + else cout << "AddtoGroup only supported for [(title)]. Command not added" << endl; + break; + + /* \anchor */ + case 104 : + getNextWord(); + cout << "Anchor is not supported. Command not added." << endl; + break; + + /* \arg */ + case 105: + + break; + + /* \attention */ + case 106: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(106, "", restOfLine)); + else cout << "Nothing followed attention command. Not added" < [] [] */ + case 115: + name = getNextWord(); + if (name.empty()) cout << "No word followed class command. Not added" <] */ + case 117: + cout << "cond is not supported. Command not added." << endl; + if (progressTilEndCommand("endcond") < 1) cout << "No endcode for command code found" << endl; + break; + + /* \copybrief */ + case 118: + getNextWord(); + cout << "copybrief is not yet implemented. Command not added." << endl; + break; + + /* \copydetails */ + case 119: + getNextWord(); + cout << "copydetails is not yet implemented. Command not added." << endl; + break; + + /* \copydoc */ + case 120: + getNextWord(); + cout << "copydoc is not yet implemented. Command not added." << endl; + break; + + /* \date { date description } */ + case 121: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(121, "", restOfLine)); + else cout << "Nothing followed date command. Not added" << endl; + break; + + /* \def */ + case 122: + name = getNextWord(); + if (!name.empty()) entityList.push_back( DoxygenEntity(122, name, "")); + else cout << "No word followed def command. Not added" << endl; + break; + + /* \defgroup (group title) */ + case 123: + name = getNextWord(); + if (name.empty())cout << "No word followed def command. Not added" << endl; + else { + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag a "<< endl; + } + else entityList.push_back( DoxygenEntity(123, name, restOfLine)); + } + break; + + /* \deprecated { description } */ + case 124: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(124, "", restOfLine)); + else cout << "Nothing followed deprecated command. Not added" << endl; + break; + + /* \details {detailed decription} */ + case 125: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(125, "", restOfLine)); + else cout << "Nothing followed details command. Not added" << endl; + break; + + /* \dir [] */ + case 126: + restOfLine = getOneLineSentence(); + entityList.push_back( DoxygenEntity(126, restOfLine , "")); + break; + + /* \dontinclude */ + case 127: + getNextWord(); + cout << "dontinclude is not implemented. Command not added." << endl; + break; + + /* \dot */ + case 128: + cout << "dot is not implemented. Command not added." << endl; + break; + + /* \dotfile ["caption"] */ + case 129: + getOneLineSentence(); + cout << "dotfile is not implemented. Command not added." << endl; + break; + + /* \e */ + case 130: + name = getNextWord(); + if (!name.empty()) entityList.push_back( DoxygenEntity(130, name, "")); + else cout << "No word followed e command. Not added" < */ + case 132: + getNextWord(); + cout << "elseif is not implemented. Command not added." << endl; + break; + + /* \em */ + /* Identical to e, so calls e */ + case 133: + addComment(130); + break; + + /* \endcode */ + case 134: + cout << "endcode is not implemented. Command not added." << endl; + break; + + /* \endcond */ + case 135: + cout << "endcond is not implemented. Command not added." << endl; + break; + + /* \enddot */ + case 136: + cout << "enddot is not implemented. Command not added." << endl; + break; + + /* \endhtmlonly */ + case 137: + cout << "endhtmlonly is not implemented. Command not added." << endl; + break; + + /* \endif */ + case 138: + cout << "endif is not implemented. Command not added." << endl; + break; + + /* \endlatexonly */ + case 139: + cout << "endlatexonly is not implemented. Command not added." << endl; + break; + + /* \endlink */ + case 140: + cout << "endlink is not implemented. Command not added." << endl; + break; + + /* \endmanonly */ + case 141: + cout << "endmanonly is not implemented. Command not added." << endl; + break; + + /* \endmsc */ + case 142: + cout << "endmsc is not implemented. Command not added." << endl; + break; + + /* \endverbatim */ + case 143: + cout << "endmsc is not implemented. Command not added." << endl; + break; + + /* \endxmlonly */ + case 144: + cout << "endxmlonly is not implemented. Command not added." << endl; + break; + + /* \enum */ + case 145: + name = getNextWord(); + if (!name.empty()) entityList.push_back( DoxygenEntity(145, name, "")); + else cout << "No word followed enum command. Not added" < */ + case 146: + name = getNextWord(); + if (!name.empty()) entityList.push_back( DoxygenEntity(146, name, "")); + else cout << "No word followed example command. Not added" < { exception description } */ + case 147: + name = getNextWord(); + if (name.empty()) cout << "No word followed exception command. Not added" < command. Not added" << endl; + } + break; + + /* \f$ */ + case 148: + cout << "f$ is not supported. Command not added." << endl; + if (progressTilEndCommand("f$") < 1) cout << "No endcode for command f$ found" << endl; + break; + + /* \f[ */ + case 149: + cout << "f$ is not supported. Command not added." << endl; + if (progressTilEndCommand("f]") < 1) cout << "No endcode for command f] found" << endl; + break; + + /* \f] */ + case 150: + cout << "f] is not implemented. Command not added." << endl; + break; + + /* \f{environment}{ */ + case 151: + cout << "f{environment}{ is not implemented. This may cause abnormal behaviour." << endl; + break; + + /* \f} */ + case 152: + cout << "f} is not implemented. This may cause abnormal behaviour." << endl; + break; + + /* \file [] */ + case 153: + name = getNextWord(); + if (!name.empty()) entityList.push_back( DoxygenEntity(153, name, "")); + else entityList.push_back( DoxygenEntity(153, "", "")); + break; + + /* \fn (function declaration) */ + case 154: + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag fn "<< endl; + } + else entityList.push_back( DoxygenEntity(154, restOfLine, "")); + break; + + /* \headerfile [] */ + case 155: + name = getNextWord(); + if (name.empty())cout << "No word followed headerfile command. Not added" << endl; + else { + restOfLine = getNextWord(); + entityList.push_back( DoxygenEntity(155, name, restOfLine)); + } + break; + + /* \hideinitializer */ + case 156: + cout << "hideinitializer is not implemented." << endl; + break; + + /* \htmlinclude */ + case 157: + name = getNextWord(); + if (name.empty())cout << "No word followed htmlinclude command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(157, name,"")); + } + break; + + /* \htmlonly */ + case 158: + cout << "htmlonly will be implemented later. For now the html is ignored." << endl; + if (progressTilEndCommand("endhtmlonly") < 1) cout << "No endcode for command code found" << endl; + break; + + /* \if */ + case 159: + cout << "if command is not implemented." << endl; + break; + + /* \ifnot */ + case 160: + cout << "ifnot command is not implemented." << endl; + break; + + /* \image ["caption"] [=] */ + case 161: + cout << "Image unsupported. Program may behave strangely if command is over one line." << endl; + getOneLineSentence(); + break; + + /* \include */ + case 162: + name = getNextWord(); + if (name.empty())cout << "No word followed include command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(162, name,"")); + } + break; + + /* \includelineno */ + case 163: + name = getNextWord(); + if (name.empty())cout << "No word followed includelineno command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(163, name,"")); + } + break; + + /* \ingroup ( [ ]) */ + case 164: + name = getNextWord(); + if (name.empty())cout << "No word followed ingroup command. Not added" << endl; + else { + string groupnames = getOneLineSentence(); + entityList.push_back( DoxygenEntity(164, name,groupnames)); + } + break; + + /* \internal */ + case 165: + entityList.push_back( DoxygenEntity(165, "","")); + break; + + /* \invariant { description of invariant } */ + case 166: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(166, restOfLine,"" )); + else cout << "Nothing followed invariant command. Not added" << endl; + break; + + /* \interface [] [] */ + case 167: + name = getNextWord(); + if (name.empty())cout << "No word followed ingroup command. Not added" << endl; + else { + string groupnames = getOneLineSentence(); + entityList.push_back( DoxygenEntity(167, name, groupnames)); + } + break; + + /* \latexonly */ + case 168: + cout << "latex only is not implemented" << endl; + if (progressTilEndCommand("endlatexonly") < 1) cout << "No endcode for command latexonly found" << endl; + break; + + /* \li { item-description } */ + //REDO + case 169: + addComment(105); + break; + + /* \line ( pattern ) */ + case 170: + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag line "<< endl; + } + else entityList.push_back( DoxygenEntity(170, restOfLine, "")); + break; + + /* \link */ + case 171: + name = getNextWord(); + if (name.empty())cout << "No word followed link command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(171, name,"")); + } + break; + + /* \mainpage [(title)] */ + case 172: + restOfLine = getOneLineSentence(); + entityList.push_back( DoxygenEntity(172, restOfLine, "")); + break; + + /* \manonly */ + case 173: + cout << "manonly is not implemented" << endl; + if (progressTilEndCommand("endmanonly") < 1) cout << "No endcode for command manonly found" << endl; + break; + + /* \msc */ + case 174: + cout << "msc is not implemented" << endl; + if (progressTilEndCommand("endmanonly") < 1) cout << "No endcode for command mscfound" << endl; + break; + + /* \n */ + case 175: + entityList.push_back( DoxygenEntity(175, "","")); + break; + + /* \name (header) */ + case 176: + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after header line "<< endl; + } + else entityList.push_back( DoxygenEntity(176, restOfLine, "")); + break; + + /* \namespace */ + case 177: + name = getNextWord(); + if (name.empty())cout << "No word followed namespace command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(177, name,"")); + } + break; + + /* \nosubgrouping */ + case 178: + cout << "Nosubgrouping not implemented "<< endl; + break; + + /* \note { text } */ + case 179: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(179, restOfLine,"" )); + else cout << "Nothing followed note command. Not added" << endl; + break; + + /* \overload [(function declaration)] */ + case 180: + restOfLine = getOneLineSentence(); + entityList.push_back( DoxygenEntity(172, restOfLine, "")); + break; + + /* \p */ + case 181: + name = getNextWord(); + if (name.empty())cout << "No word followed p command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(181, name,"")); + } + break; + + /* \package */ + case 182: + name = getNextWord(); + if (name.empty())cout << "No word followed package command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(182, name,"")); + } + break; + + /* \page (title) */ + case 183: + name = getNextWord(); + if (name.empty())cout << "No word followed page command. Not added" << endl; + else { + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag page "<< endl; + } + else entityList.push_back( DoxygenEntity(183, name, restOfLine)); + } + break; + + /* \par [(paragraph title)] { paragraph } */ + case 184: + name = getOneLineSentence(); + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(184, name, restOfParagraph )); + else cout << "Nothing followed par command. Not added" << endl; + break; + + /* \paragraph (paragraph title) */ + case 185: + name = getNextWord(); + if (name.empty())cout << "No word followed paragraph command. Not added" << endl; + else { + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after tag paragraph "<< endl; + } + else entityList.push_back( DoxygenEntity(185, name, restOfLine)); + } + break; + + /* \param { parameter description } */ + case 186: + name = getNextWord(); + if (name.empty())cout << "No word followed parameter command. Not added" << endl; + else { + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(186, name, restOfParagraph )); + else cout << "Nothing followed parameter command. Not added" << endl; + } + break; + + /* \post { description of the postcondition } */ + case 187: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(187, name, restOfParagraph )); + else cout << "Nothing followed post command. Not added" << endl; + break; + + /* \pre { description of the precondition } */ + case 188: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(187, name, restOfParagraph )); + else cout << "Nothing followed post command. Not added" << endl; + break; + + /* \private (PHP only) */ + case 189: + cout << "Private is a PHP Only Command." << endl; + break; + + /* \privatesection (PHP only) */ + case 190: + cout << "Privatesection is a PHP Only Command." << endl; + break; + + /* \property (qualified property name) */ + case 191: + restOfLine = getOneLineSentence(); + if(!restOfLine.empty()) entityList.push_back( DoxygenEntity(191, restOfLine, "")); + else cout << "Nothing followed property command. Not added" << endl; + break; + + /* \protected (PHP only) */ + case 192: + cout << "Protected is a PHP Only Command." << endl; + break; + + /* \protectedsection (PHP only) */ + case 193: + cout << "Protectedsection is a PHP Only Command." << endl; + break; + + /* \protocol [] [] */ + case 194: + break; + + /* \public (PHP only) */ + case 195: + cout << "Public is a PHP Only Command." << endl; + break; + + /* \publicsection (PHP only) */ + case 196: + cout << "Public Section is a PHP Only Command." << endl; + break; + + /* \ref ["(text)"] */ + case 197: + name = getNextWord(); + getOneLineSentence(); + cout << "Ref is currently not supported." << endl; + break; + + /* \relates */ + case 198: + name = getNextWord(); + if (name.empty())cout << "No word followed relates command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(198, name,"")); + } + break; + + /* \relatesalso */ + case 199: + name = getNextWord(); + if (name.empty())cout << "No word followed relatesalso command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(199, name,"")); + } + break; + + /* \remarks { remark text } */ + case 200: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(200, restOfParagraph, "" )); + else cout << "Nothing followed remarks command. Not added" << endl; + break; + + /* \return { description of the return value } */ + case 201: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(200, restOfParagraph, "" )); + else cout << "Nothing followed return command. Not added" << endl; + break; + + /* \retval { description } */ + case 202: + name = getNextWord(); + if (name.empty())cout << "No word followed retval command. Not added" << endl; + else { + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(202, name, restOfParagraph )); + else cout << "Nothing followed retval command. Not added" << endl; + } + break; + + /* \sa { references } */ + case 203: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(203, restOfParagraph, "" )); + else cout << "Nothing followed sa command. Not added" << endl; + break; + + /* \section (section title) */ + case 204: + name = getNextWord(); + if (name.empty())cout << "No word followed section command. Not added" << endl; + else { + restOfLine = getOneLineSentence(); + if((restOfLine).empty()){ + cout << "Error: No word after section paragraph "<< endl; + } + else entityList.push_back( DoxygenEntity(204, name, restOfLine)); + } + break; + + /* \see { references } */ + case 205: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(205, restOfParagraph, "" )); + else cout << "Nothing followed see command. Not added" << endl; + break; + + /* \showinitializer */ + case 206: + cout << "Showerinitializer command unsupported"<< endl; + break; + + /* \since { text } */ + case 207: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(207, restOfParagraph, "" )); + else cout << "Nothing followed since command. Not added" << endl; + break; + + /* \skip ( pattern ) */ + case 208: + getOneLineSentence(); + cout << "Skip command unsupported"<< endl; + break; + + /* \skipline ( pattern ) */ + case 209: + getOneLineSentence(); + cout << "Skipline command unsupported"<< endl; + break; + + /* \struct [] [] */ + case 210: + name = getNextWord(); + if (name.empty())cout << "No word followed struct command. Not added" << endl; + else { + string groupnames = getOneLineSentence(); + entityList.push_back( DoxygenEntity(210, name, groupnames)); + } + break; + + /* \subpage ["(text)"] */ + case 211: + getOneLineSentence(); + cout << "subpag command unsupported"<< endl; + break; + + /* \subsection (subsection title) */ + case 212: + getOneLineSentence(); + cout << "subsection command unsupported"<< endl; + break; + + /* \subsubsection (subsubsection title) */ + case 213: + getOneLineSentence(); + cout << "subsubsection command unsupported"<< endl; + break; + + /* \test { paragraph describing a test case } */ + case 214: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(214, restOfParagraph, "" )); + else cout << "Nothing followed test command. Not added" << endl; + break; + + /* \throw { exception description } */ + case 215: + name = getNextWord(); + if (name.empty())cout << "No word followed throw command. Not added" << endl; + else { + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(215, name, restOfParagraph )); + else cout << "Nothing followed throw command. Not added" << endl; + } + break; + + /* \todo { paragraph describing what is to be done } */ + case 216: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(216, restOfParagraph, "" )); + else cout << "Nothing followed todo command. Not added" << endl; + break; + + /* \tparam { description } */ + case 217: + name = getNextWord(); + if (name.empty())cout << "No word followed tparam command. Not added" << endl; + else { + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(217, name, restOfParagraph )); + else cout << "Nothing followed tparam command. Not added" << endl; + } + break; + + /* \typedef (typedef declaration) */ + case 218: + restOfLine = getOneLineSentence(); + if(!restOfLine.empty()) entityList.push_back( DoxygenEntity(218, restOfLine, "")); + else cout << "Nothing followed typedef command. Not added" << endl; + break; + + /* \union [] [] */ + case 219: + name = getNextWord(); + if (name.empty())cout << "No word followed union command. Not added" << endl; + else { + string groupnames = getOneLineSentence(); + entityList.push_back( DoxygenEntity(219, name, groupnames)); + } + break; + + /* \until ( pattern ) */ + case 220: + restOfLine = getOneLineSentence(); + if(!restOfLine.empty()) entityList.push_back( DoxygenEntity(220, restOfLine, "")); + else cout << "Nothing followed until command. Not added" << endl; + break; + + /* \var (variable declaration) */ + case 221: + restOfLine = getOneLineSentence(); + if(!restOfLine.empty()) entityList.push_back( DoxygenEntity(221, restOfLine, "")); + else cout << "Nothing followed var command. Not added" << endl; + break; + + /* \verbatim */ + case 222: + cout << "Verbatim is not supported. Command not added." << endl; + if (progressTilEndCommand("endverbatim") < 1) cout << "No endcode for command verbatim found" << endl; + break; + + /* \verbinclude */ + case 223: + name = getNextWord(); + if (name.empty())cout << "No word followed verbinclude command. Not added" << endl; + else { + entityList.push_back( DoxygenEntity(223, name,"")); + } + break; + + /* \version { version number } */ + case 224: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(224, restOfParagraph, "" )); + else cout << "Nothing followed version command. Not added" << endl; + break; + + /* \warning { warning message } */ + case 225: + restOfParagraph = stringTilEndOfParagraph(endIndex); + if(!restOfParagraph.empty()) entityList.push_back( DoxygenEntity(225, restOfParagraph, "" )); + else cout << "Nothing followed warning command. Not added" << endl; + break; + + /* \weakgroup [(title)] */ + case 226: + name = getNextWord(); + if (name.empty())cout << "No word followed weakgroup command. Not added" << endl; + else { + string groupnames = getOneLineSentence(); + entityList.push_back( DoxygenEntity(226, name,groupnames)); + } + break; + + /* \xmlonly */ + case 227: + cout << "XML is not supported. Command not added." << endl; + if (progressTilEndCommand("endxmlonly") < 1) cout << "No endcode for command xmlonly found" << endl; + break; + + /* \xrefitem "(heading)" "(list title)" {text} */ + case 228: + //NEED TO IMPLEMENT + cout << "xrefitem is not supported yet. Command not added." << endl; + break; + + /* \$ */ + case 229: + entityList.push_back(229); + break; + + /* \@ */ + case 230: + entityList.push_back(230); + break; + + /* \\ */ + case 231: + entityList.push_back(231); + break; + + /* \& */ + case 232: + entityList.push_back(232); + break; + + /* \~[LanguageId] */ + case 233: + break; + + /* \< */ + case 234: + entityList.push_back(234); + break; + + /* \> */ + case 235: + entityList.push_back(235); + break; + + /* \# */ + case 236: + entityList.push_back(236); + break; + + /* \% */ + case 237: + entityList.push_back(237); + break; + + +} + + } + +int parse(string commentBlob){ + //NO error checking since this is only for my personal testing + // usage for now is "program -DocStyle filename + + /* + string java = "-java"; + + + if ((argc < 3)||(java.compare(StringToLower(argv[1])))!= 0 ) {cout << "Incorrect Usage. -Docstyle filename only." << endl; exit(1);} + string line; + ifstream doxCommentFile(argv[2], ios::in); + doxCommentFile >> doxygenString; + while(getline(doxCommentFile, line)){ + doxygenString += line + "\n";} + doxCommentFile.close(); + */ + doxygenString = commentBlob; + cout << doxygenString; + + +if(doxygenString.compare(0, 3, "/**")!= 0 && doxygenString.compare(0, 3, "/*!")!= 0 + && doxygenString.compare(0, 3, "///")!= 0 && doxygenString.compare(0, 3, "//!")!= 0 ){ + + cout << "String Is not in proper Doxygen format." << endl; + exit(1); + } + + +if(doxygenString[3] == '<'){ + cout << "Support for side comments not yet implemented"< 0){} + +while(endIndex < doxygenString.length() && startIndex < doxygenString.length()){ +currWord = getNextWord(); + +//while((currWord = nextWord()).compare("") == 0 ){ nextLine();} + +if(currWord[0] == 92 || currWord[0] == '@'){ + currWord = doxygenString.substr(startIndex+1, endIndex - startIndex - 1); + currCommand = findCommand(currWord); + if (currCommand < 0 ){ cout << "BAD COMMAND: " << currWord << endl; exit(1);} + cout << "Command: " << currWord << " " << currCommand << endl; + startIndex = endIndex; +} + +else if (briefDescriptions && !briefDescExists ){ + currComment = getOneLineSentence(); + if (!currComment.empty()){ + briefDescExists = 1; + cout << "Brief Description Found : " << currComment << endl << "-----" << endl; + entityList.push_back( DoxygenEntity(99, "", currComment)); + startIndex = endIndex; + } + else cout << "Error: Brief comment extends more than 1 line." << endl; +} + +else{ + currComment = getDescription(); + cout << "Long Description Found : " << currComment << endl << "-----" << endl; + entityList.push_back( DoxygenEntity(100, "", currComment)); + startIndex = endIndex; +} + +} + +cout << "Entity List : "<< endl; +list::iterator p = entityList.begin(); +while (p != entityList.end()){ + (*p).printEntity(); + p++; +} + + + return 0; +} + + +} + diff --git a/Source/DoxygenTranslator/example.i b/Source/DoxygenTranslator/example.i new file mode 100644 index 000000000..20f2488cb --- /dev/null +++ b/Source/DoxygenTranslator/example.i @@ -0,0 +1,19 @@ +/** File example. This is the Simple Test File! + */ + +%module example + +%inline %{ + +/** Function for Greater Common Divisor + * Compute the greatest common divisor of positive integers + * @param x an integer argument. + * @param y another integer argument. + * @return the GCD + */ +extern int gcd(int x, int y); + +/** Global Variable Foo. Foo is the value of Foo. + */ +extern double Foo; +%}